fix: convert adaptive thinking to enabled for Bedrock models that don't support it#220
Open
blinkagent[bot] wants to merge 3 commits intomainfrom
Open
fix: convert adaptive thinking to enabled for Bedrock models that don't support it#220blinkagent[bot] wants to merge 3 commits intomainfrom
blinkagent[bot] wants to merge 3 commits intomainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When Claude Code sends
thinking.type: "adaptive"(the default for Opus 4.6 / Sonnet 4.6), Bedrock models that predate adaptive thinking support (e.g. Sonnet 4.5 in GovCloudus-gov-west-1) reject the request with a 400 error:Changes
intercept/messages/base.gobedrockModelSupportsAdaptiveThinking()to detect whether the target Bedrock model supports adaptive thinking (only Opus 4.6 and Sonnet 4.6 do)convertAdaptiveThinkingForBedrock()which converts{"type": "adaptive"}to{"type": "enabled", "budget_tokens": 10000}when the target model doesn't support itaugmentRequestForBedrock()to call the new conversion after the model name remapintercept/messages/base_test.goTestBedrockModelSupportsAdaptiveThinking— 11 cases covering all model name formatsTestConvertAdaptiveThinkingForBedrock— 6 cases: conversion for non-4.6 models, preservation for 4.6 models, no-op forenabled/disabled/absent thinkingFixes #219