Skip to content

Temperature dropped from responses api payload with gpt-5.2 default reasoning effort #35423

Description

@artdent

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

model = ChatOpenAI(
    model="gpt-5.2",
    use_responses_api=True,
    temperature=0.5,
)
model.invoke([{"role": "user", "content": "Hello, world"}])

Error Message and Stack Trace (if applicable)

DEBUG:openai._base_client:Request options: {'method': 'post', 'url': '/responses', 'headers': {'X-Stainless-Raw-Response': 'true'}, 'files': None, 'idempotency_key': 'stainless-python-retry-9a86afe9-a319-4db8-b386-d974747f84fe', 'content': None, 'json_data': {'input': [{'content': 'Hello, world', 'role': 'user'}], 'model': 'gpt-5.2', 'stream': False}}

Description

Temperature is supported in newer (5.x) openai models as long as reasoning is disabled. With gpt-5.2, the default reasoning effort is none, so the temperature parameter should be included when reasoning_effort is not supplied. Instead, validate_temperature removes the temperature parameter in that scenario, as does _construct_responses_api_payload:

if (
model_lower.startswith("gpt-5")
and ("chat" not in model_lower)
and values.get("reasoning_effort") != "none"
and (values.get("reasoning") or {}).get("effort") != "none"
):

model = payload.get("model") or ""
if (
model.startswith("gpt-5")
and ("chat" not in model) # gpt-5-chat supports
and (payload.get("reasoning") or {}).get("effort") != "none"
):
payload.pop("temperature", None)

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.6.0: Wed Nov 5 21:32:34 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T6020
Python Version: 3.11.11 (main, Feb 12 2025, 15:06:01) [Clang 19.1.6 ]

Package Information

langchain_core: 1.2.15
langsmith: 0.7.6
langchain_openai: 1.1.10

Optional packages not installed

deepagents
deepagents-cli

Other Dependencies

httpx: 0.28.1
jsonpatch: 1.33
openai: 2.23.0
orjson: 3.11.7
packaging: 26.0
pydantic: 2.12.5
pyyaml: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
tenacity: 9.1.4
tiktoken: 0.12.0
typing-extensions: 4.15.0
uuid-utils: 0.14.1
xxhash: 3.6.0
zstandard: 0.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugRelated to a bug, vulnerability, unexpected error with an existing featureexternalopenai`langchain-openai` package issues & PRs

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions