Omit temperature for GPT-6 Astra (every request 400s today) - #154
Merged
Conversation
GPT-6 Astra rejects `temperature` outright: OpenAI returns
400 Unsupported parameter: 'temperature' is not supported with this model
when the field is present at all. Clients always send one — chat-app pins
0.0 and it is part of the signed request hash — so every Astra chat has
been failing since the model was registered.
The gpt-5.6 family has the same restriction but never showed it, because
langchain-openai strips `temperature` itself for model names starting
with "gpt-5" (and only those). "gpt-6-astra" misses that workaround, so
the value went out on the wire.
Handle it in the registry instead of relying on langchain internals:
`supports_temperature=False` already existed for Anthropic's Opus 4.7+
and Fable 5, but was only honored in the Anthropic branch of
get_chat_model_cached. Move the check up next to `force_temperature` so
the effective temperature is None for any flagged model, whatever the
provider, and every langchain-<provider> package then omits the field
from the outgoing payload.
Tests cover the Chat Completions and Responses API paths for Astra, an
Anthropic model, an unflagged model (value preserved), `force_temperature`
(still applied), and a registry-wide sweep asserting nothing flagged
`supports_temperature=False` can be built with a temperature.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019GiCnGpGxLEusqVUS6zUHw
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.
The bug
Every GPT-6 Astra chat fails:
Astra rejects
temperatureoutright — the API 400s if the field is present at all. Clients always send one (chat-app pinstemperature: 0.0, and it is part of the signed request hash), so the model has been unusable since it was registered in #153.Why it slipped through
The gpt-5.6 family has the same restriction and never showed it, because
langchain-openaistripstemperatureitself — but only for model names starting withgpt-5:gpt-6-astramisses that workaround, so the value went out on the wire.The fix
supports_temperature=Falsealready existed inModelConfig(for Anthropic's Opus 4.7+ and Fable 5) but was only honored inside the Anthropic branch ofget_chat_model_cached. Moved the check up next toforce_temperatureso the effective temperature isNonefor any flagged model regardless of provider — everylangchain-<provider>package treatsNoneas "omit the field" rather than "send null" — and flagged Astra in the registry.This keeps the restriction in the registry rather than depending on langchain's model-name heuristics, and covers both request paths (Chat Completions, and the Responses API used when tools are bound).
Tests
tee_gateway/test/test_tee_core.py::TestTemperatureOmission:temperatureon the Chat Completions path and on the Responses API pathgpt-4.1) still sends0.0force_temperature(o4-mini) is still appliedsupports_temperature=Falsecan be constructed with a temperaturemake lintand the CI test command pass locally (403 passed, 6 skipped, 117 subtests).Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_019GiCnGpGxLEusqVUS6zUHw
Generated by Claude Code