AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

[Langchain-Openai] ChatOpenAI Forwards Unsupported Sampling Parameters To Gpt-6-Astra Via Responses API

ChatOpenAI with use_responses_api=True sends temperature, top_p, and top_logprobs to the Responses API for gpt-6-astra, which does not support them, causing HTTP 400 errors. The issue is reproduced with langchain-openai==1.6.6.

highConfidence 90%LangchainEmbeddingslangchain-coreChainsAffected Vlangchain-Openai<=1.6.6

Origin Analysis

The Responses API request construction in langchain_openai does not validate or filter sampling parameters based on model capabilities. For gpt-6-astra (a reasoning model), temperature, top_p, and top_logprobs are not supported by the OpenAI API, but langchain-openai forwards them unchanged, leading to server-side rejection.
1. Set OPENAI_API_KEY.\n2. Instantiate ChatOpenAI with model='gpt-6-astra', use_responses_api=True, max_tokens=32, max_retries=0.\n3. Call invoke() with temperature=0.2, top_p=0.5, or top_logprobs=1.\n4. Observe HTTP 400 errors: 'Unsupported parameter: temperature', 'Unsupported parameter: top_p', 'logprobs are not supported with reasoning models.'

Fixing Code Block

Edge Case Audit

The proposed fix relies on a hardcoded whitelist of unsupported models, which requires manual updates when new models with similar restrictions are released. It only validates when use_responses_api=True; the Chat Completions API may have different support, so the mapping must be maintained per API type. Additionally, if a model name is passed as an alias or via a custom resolver, the mapping lookup could miss it. To rollback, remove the _validate_sampling_params call and the mapping; the original behavior (passing parameters through) will be restored, but users will again encounter server-side 400 errors for these models.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state