fix(vertex): raise clear error when using structured outputs on Vertex AI#1199
Open
bledden wants to merge 1 commit intoanthropics:mainfrom
Open
fix(vertex): raise clear error when using structured outputs on Vertex AI#1199bledden wants to merge 1 commit intoanthropics:mainfrom
bledden wants to merge 1 commit intoanthropics:mainfrom
Conversation
…x AI Vertex AI's Claude proxy does not support the output_config parameter, so calling messages.parse() with an AnthropicVertex client results in a confusing 400 error from Google: "output_config.format: Extra inputs are not permitted". This adds a check in _prepare_options to detect output_config and raise an AnthropicError with a clear message before the request is sent. Follows the same pattern as the existing batch API check. Fixes anthropics#1188
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.
Summary
Calling
messages.parse()with anAnthropicVertexclient sendsoutput_configin the request body, but Vertex AI's Claude proxy doesn't support this parameter. The result is a confusing 400 error from Google:This adds a check in the Vertex client's
_prepare_optionsto detectoutput_configand raise anAnthropicErrorwith a clear message before the request goes out. Follows the same pattern as the existing batch API check on line 410 of the same file.The error message suggests using the standard Anthropic client or manually parsing JSON responses as a workaround until Google adds
output_configsupport to their proxy.Added a test that verifies
parse()raisesAnthropicErroron the Vertex client. All 19 vertex tests pass.Fixes #1188