Skip to content

Bedrock + Anthropic extended thinking: error because thinking parts are not sent back #2453

@DouweM

Description

@DouweM

From @snakingfire in #2040 (comment):

reasoning_model = BedrockConverseModel(
        "us.anthropic.claude-sonnet-4-20250514-v1:0",
        provider=BedrockProvider(bedrock_client=bedrock_client),
    )
reasoning_model_settings = BedrockModelSettings(
        parallel_tool_calls=True,
        bedrock_additional_model_requests_fields={
            "thinking": {"type": "enabled", "budget_tokens": 1024}
        },
    )
...

botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the Converse operation: The model returned the following errors: messages.1.content.0.type: Expected thinking or redacted_thinking, but found text. When thinking is enabled, a final assistant message must start with a thinking block (preceeding the lastmost set of tool_use and tool_result blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable thinking. Please consult our documentation at https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking

Like #2072 but for Bedrock

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions