Backport: fix(amazon-bedrock): disable native structured output for claude-opus-4-7#15352
Merged
Merged
Conversation
…-4-7 (#15288) ## Summary Fixes #14773. Bedrock rejects `output_config.format` for `claude-opus-4-7` (including the `us.`/`eu.` cross-region inference profiles) with: ``` output_config.format: Extra inputs are not permitted ``` `packages/amazon-bedrock/src/anthropic/amazon-bedrock-anthropic-provider.ts` previously hardcoded `supportsNativeStructuredOutput: true` for every Bedrock-Anthropic model. The Anthropic capability table already lists opus-4-7 as supporting structured output, so the SDK took the native path that Bedrock then refused, and any `output` / `Output.object(...)` call against opus-4-7 (including reasoning runs) failed before the model ran. This changes the flag to `!modelId.includes('claude-opus-4-7')`. Other Bedrock-Anthropic models stay on the native path; opus-4-7 falls back to the `jsonResponseTool` path, which Bedrock accepts. Using `includes()` covers the direct `anthropic.claude-opus-4-7` id and both cross-region inference profiles (`us.anthropic.claude-opus-4-7`, `eu.anthropic.claude-opus-4-7`). ## Test plan - [x] Added a parameterized test for the direct id and both cross-region prefixes. The existing default-model assertion still requires `supportsNativeStructuredOutput: true` for non-opus-4-7 models. - [x] `pnpm --filter @ai-sdk/amazon-bedrock test`: 369/369 pass (node + edge) - [x] `pnpm check`: lint and format clean - [x] `pnpm --filter @ai-sdk/amazon-bedrock type-check` --------- Co-authored-by: Aayush Kapoor <aayushkapoor34@gmail.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
aayush-kapoor
approved these changes
May 15, 2026
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.
This is an automated backport of #15288 to the release-v6.0 branch. FYI @zxuhan