Skip to content

fix: remove unsupported outputMimeType and add response_modalities fo…#517

Merged
mikehostetler merged 2 commits intoagentjido:mainfrom
mrdotb:fix/google-image-generation
Mar 22, 2026
Merged

fix: remove unsupported outputMimeType and add response_modalities fo…#517
mikehostetler merged 2 commits intoagentjido:mainfrom
mrdotb:fix/google-image-generation

Conversation

@mrdotb
Copy link
Copy Markdown
Contributor

@mrdotb mrdotb commented Mar 17, 2026

Description

The image generation with gemini is failing. Gemini does not support output format. Ref
I removed the code and implemented the response_modalities
I am not sure if it was ever supported by gemini or if it's something adapted from open ai.

ReqLLM.generate_image(
          "google:gemini-2.5-flash-image",
          "A futuristic cityscape with flying cars and neon lights",
          aspect_ratio: "3:4")
** (MatchError) no match of right hand side value:

    {:error,
     %ReqLLM.Error.API.Request{
       reason: "Provider response error (400): Google API error: Invalid JSON payload received. Unknown name \"outputMimeType\" at 'generation_config.image_config': Cannot find field.",
       status: 400,
       response_body: %{
         "error" => %{
           "code" => 400,
           "details" => [
             %{
               "@type" => "type.googleapis.com/google.rpc.BadRequest",
               "fieldViolations" => [
                 %{
                   "description" => "Invalid JSON payload received. Unknown name \"outputMimeType\" at 'generation_config.image_config': Cannot find field.",
                   "field" => "generation_config.image_config"
                 }
               ]
             }
           ],
           "message" => "Invalid JSON payload received. Unknown name \"outputMimeType\" at 'generation_config.image_config': Cannot find field.",
           "status" => "INVALID_ARGUMENT"
         }
       }

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • [] Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Testing

  • Tests pass (mix test)
  • Quality checks pass (mix quality)

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation accordingly
  • My commits follow conventional commit format
  • I have NOT edited CHANGELOG.md (it is auto-generated by git_ops)

…r Google images

* The outputMimeType field is not supported by production Gemini image models.
* Added response_modalities option to control whether responses include text, images, or both.
@mikehostetler mikehostetler merged commit 53ff882 into agentjido:main Mar 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants