fix(langchain): stop dropping temperature on gpt-5.x models [PC-4988] - #134
Open
tudormatei1 wants to merge 1 commit into
Open
fix(langchain): stop dropping temperature on gpt-5.x models [PC-4988]#134tudormatei1 wants to merge 1 commit into
tudormatei1 wants to merge 1 commit into
Conversation
tudormatei1
force-pushed
the
fix/gpt5-temperature-dropped-by-langchain-openai
branch
from
September 4, 2026 09:31
bb800c7 to
2e6e887
Compare
tudormatei1
marked this pull request as ready for review
September 4, 2026 09:35
tudormatei1
requested review from
DragosBobolea,
cosminacho,
cristipufu,
dragosvelcea,
ionmincu,
ionut-mihalache-uipath,
radu-mocanu and
vldcmp-uipath
as code owners
September 4, 2026 09:35
langchain-openai strips temperature for every gpt-5* model unless reasoning effort is explicitly the string "none". Unset effort is None, not "none", so a configured temperature never reached the dotted variants, which default to effort none and do accept it. Nothing errored or warned. Gpt5TemperatureMixin overrides both strip sites on UiPathChatOpenAI and UiPathAzureChatOpenAI and defers to langchain everywhere it is already right, so base gpt-5, pro variants, reasoning-enabled models and models flagged shouldSkipTemperature by discovery are unaffected. Two canary tests assert the upstream bug is still present, so this gets deleted once the upstream fix lands. Verified end to end through the agents runtime against gpt-5.4.
tudormatei1
force-pushed
the
fix/gpt5-temperature-dropped-by-langchain-openai
branch
from
September 4, 2026 09:41
2e6e887 to
011775f
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.
langchain-openai strips
temperaturefor everygpt-5*model unless reasoning effort is explicitly the string"none". Unset effort isNone, not"none", so an agent's configured temperature never reached the dotted variants (gpt-5.2,gpt-5.4), which default to effortnoneand do accept it. Nothing errored or warned, so the value just vanished between agent.json and the request.Confirmed the models accept it: a Responses call to gpt-5.4 with
temperature: 0.6and noreasoning_effortreturns 200 and echoes backtemperature: 0.6withreasoning.effort: "none".Affects the langchain package only.
Gpt5TemperatureMixinoverrides both sites langchain strips at (validate_temperatureand_construct_responses_api_payload) onUiPathChatOpenAIandUiPathAzureChatOpenAI, and defers to langchain everywhere it is already right, so basegpt-5,provariants, models with reasoning explicitly enabled, and models flaggedshouldSkipTemperatureby discovery keep losing the parameter as before.Start reading at
gpt5_keeps_temperature. The mixin has to go before the vendor class on the MRO, and the_get_request_payloadoverride reinstates a value the layer below deliberately removed, which reads oddly but is unavoidable: the second strip is a module-level function with no hook between it and the request.Two canary tests assert the upstream bug is still present on unpatched
ChatOpenAI. They fail when the upstream fix ships and name the files to delete, so this cannot rot silently.Verified end to end through the agents runtime against gpt-5.4.
ruff check,ruff format --check,pyrightand the openai/sampling tests are clean; the pre-existing failures elsewhere inpytest testsneed gateway credentials and are unchanged by this branch.Upstream: langchain-ai/langchain#35423, fix pending in langchain-ai/langchain#35424.