Repository navigation
fix: don't send temperature to Claude models that reject it - #2217
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
The Claude entries in NO_SUPPORT_TEMPERATURE_MODELS stop at claude-opus-4-7 and only match exact ids, so claude-opus-4-8, the Claude 5 family (Opus, Sonnet, Haiku), Fable and Mythos got a temperature and failed with a 400, as did Bedrock and OpenRouter ids such as anthropic.claude-opus-5-5 or anthropic/claude-sonnet-5. Match those families by prefix after dropping the provider prefix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
create_chat_completionsendstemperatureunless the model is inNO_SUPPORT_TEMPERATURE_MODELS. The Claude part of that list stops atclaude-opus-4-7and is matched exactly, so these models still get a temperature (0.25–0.4 depending on the step), and Anthropic answers with a 400:claude-opus-4-8,claude-opus-5,claude-opus-5-5claude-sonnet-5,claude-sonnet-5-5,claude-haiku-5-5(the last two reject any non-default value)claude-fable-5,claude-fable-5-1,claude-mythos-*anthropic.claude-opus-5-5,us.anthropic.claude-opus-4-7-v1:0,anthropic/claude-sonnet-5. Evenclaude-opus-4-7, which is on the list, isn't matched in that form.Change
llm_provider/generic/base.py: newNO_SUPPORT_TEMPERATURE_MODEL_PREFIXESfor the Claude families that reject sampling parameters, andsupports_temperature(model). It checks the existing exact list first, then the prefixes on the bare model name, after dropping ananthropic.(Bedrock) orvendor/(OpenRouter) prefix. The existing list is unchanged.utils/llm.py: usessupports_temperature()instead ofmodel not in NO_SUPPORT_TEMPERATURE_MODELS. That's the only place the list is read. The tool-calling path inutils/tools.pydoesn't set a temperature, and its fallback goes throughcreate_chat_completion.tests/test_claude_temperature.py(new): the models above gettemperature=None, andgpt-4.1still gets the requested value.Testing
A wider
pytest testsrun (backend and docs excluded) gives 550 passed, 31 failed. The failures are the same with and without this change (MCP config, retriever and websocket-import tests that need optional packages or fail because of test order).I made this change with Claude Code and checked the result myself.
🤖 Generated with Claude Code