Feature/bedrock structured outputs#2081
Closed
deepakdalakoti wants to merge 2 commits intoconfident-ai:mainfrom
Closed
Feature/bedrock structured outputs#2081deepakdalakoti wants to merge 2 commits intoconfident-ai:mainfrom
deepakdalakoti wants to merge 2 commits intoconfident-ai:mainfrom
Conversation
|
Someone is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Thanks a lot for this contribution, @deepakdalakoti! Structured outputs for Bedrock is definitely something we want to support, and your PR highlights both the approach and some important cleanup (like removing hardcoded generation params). We’re currently working on a broader refactor to make structured outputs opt-in across all models and metrics, and Bedrock will be included in that effort. Closing this for now so the changes can be integrated as part of that work, but I really appreciate you surfacing this and giving us a solid starting point. |
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 PR adds support for structured outputs in
AmazonBedrockModel. Main changes are described below:AmazonBedrockModelfor structured output. When set as true, uses tool calling to enforce structured outputs. Added functionality to convert a pydantic output schema (in a newamazon_bedrock_utils.pyfile) to a Bedrock Converse API compatible tool specificationmax_tokensandtop_pfromgeneration_kwargsfor bedrock models. These default values can cause tests to artifically fail. For example, when the test output exceedsmax_tokens, the generation is stopped which causes the schema parsing to fail and thus the test fails. Setting these values should be upto the user. If no values are provided, bedrock uses the default values for the model and max_tokens are set to maximum tokens allowed for a particular model