Skip to content

handle top_p correctly#196

Merged
Alex Z (CLowbrow) merged 13 commits intomainfrom
alex/strip-top-p-conditionally
Apr 15, 2026
Merged

handle top_p correctly#196
Alex Z (CLowbrow) merged 13 commits intomainfrom
alex/strip-top-p-conditionally

Conversation

@CLowbrow
Copy link
Copy Markdown
Contributor

Not all openai models can handle it.

Comment thread payloads/transforms/transform_errors.json Outdated
@CLowbrow Alex Z (CLowbrow) marked this pull request as ready for review April 14, 2026 21:17
Comment thread payloads/cases/params.ts
Comment on lines +1210 to +1224
topPReasoningModelParam: {
"chat-completions": {
model: OPENAI_CHAT_COMPLETIONS_MODEL,
messages: [{ role: "user", content: "Say hi." }],
top_p: 0.9,
},
responses: {
model: OPENAI_RESPONSES_MODEL,
input: [{ role: "user", content: "Say hi." }],
top_p: 0.9,
},
anthropic: null,
google: null,
bedrock: null,
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we delete and just re-use topPParam they r basically identilca.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah ill incorporate it into the one above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok nm I think i would lose OpenAI to OpenAI test coverage for: “a Chat Completions request already targeting a reasoning model contains invalid top_p, and Lingua strips it.”.

@CLowbrow Alex Z (CLowbrow) merged commit 8db9d3f into main Apr 15, 2026
9 checks passed
Alex Z (CLowbrow) pushed a commit that referenced this pull request Apr 17, 2026
Opus 4.7 does not accept the temperature parameter. Mirrors the
OpenAI top_p fix (#196) by adding a model-transform pipeline to the
Anthropic provider and wiring it into request_from_universal so
temperature is stripped regardless of whether it came from canonical
params or passthrough extras. Handles bare, dated, Bedrock, and Vertex
model ids.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants