Conversation
ChatCompletionInferenceParams only had temperature, top_p and max_tokens, and extra="forbid" rejected anything else, so sampling knobs had to be hand-written into extra_body. Add presence_penalty, top_k, min_p and repetition_penalty as optional, range-checked fields. presence_penalty is sent top-level; the other three are not OpenAI parameters, so they go through extra_body, where explicit extra_body keys still win. Drop the new keys from the config fingerprint while unset, so existing configs keep their stored hash and resume still works. Signed-off-by: ChethanUK <chethanuk@outlook.com>
The provider-support note said the Anthropic Messages API has no min_p or repetition_penalty and to leave them unset, but not what happens if they are set anyway. The adapter's exclude set only covers presence_penalty, and extra_body keys are merged into the request body after that set is applied, so min_p and repetition_penalty are still sent and the API rejects the request. Say so on the page, and assert it in the facade wire test, so the behavior is pinned by a test instead of left implied. Signed-off-by: ChethanUK <chethanuk@outlook.com>
The wire test only proved synchronous serialization, so a regression confined to agenerate would have passed. The async adapters assemble the request separately from the sync ones, even though both go through the same consolidate_kwargs and TransportKwargs.from_request. Lift the three cases into a shared table and run them through agenerate as well, so both public paths are pinned by the same assertions. Signed-off-by: ChethanUK <chethanuk@outlook.com>
A per-call extra_body no longer drops them, and the Anthropic adapter excludes min_p and repetition_penalty, which the Messages API rejects. Signed-off-by: ChethanUK <chethanuk@outlook.com>
Contributor
Linked Issue CheckIssue #354 has not been triaged yet. A maintainer needs to review You can continue working on the PR in the meantime. The check will |
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Summary
ChatCompletionInferenceParamsonly takestemperature,top_pandmax_tokens, so todaytop_k,min_p,repetition_penaltyandpresence_penaltyhave to be written intoextra_bodyby hand. This adds them as optional, range-checked fields sent as top-level request fields. vLLM and SGLang accept all four; a strict OpenAI endpoint may reject the first three.🔗 Related Issue
Closes #354
🔄 Changes
top_k,min_pandrepetition_penaltyare fields on the engine'sChatCompletionRequestand in_COMPLETION_REQUEST_FIELDS, likepresence_penalty. A per-callextra_bodycan't drop them, and a same-namedextra_bodykey still wins.min_pandrepetition_penalty.top_kis a Messages API param and is still sent.None, so existingconfig_hashvalues don't change and older runs still resume.frequency_penaltyis left out since Add other common params to ChatCompletionInferenceParams #354 doesn't ask for it. The engine request already has the field, so it's a small follow-up.🧪 Testing
make testpassesRan a 2-record
previewagainst a local mock server with one LLM text column per provider type, all four params set andextra_body={"chat_template_kwargs": {...}}. The/v1/chat/completionsbody had all four fields andchat_template_kwargsat the top level. The/v1/messagesbody hadtop_kand nomin_porrepetition_penalty, and both columns generated.ModelFacade.generate(..., extra_body={"reasoning_effort": "high"})still sends all four fields.✅ Checklist