Repository navigation
fix(anthropic): omit unsupported temperature parameters - #210
Open
kecheng-lai wants to merge 1 commit into
Open
kecheng-lai wants to merge 1 commit into
kecheng-lai wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
🎯 Description
Omit
temperaturefor the Anthropic models listed in #209 that reject non-default sampling parameters. Add a model capability flag and apply it to Python completions, tool calls and streams, and TypeScript SDK/fetch generation and streams. Preserve configured temperatures (including zero) for older and unknown models.🔗 Related Issues
Fixes #209.
🔄 Type of Change
🧪 Testing
test_alignment_parity[cases0]: Windows raisesWinError 193when it directly executes the extensionlessnode_modules/.bin/tsxscript. The identical failure was reproduced from an unmodified280ac97archive using the same interpreter and node_modules.cascadeflow,tests, andexamples; mypy passes across 166 source files (with an existing Python-version configuration warning).📸 Screenshots/Examples (if applicable)
For
claude-opus-4-7, the default request previously included"temperature": 0.7; it now omits the field. A local endpoint rejecting that field returns the expected completion after the fix.claude-opus-4-6retains its default/custom temperature, including0.📋 Checklist
💥 Breaking Changes (if any)
Explicit temperature settings are omitted for the affected models, as required by their sampling restriction. Existing temperature behavior is preserved for the older/unknown models tested. Public method signatures are unchanged; capability metadata gains an optional TypeScript field and a defaulted Python constructor argument.
📊 Performance Impact (if applicable)
Only a short model-prefix capability check is added. No performance benchmark was run.
🔐 Security Considerations
No credentials or sensitive data are included, and no new external requests are introduced. Regression tests use dummy keys and simulated responses.
🚀 Deployment Notes (if applicable)
No dependency, environment variable or database changes.
📝 Additional Notes
Implementation, tests and this description were prepared with an AI coding assistant. The model restriction list follows #209 and its linked Anthropic documentation. This patch does not change verifier-error fallback behavior or other sampling parameters supplied through extra kwargs.
🙏 Reviewers
Maintainer review and CI are pending.
By submitting this PR, I confirm that: