I want the model to respond to my query with an image response. I am setting the response_modalities within generation_config with IMAGE parameter. The request always fails. If I set it with only TEXT it succeeds. Is the IMAGE parameter supported?
Hi @arpitm, The image parameter is supported, Could you please let me know which model you are using to generate a image for the given query. Please try to use models/gemini-2.0-flash-exp which will work fine. Thank You.
Hi @arpitm
Welcome to the forum.
This depends on the model you chose.
Note: Make sure to include responseModalities
: [“Text”, “Image”] in your generation configuration for text and image output with gemini-2.0-flash-exp-image-generation
.
Source: https://ai.google.dev/gemini-api/docs/image-generation#gemini
That model has been added very recently only.
Additionally, the model gemini-2.0-flash-exp
also works to generate images.
Cheers