Checked other resources
Package (Required)
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
Checked other resources
Package (Required)
Related Issues / PRs
No response
Reproduction Steps / Example Code (Python)
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_temperatureremoves the temperature parameter in that scenario, as does_construct_responses_api_payload:langchain/libs/partners/openai/langchain_openai/chat_models/base.py
Lines 939 to 944 in 5c6f8fe
langchain/libs/partners/openai/langchain_openai/chat_models/base.py
Lines 3952 to 3958 in 5c6f8fe
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies