fix: add adaptive thinking support for Claude Opus 4.7+#1125
Closed
fix: add adaptive thinking support for Claude Opus 4.7+#1125
Conversation
Claude Opus 4.7 only supports adaptive thinking mode (thinking.type: 'adaptive') and rejects the legacy budget-based thinking (thinking.type: 'enabled'). This change: - Adds model detection to automatically use adaptive thinking for Opus 4.7+ - Uses adaptive thinking by default for Opus 4.6 and Sonnet 4.6 (recommended) - Falls back to budget-based thinking for older models (Sonnet 4.5, etc.) - Adds thinking support for google-vertex-anthropic and amazon-bedrock providers - Adds ANTHROPIC_EFFORT env var to control thinking depth (low/medium/high/max) Fixes #SOU-918 Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Michael Sukkarieh <msukkari@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Summary
Fixes the issue where Claude Opus 4.7 returns an error:
"thinking.type.enabled" is not supported for this model. Use "thinking.type.adaptive" and "output_config.effort" to control thinking behavior.Claude Opus 4.7 only supports adaptive thinking mode (
thinking.type: 'adaptive') and rejects the legacy budget-based thinking configuration (thinking.type: 'enabled'withbudgetTokens).Changes
Model Detection Logic
Added intelligent model detection to automatically select the appropriate thinking mode:
Provider Support
Extended thinking configuration to all Anthropic-compatible providers:
anthropic- Direct Anthropic APIgoogle-vertex-anthropic- Claude on Google Vertex AIamazon-bedrock- Claude on AWS Bedrock (automatically detects Anthropic models)New Environment Variable
Added
ANTHROPIC_EFFORTto control thinking depth for models using adaptive thinking:low- Minimal thinking, fastest responsemedium- Balanced thinkinghigh(default) - Deep thinkingmax- Maximum thinking capabilityThe existing
ANTHROPIC_THINKING_BUDGET_TOKENSis still used for older models that require budget-based thinking.Backwards Compatibility
This change is fully backwards compatible:
ANTHROPIC_THINKING_BUDGET_TOKENShigheffort) matches the previous intelligent behaviorTesting
Fixes #SOU-918
Linear Issue: SOU-918