fix: skip fine-grained-tool-streaming beta for older Claude 3 models on Bedrock#11720
Draft
roomote[bot] wants to merge 1 commit intomainfrom
Draft
fix: skip fine-grained-tool-streaming beta for older Claude 3 models on Bedrock#11720roomote[bot] wants to merge 1 commit intomainfrom
roomote[bot] wants to merge 1 commit intomainfrom
Conversation
…on Bedrock Older Claude 3 models (Haiku, Opus, Sonnet, and the original 3.5 Sonnet 20240620) do not support the fine-grained-tool-streaming beta flag on AWS Bedrock. Sending this beta causes Bedrock to reject the request with "invalid beta flag". This change adds an exclusion list for these older models and only sends the beta header to Claude models that support it. Closes #11715
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.
Related GitHub Issue
Closes: #11715
Description
This PR attempts to address Issue #11715. Feedback and guidance are welcome.
Problem: When using older Claude 3 models (Haiku, Opus, Sonnet, and the original 3.5 Sonnet 20240620) on AWS Bedrock, the
fine-grained-tool-streaming-2025-05-14beta flag is sent to all Claude models indiscriminately. These older models do not support this beta flag, causing Bedrock to reject the request with "invalid beta flag".Fix: Added a
BEDROCK_FINE_GRAINED_STREAMING_UNSUPPORTED_IDSconstant listing the older Claude 3 model IDs that do not support the beta. The condition inbedrock.tsnow checks that a Claude model is NOT in this exclusion list before adding the beta header.Files changed:
packages/types/src/providers/bedrock.ts- AddedBEDROCK_FINE_GRAINED_STREAMING_UNSUPPORTED_IDSconstantsrc/api/providers/bedrock.ts- Updated the condition to exclude older models from receiving the betasrc/api/providers/__tests__/bedrock.spec.ts- Added tests verifying the beta is NOT sent for older models and IS still sent for newer modelsTest Procedure
bedrock.spec.ts:fine-grained-tool-streamingbetabedrock.spec.tspassbedrock-native-tools.spec.tspassbedrock-reasoning.spec.tspassPre-Submission Checklist
Documentation Updates
Additional Notes
The excluded models are:
anthropic.claude-3-haiku-20240307-v1:0anthropic.claude-3-opus-20240229-v1:0anthropic.claude-3-sonnet-20240229-v1:0anthropic.claude-3-5-sonnet-20240620-v1:0Interactively review PR in Roo Code Cloud