Skip to content

feat(amazon-bedrock): add guardrail content support for text and image parts#14302

Open
raphaeleidus wants to merge 1 commit intovercel:mainfrom
raphaeleidus:bedrock-converse-guard-content
Open

feat(amazon-bedrock): add guardrail content support for text and image parts#14302
raphaeleidus wants to merge 1 commit intovercel:mainfrom
raphaeleidus:bedrock-converse-guard-content

Conversation

@raphaeleidus
Copy link
Copy Markdown

@raphaeleidus raphaeleidus commented Apr 9, 2026

Background

The Amazon Bedrock Converse API supports guardrail content blocks that allow marking text and image parts for guardrail evaluation with optional qualifiers (grounding_source, query, guard_content). The existing BedrockGuardrailConverseContentBlock type was untyped (guardContent: unknown) and there was no way to opt into this behavior from the AI SDK.

Documentation on the Bedrock Feature

Summary

  • Added BedrockGuardrailTextBlock type extending BedrockTextBlock with optional qualifiers array.
  • Typed BedrockGuardrailConverseContentBlock.guardContent as a union of text and image variants instead of unknown.
  • Added Zod schemas (bedrockTextPartProviderOptions, bedrockImagePartProviderOptions) for validating provider options, used via parseProviderOptions consistent with existing patterns.
  • Users can now set providerOptions.bedrock.guardContent: true on text and image parts to wrap them as guardContent blocks, with optional guardContentQualifiers for text parts.
  • Added 8 tests covering text guard content (with/without qualifiers, false, no options) and image guard content (true, false, no options).

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

@tigent tigent bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider labels Apr 9, 2026
@raphaeleidus raphaeleidus force-pushed the bedrock-converse-guard-content branch from 7637150 to eb20aaf Compare April 9, 2026 22:46
@raphaeleidus
Copy link
Copy Markdown
Author

@aayush-kapoor could I trouble you to look this over?
Is there any additional context you might need here?

Copy link
Copy Markdown
Collaborator

@aayush-kapoor aayush-kapoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not context but this implementation will need some actual examples + a UI example that will test for multiturn conversations + tests and fixtures possibly returned by bedrock to see what it responds with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label feature New feature or request provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants