-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Add AWS Bedrock Extended Thinking support for Claude models (#4343, #4201) #4447
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
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.
I can't actually test if this actually works but, I left some suggestions based on how the Anthropic provider works.
- Refactor Bedrock provider for clarity and type safety. - Extract constants and helper methods. - Update documentation. - Rename and update reasoning tests to Vitest. - Ensure all tests pass.
Review Issues Addressed ✅Fixed the remaining type safety issue:
All other review feedback was already implemented. Tests pass, no lint errors. |
- Add StreamChunk interface with proper type definitions - Update all generator methods to use Generator<StreamChunk, void, unknown> - Addresses review feedback for better type safety
- Replace custom StreamChunk interface with ApiStreamChunk import - Update all generator method signatures to use ApiStreamChunk - Fixes type compatibility issues with yield* delegation - Resolves CI test failures related to type mismatches
Type Safety Fix Applied ✅Fixed the CI test failures by resolving type compatibility issues:
All local tests pass and TypeScript compilation is clean. The CI failures should now be resolved. |
…bility - Replace multiple handler methods with unified processStreamEvent() - Simplify main stream processing loop from ~30 lines to 1 line - Maintain all existing functionality and test coverage - Address PR reviewer feedback for improved code organization Addresses: Stream processing consolidation suggestion from PR review
|
this implementation is no good. |
- Refactor Bedrock provider for clarity and type safety. - Extract constants and helper methods. - Update documentation. - Rename and update reasoning tests to Vitest. - Ensure all tests pass.
Description
Fixes #4343
Fixes #4201
This PR adds support for AWS Bedrock Extended Thinking (reasoning mode) for Claude 3.7/4 models, with improved error handling and retry logic.
Changes Made
1. Added Extended Thinking Support
supportsReasoningBudget: truefor:anthropic.claude-3-7-sonnet-20250219-v1:0)anthropic.claude-sonnet-4-20250514-v1:0)anthropic.claude-opus-4-20250514-v1:0)2. Implemented Reasoning Configuration
enableReasoningEffort: trueadditionalModelRequestFieldswith thinking configuration when enabledanthropic_version: "bedrock-20250514"3. Enhanced Stream Processing
thinkingcontent blocksthinking_deltaeventssignature_deltaeventstype: "reasoning"4. Improved Error Handling
5. Updated UI
Testing
Verification of Acceptance Criteria
Checklist
Additional Context
This implementation follows the technical requirements where extended thinking/reasoning is disabled by default and only enabled when explicitly requested by the user. This maintains backward compatibility while adding the new functionality requested in the issues.
Important
Adds AWS Bedrock Extended Thinking support for Claude models with new configurations, error handling, and tests.
bedrock.ts.enableReasoningEffort: true.thinking,thinking_delta,signature_deltainbedrock.ts.type: "reasoning".createMessage()inbedrock.ts.bedrock-reasoning.spec.tsfor testing reasoning functionality.This description was created by
for 13e272c. You can customize this summary. It will automatically update as commits are pushed.