Question: responseMimeType is always sent in request when using google-gen-ai with GenerationConfig, causing INVALID_ARGUMENT #5135
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question:
responseMimeTypeis always serialized (empty) ingenerationConfigcausing INVALID_ARGUMENT error with Google Gemini APIDescription
SOS 👋,
I'm encountering an issue when using
spring-ai-google-genaiwhile calling the Google Gemini API with agenerationConfig.Specifically, when a
generationConfigis present, the fieldresponseMimeTypeis always included in the serialized JSON request, even when it is explicitly cleared or set to an empty/optional value.Example Request Payload
However, in the Spring AI client:
Even if I call something like clearResponseMimeType()
Or set it to an empty / optional value
➡️ The field still appears in the final JSON request as responseMimeType: "" whenever generationConfig exists.
This makes it impossible to send a valid request when: generationConfig is required but responseMimeType should be omitted entirely/
Expected Behavior
If responseMimeType is: null, empty or explicitly cleared
➡️ It should NOT be serialized into the request JSON at all.
In other words, the generated JSON should look like:
Beta Was this translation helpful? Give feedback.
All reactions