feat(amazon-bedrock): add guardrail content support for text and image parts#14302
Open
raphaeleidus wants to merge 1 commit intovercel:mainfrom
Open
feat(amazon-bedrock): add guardrail content support for text and image parts#14302raphaeleidus wants to merge 1 commit intovercel:mainfrom
raphaeleidus wants to merge 1 commit intovercel:mainfrom
Conversation
7637150 to
eb20aaf
Compare
Author
|
@aayush-kapoor could I trouble you to look this over? |
Collaborator
aayush-kapoor
left a comment
There was a problem hiding this comment.
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.
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.
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 existingBedrockGuardrailConverseContentBlocktype was untyped (guardContent: unknown) and there was no way to opt into this behavior from the AI SDK.Documentation on the Bedrock Feature
Summary
BedrockGuardrailTextBlocktype extendingBedrockTextBlockwith optionalqualifiersarray.BedrockGuardrailConverseContentBlock.guardContentas a union of text and image variants instead ofunknown.bedrockTextPartProviderOptions,bedrockImagePartProviderOptions) for validating provider options, used viaparseProviderOptionsconsistent with existing patterns.providerOptions.bedrock.guardContent: trueon text and image parts to wrap them asguardContentblocks, with optionalguardContentQualifiersfor text parts.Checklist
pnpm changesetin the project root)