fix(litellm): omit temperature for reasoning models#2462
Open
Sanderhoff-alt wants to merge 1 commit into
Open
Conversation
8f7f6ca to
1202e33
Compare
3809c74 to
7904d52
Compare
7904d52 to
90bcb8c
Compare
Share the OpenAI-compatible reasoning model detector between the native OpenAI-compatible provider and LiteLLM-backed providers. Skip forwarding explicit temperature values through LiteLLM for those models, including Azure GPT-5 deployments, o-series models, and DeepSeek reasoning routes. Limit the LiteLLM Router check to deployments reachable from the default entrypoint so unrelated model groups do not affect call parameters.
90bcb8c to
1f547b6
Compare
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
temperaturewhen the in-process LiteLLM provider is configured with GPT-5, o1/o3, or supported DeepSeek reasoning models.defaultrouter entrypoint.Why
Azure OpenAI GPT-5.5 rejects explicit temperature values. It only accepts the provider default.
Hindsight currently passes internal temperatures such as
0.0,0.1, and0.9through its built-in LiteLLM SDK provider. That can break verification, retain, think, and related internal LLM calls when the configured LiteLLM model is Azure GPT-5.5.This PR keeps the fix small: if Hindsight can tell from the configured LiteLLM model string that the target is a reasoning model that rejects temperature, it removes
temperaturebefore calling LiteLLM.For
litellmrouter, Hindsight always calls the Router with modeldefault. The check therefore only looks at thedefaultdeployment and any deployments reachable through Router fallbacks. A GPT-5 deployment in an unrelated model group will not change request parameters for calls that cannot reach it.This PR only covers Hindsight's built-in LiteLLM SDK usage (
litellmandlitellmrouter). It does not try to solve arbitrary aliasing where the configured model name hides the real model family; that would require explicit capability metadata or configuration.Fixes #2459.
Validation
uv run pytest tests/test_llm_router_provider.py tests/test_llm_extra_body.py tests/test_deepseek_tool_call_compat.py tests/test_openai_max_tokens_param.py -q