Skip to content

ChatBedrockConverse cannot handle Bedrock DeepSeek R1 response #415

Open
@mesutgurlek

Description

@mesutgurlek

Hi, I am trying to use Bedrock Deepseek R1 model via ChatBedrockConverse class, that wraps the boto3 Converse API.
Initially, I tested the related script in https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-deepseek.html
It seems that, boto3 API returns unexpexted keys in the response json:

[{'text': '\n\n1. **"Levitating" - Dua Lipa ft. DaBaby**  \n2. **"Blinding Lights" - The Weeknd**  \n3. **"Rolling in the Deep" - Adele**'}, {'SDK_UNKNOWN_MEMBER': {'name': 'reasoningContent'}}]

The SDK_UNKNOWN_MEMBER key raises error in the _bedrock_to_lc function in the implementation:

else:
raise ValueError(
"Unexpected content block type in content. Expected to have one of "
"'text', 'tool_use', 'image', 'video, 'document', 'tool_result',"
"'json', 'guard_content', or "
"'reasoning_content' keys. Received:\n\n{block}"
)
return lc_content

I am also opening a ticket to AWS support but is there any way to handle in the langchain implementation ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions