fix: disable toolStreaming for all @ai-sdk/anthropic-backed providers#23766
Closed
kevinxinzhao wants to merge 2 commits intoanomalyco:devfrom
Closed
fix: disable toolStreaming for all @ai-sdk/anthropic-backed providers#23766kevinxinzhao wants to merge 2 commits intoanomalyco:devfrom
kevinxinzhao wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Proxies and API gateways (e.g. AWS Bedrock, corporate gateways) that use @ai-sdk/anthropic perform strict JSON schema validation and reject the eager_input_streaming field injected by @ai-sdk/anthropic >=3.0.58 when the fine-grained-tool-streaming beta header is active. The previous fix (81b7b58) only covered the github-copilot provider. Move the toolStreaming: false guard ahead of the providerID check so it applies to every @ai-sdk/anthropic-backed provider.
cfa3407 to
6cc9df0
Compare
Collaborator
|
we dont want to disabel it across the board, also this isn't the correct location for it. |
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.
Issue for this PR
Closes #23767
Type of change
What does this PR do?
@ai-sdk/anthropic>=3.0.58 injectseager_input_streaming: trueinto every tool definition when thefine-grained-tool-streaming-2025-05-14beta header is active. Proxies and API gateways that validate request schemas strictly (e.g. AWS Bedrock proxies, corporate LLM gateways) reject this unknown field with a 400 error.Commit 81b7b58 already fixed this for the
github-copilotprovider by settingtoolStreaming: false, but the guard was inside theproviderID.includes("github-copilot")check, so custom providers configured with"npm": "@ai-sdk/anthropic"were not covered.This PR moves the
toolStreaming: falsecheck ahead of theproviderIDguard, so it applies to all@ai-sdk/anthropic-backed providers. The Copilot-specificmaxOutputTokenslogic remains gated as before.How did you verify your code works?
Tested with a custom
@ai-sdk/anthropicprovider pointing to an AWS Bedrock proxy — tool calls complete successfully without theeager_input_streamingerror.Screenshots / recordings
N/A — no UI changes.
Checklist