Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Vertext AI response_schema suddenly causing google.api_core.exceptions.InvalidArgument: 400 Request

I'm using a response_schema:

response = model.generate_content(
prompt,
generation_config=GenerationConfig(
response_mime_type="application/json",
response_schema=response_schema
),
)

My codebase had been working seamlessly up until today. Now I am getting google.api_core.exceptions.InvalidArgument: 400 Request  errors.

If I comment out response_schema=response_schema, the code executes, but the entire point is to use the response_schema property.

I am using google-cloud-aiplatform Version: 1.75.0 Summary: Vertex AI API client library

Even the example in Google's own documentation is causing the same error:

https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output

If I comment out response_schema=response_schema, the example works.

v 1.75.0 was released 18Dec24 - three days ago. Has the documentation not caught up?

This is meant to go in my production codebase.

Any help greatly appreciated.



0 2 655
2 REPLIES 2

happening for me also with `gemini-1.5-flash-002`

I am experiencing the same issue with `gemini-1.5-flash-002`