Urgent.News

What's breaking now, across thousands of outlets.

AI

Structured outputs for Anthropic Claude models on Amazon Bedrock

Amazon Bedrock now supports structured outputs for all Anthropic Claude models on both the bedrock-runtime and bedrock-mantle endpoints. Receive schema-compliant JSON that conforms to a defined structure, without custom parsing, retry logic, or post-processing, using JSON Schema output format and strict tool use.

Amazon Bedrock now offers structured outputs for Anthropic Claude models across both bedrock-runtime and bedrock-mantle endpoints. By enabling this feature, you can receive schema-compliant JSON responses directly from the model without the need for custom parsing, additional error handling, or post-processing. This functionality streamlines a wide range of practical use cases, such as extracting key data points from financial reports, converting clinical notes into Electronic Health Records, enriching product catalogs, analyzing contracts, and improving support ticket routing.

Structured outputs utilize constrained decoding to enforce your defined JSON schema during token generation, transforming output formatting from probabilistic to deterministic. Two complementary mechanisms are now available on both AWS endpoints, allowing you to control the response structure and ensure data extraction, API responses, and tool use meet your application's exact requirements.

With schema-compliant JSON outputs, your integration becomes more reliable, as responses inherently adhere to the specified schema, eliminating JSON.parse() errors and avoiding the need for schema validation retries. Additionally, by limiting responses to only the fields defined in your schema, you can reduce token usage and potentially lower inference costs for high-volume workloads.

Supported models and regions are now standardized, enabling seamless cross-Region inference and batch processing on the bedrock-runtime endpoint. Note that the initial request with a new schema may take slightly longer due to grammar compilation, but subsequent requests benefit from cached compiled grammars, which are refreshed every 24 hours.

When using the InvokeModel API with structured outputs, you specify the JSON schema under output_config.format as a JSON object rather than a string. The provided example demonstrates how to extract structured lead data from an email using boto3 and an Anthropic Claude model, resulting in a JSON response that adheres to the defined schema.

Written by urgent.news from AWS Machine Learning's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at aws.amazon.com →

More in AI

More from Monday 19 October →