feat(bedrock): support Claude extended thinking on Converse
Merged
SA
7h ago+1282+1282+0123456789012345678901234567890123456789-60-60-01234567890123456789
Closes #1654
The Bedrock provider dropped reasoning in both directions: it never sent a thinking configuration and discarded reasoningContent from Converse and ConverseStream.
What changes for users
reasoning_effort(Chat Completions),reasoning.effort(Responses) andthinking(/v1/messages) now reach Claude models on Bedrock asadditionalModelRequestFields: a thinking budget on older models, adaptive thinking plusoutput_config.efforton adaptive ones.noneturns thinking off where the model allows it.- Reasoning comes back as
reasoning_content, Responses reasoning items, orthinkingblocks, in buffered and streamed responses. Models from other families that report reasoning getreasoning_contenttoo. - Signed and redacted thinking blocks round-trip as
extra_content.anthropic.thinking_blocks, so thinking tool-use loops continue instead of failing with a 400. The router now keeps this state forbedrock. - While thinking,
max_tokensis raised above the budget (within the policy's output ceiling) and atemperatureother than 1 or atop_pbelow 0.95 is dropped.
Bedrock-specific behavior
- Claude is recognized by model ID (foundation model, system inference profile, or their ARNs). An application inference profile ARN does not name its model, so it gets no thinking configuration.
- A forced
tool_choicecannot be combined with thinking; the tool call is kept and thinking is left out. - Also fixed: Claude on Bedrock rejects
temperaturetogether withtop_p, sotop_pis dropped when both are sent, and both are dropped on models that removed sampling parameters.
The model rules are shared with the Anthropic provider through a small exported helper rather than duplicated.
Testing
Request and response shapes were checked against real Bedrock with the AWS CLI. The full gateway path was not run against real Bedrock; it is covered by a test that drives the AWS SDK against a fake Converse endpoint, and streaming by unit tests on the event handler. output_config.effort combined with a JSON-schema response_format is untested.