-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add reasoning budget support to Bedrock models for extended thinking (#4201) #4481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
daniel-lxs
reviewed
Jun 9, 2025
…ponents - Introduced `supportsReasoningBudget` property in Bedrock models. - Enhanced `AwsBedrockHandler` to handle reasoning budget in payloads. - Updated `ThinkingBudget` component to dynamically set max tokens based on reasoning support. - Modified `ApiOptions` and `Bedrock` components to conditionally render `ThinkingBudget`. - Added tests for extended thinking functionality in `bedrock-reasoning.test.ts`.
- Simplify ThinkingBudget ternary logic since component only renders when reasoning budget supported - Break down complex thinking enabled condition with clear documentation - Replace 'as any' usage with proper TypeScript interfaces for AWS SDK events - Add comprehensive documentation for multiple stream structures explaining AWS SDK compatibility
Contributor
|
Generated with ❤️ by ellipsis.dev |
daniel-lxs
approved these changes
Jun 12, 2025
Member
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with emphasis on "looks" cause I don't have a way to test this.
Collaborator
Author
|
I tested it |
mrubens
approved these changes
Jun 12, 2025
mrubens
pushed a commit
that referenced
this pull request
Jun 13, 2025
* Add reasoning budget support to Bedrock models and update related components - Introduced `supportsReasoningBudget` property in Bedrock models. - Enhanced `AwsBedrockHandler` to handle reasoning budget in payloads. - Updated `ThinkingBudget` component to dynamically set max tokens based on reasoning support. - Modified `ApiOptions` and `Bedrock` components to conditionally render `ThinkingBudget`. - Added tests for extended thinking functionality in `bedrock-reasoning.test.ts`. * Add BedrockThinkingConfig interface and update payload structure * fix: address PR review feedback (#4481) - Simplify ThinkingBudget ternary logic since component only renders when reasoning budget supported - Break down complex thinking enabled condition with clear documentation - Replace 'as any' usage with proper TypeScript interfaces for AWS SDK events - Add comprehensive documentation for multiple stream structures explaining AWS SDK compatibility * feat: show ThinkingBudget component unconditionally Remove selectedProviderModels.length check to display ThinkingBudget for all providers, not just those with available models --------- Co-authored-by: hannesrudolph <[email protected]>
cte
pushed a commit
that referenced
this pull request
Jun 24, 2025
…nking (#4201) (#4481) * Add reasoning budget support to Bedrock models and update related components - Introduced `supportsReasoningBudget` property in Bedrock models. - Enhanced `AwsBedrockHandler` to handle reasoning budget in payloads. - Updated `ThinkingBudget` component to dynamically set max tokens based on reasoning support. - Modified `ApiOptions` and `Bedrock` components to conditionally render `ThinkingBudget`. - Added tests for extended thinking functionality in `bedrock-reasoning.test.ts`. * Add BedrockThinkingConfig interface and update payload structure * fix: address PR review feedback (#4481) - Simplify ThinkingBudget ternary logic since component only renders when reasoning budget supported - Break down complex thinking enabled condition with clear documentation - Replace 'as any' usage with proper TypeScript interfaces for AWS SDK events - Add comprehensive documentation for multiple stream structures explaining AWS SDK compatibility
cte
pushed a commit
that referenced
this pull request
Jun 24, 2025
* Add reasoning budget support to Bedrock models and update related components - Introduced `supportsReasoningBudget` property in Bedrock models. - Enhanced `AwsBedrockHandler` to handle reasoning budget in payloads. - Updated `ThinkingBudget` component to dynamically set max tokens based on reasoning support. - Modified `ApiOptions` and `Bedrock` components to conditionally render `ThinkingBudget`. - Added tests for extended thinking functionality in `bedrock-reasoning.test.ts`. * Add BedrockThinkingConfig interface and update payload structure * fix: address PR review feedback (#4481) - Simplify ThinkingBudget ternary logic since component only renders when reasoning budget supported - Break down complex thinking enabled condition with clear documentation - Replace 'as any' usage with proper TypeScript interfaces for AWS SDK events - Add comprehensive documentation for multiple stream structures explaining AWS SDK compatibility * feat: show ThinkingBudget component unconditionally Remove selectedProviderModels.length check to display ThinkingBudget for all providers, not just those with available models --------- Co-authored-by: hannesrudolph <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
PR - Needs Review
size:XL
This PR changes 500-999 lines, ignoring generated files.
UI/UX
UI/UX related or focused
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.
Description
Fixes #4201
Adds comprehensive Extended Thinking (reasoning budget) support for AWS Bedrock Claude models (Sonnet 4, Opus 4, and 3.7 Sonnet). This implementation provides the equivalent functionality to the "Enable Reasoning Mode" available in the direct Anthropic provider, but integrated with AWS Bedrock's API structure.
Changes Made
🎯 Core Implementation
supportsReasoningBudget: trueto Claude models inpackages/types/src/providers/bedrock.tssrc/api/providers/bedrock.tswith:additionalModelRequestFields.thinkingparameter supportanthropic_versionheader handling🔄 Stream Processing Enhancements
reasoningContentblocksthinkingcontent types🧪 Comprehensive Testing
src/api/providers/__tests__/bedrock-reasoning.test.tswith 280 lines of tests covering:🎨 UI Improvements
webview-ui/src/components/settings/ThinkingBudget.tsxto:supportsReasoningBudgetis true🛠️ Error Handling
Technical Implementation Details
API Integration
The implementation follows AWS Bedrock's official extended thinking specification:
Stream Processing
Handles multiple AWS SDK event structures:
contentBlock.reasoningContent.text(official AWS docs structure)contentBlock.type === "thinking"(alternative structure)delta.reasoningContent.textanddelta.thinking(delta events)Model Support
Enabled for:
anthropic.claude-sonnet-4-20250514-v1:0anthropic.claude-opus-4-20250514-v1:0anthropic.claude-3-7-sonnet-20250219-v1:0Testing Performed
Verification of Acceptance Criteria
From issue #4201:
Checklist
Related Issues
Screenshots/Demo
Before: No reasoning budget controls visible for Bedrock models
After: ThinkingBudget component appears for supported Bedrock models, matching Anthropic provider functionality
Users can now:
Important
Adds reasoning budget support to AWS Bedrock models, enabling extended thinking capabilities with updated configurations, stream processing, UI, and error handling.
supportsReasoningBudget: trueto Claude models inbedrock.ts.bedrock.tswithadditionalModelRequestFields.thinkingand dynamic budget token configuration.topPparameter when thinking is enabled.bedrock.tsto processreasoningContentandthinkingcontent types.bedrock-reasoning.test.tsfor reasoning parameter inclusion, stream processing, and error handling.ThinkingBudget.tsxto calculate max token limits and show reasoning budget controls.ApiOptions.tsxto conditionally renderThinkingBudget.VALIDATION_ERRORhandling for parameter validation issues inbedrock.ts.This description was created by
for dafa25b. You can customize this summary. It will automatically update as commits are pushed.