langchain-aws icon indicating copy to clipboard operation
langchain-aws copied to clipboard

ChatBedrockConverse cannot handle Bedrock openai.gpt-oss-120b-1:0 response

Open Bharath9t7 opened this issue 2 months ago • 2 comments

I am trying to use openai.gpt-oss-120b-1:0 model via ChatBedrockConverse class. It seems that, boto3 API returns unexpexted keys in the response json:

ValueError: Unexpected content block type in content. Expected to have one of 'text', 'tool_use', 'image', or 'tool_result' keys. Received:

{'reasoning_content': {'text': 'We have a..'"}}

is there any way to handle in the langchain implementation?

Bharath9t7 avatar Oct 14 '25 18:10 Bharath9t7

Hi @Bharath9t7, thank you for submitting an issue.

The exception message seems to be from an older version of langchain-aws, as the current message is different:

  • https://github.com/langchain-ai/langchain-aws/blob/main/libs/aws/langchain_aws/chat_models/bedrock_converse.py#L1822-L1827

Support for reasoning_content keys was added in v0.2.14:

  • https://github.com/langchain-ai/langchain-aws/releases/tag/v0.2.14
  • https://github.com/langchain-ai/langchain-aws/pull/375/files

Can you try upgrading to the latest stable version (v0.2.35), and see if that resolves the error?

michaelnchin avatar Oct 14 '25 18:10 michaelnchin

Hey @michaelnchin, oddly I am having the reasoning_content issue with this ChatBedrockConverse as well. I am using the following relevant packages

    "boto3==1.40.45",
    "botocore==1.40.45",
    "langchain==0.3.27",
    "langchain-aws==0.2.34",
    "langchain-community==0.3.30",
    "langchain-core==0.3.76",
    "langgraph==0.6.8",
    "langgraph-checkpoint==2.1.1",
    "langgraph-checkpoint-redis==0.0.8",
    "langgraph-sdk==0.2.9"

Let me know any other details I can provide.

peterkarman1 avatar Oct 15 '25 18:10 peterkarman1