Repository navigation
fix(translator): move output_format to output_config.format for Bedrock and Vertex - #2985
Open
joaorufino wants to merge 2 commits into
Open
joaorufino wants to merge 2 commits into
joaorufino wants to merge 2 commits into
Conversation
…ck and Vertex
Claude on AWS Bedrock and GCP Vertex AI rejects the top-level
output_format field ("output_format: This field is deprecated. Use
'output_config.format' instead."), while Anthropic-native clients still
send it. The AWSAnthropic and GCPAnthropic messages and count_tokens
translators now move it to output_config.format, keeping other
output_config fields; an output_config.format already in the request
takes precedence.
Signed-off-by: João Rufino <j.rufino@swordhealth.com>
✅ Deploy Preview for theagentrouter canceled.
|
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.
Description
Claude on AWS Bedrock (InvokeModel) and GCP Vertex AI rejects the top-level
output_formatfield of the Messages API:Structured outputs are generally available as
output_config.format, but some Anthropic-native clients still send the beta field. For example, LiteLLM (1.105 through 1.108) setsoutput_formatfor a JSON-schemaresponse_formaton models it marks as supporting native structured outputs. The AWSAnthropic and GCPAnthropic translators forwardoutput_formatunchanged, so these requests fail on both clouds.This moves
output_formattooutput_config.formatin the AWSAnthropic and GCPAnthropic messages and count_tokens translators:output_configfields, such aseffort, are kept;output_config.formatalready in the request takes precedence;output_format: nullis dropped;output_config(not an object) is left for the backend to reject.The Anthropic passthrough translator is unchanged.
Each request shape, sent through the gateway (before this change) with
claude-sonnet-4-6:output_formatoutput_config.formatoutput_format+output_config.formatoutput_config.formatoutput_format: nulloutput_config.format(+effort)Related Issues/PRs (if applicable)
Related PR: #2040 (stripped structured outputs on GCP; this keeps them instead).
Special notes for reviewers (if applicable)
bedrock:CountTokens). Bedrock validates that body as an InvokeModel request, which rejectsoutput_format.