Skip to content

Backport: fix(amazon-bedrock): disable native structured output for claude-opus-4-7#15352

Merged
aayush-kapoor merged 2 commits into
release-v6.0from
backport-pr-15288-to-release-v6.0
May 15, 2026
Merged

Backport: fix(amazon-bedrock): disable native structured output for claude-opus-4-7#15352
aayush-kapoor merged 2 commits into
release-v6.0from
backport-pr-15288-to-release-v6.0

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

This is an automated backport of #15288 to the release-v6.0 branch. FYI @zxuhan

…-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>
@github-actions github-actions Bot enabled auto-merge (squash) May 15, 2026 21:48
auto-merge was automatically disabled May 15, 2026 21:51

Pull request was closed

Comment thread packages/amazon-bedrock/src/anthropic/bedrock-anthropic-provider.test.ts Outdated
@aayush-kapoor aayush-kapoor reopened this May 15, 2026
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
@aayush-kapoor aayush-kapoor enabled auto-merge (squash) May 15, 2026 22:10
@aayush-kapoor aayush-kapoor merged commit 980c2ae into release-v6.0 May 15, 2026
17 checks passed
@aayush-kapoor aayush-kapoor deleted the backport-pr-15288-to-release-v6.0 branch May 15, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant