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

Logprobs Not Returned When Using The Response Api

When ChatOpenAI is configured with use_responses_api=True and logprobs=True, invocation fails with TypeError: Responses.create() got an unexpected keyword argument 'logprobs'. Even when using include=['message.output_text.logprobs'], logprobs are not parsed into response_metadata.

highConfidence 85%LangchainEmbeddingslangchain-coreAffected V1.1.12

Origin Analysis

In langchain_openai's BaseChatOpenAI._generate, when use_responses_api=True, the payload for responses.create incorrectly includes the logprobs parameter, which is not supported by the OpenAI Responses API. The Responses API requires logprobs to be requested via the include parameter. Additionally, the response parser does not extract logprobs from the Responses API output structure (response.output -> item.content -> part.logprobs) into the LangChain generation message's response_metadata.
```python from langchain_openai import ChatOpenAI client = ChatOpenAI( model="gpt-5.2", use_responses_api=True, logprobs=True ) response = client.invoke("say hello world") ```

Fixing Code Block

Edge Case Audit

This patch relies on the internal structure of the OpenAI Responses API (output list, content parts with logprobs attribute). If OpenAI changes this structure or renames 'message.output_text.logprobs' in the include parameter, the patch may silently stop returning logprobs or raise new errors. It does not affect Chat Completions API usage because it only activates when use_responses_api=True. Rollback: remove the patch and avoid passing logprobs=True with use_responses_api=True; instead manually construct requests or use the include parameter without logprobs parsing. Test thoroughly with concurrent requests, as the include list is built fresh each call and should not cause shared-memory issues.

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