Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add Gemini 2.0 Flash Native Image Generation Support #6365

Open
lim-kim930 opened this issue Mar 13, 2025 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@lim-kim930
Copy link

🥰 Feature Description

The Gemini 2.0 Flash API now supports native image generation:
Experiment with Gemini 2.0 Flash native image generation

response_modalities: ['Text', 'Image'] is required in the API request:

config=types.GenerateContentConfig(
    response_modalities=["Text", "Image"]
),

Now NextChat lacks a setting to enable this,it would be great to add this feature.

🧐 Proposed Solution

Add a setting in model configuration for Gemini models to enable/disable native image generation, like Output Format.

📝 Additional Information

No response

@lim-kim930 lim-kim930 added the enhancement New feature or request label Mar 13, 2025
@lim-kim930
Copy link
Author

lim-kim930 commented Mar 13, 2025

I've tested the payload below locally and can confirm that I'm successfully receiving image responses (base64):

// app/client/platforms/google.ts

const requestPayload = {
    contents: messages,
    generationConfig: {
        responseModalities: ['Text', 'Image'], // added a property here
        temperature: modelConfig.temperature,
        // ........
    },
    // ......
};
{
    "candidates": [
        {
            "content": {
                "parts": [
                    {
                        "inlineData": {
                            "mimeType": "image/png",
                            "data": "iVBORw0KGgoAAAANSUhEUgAABAAAAAKkCAIAAAARItoWAAAgAElEQVR4...."
                        }
                    }
                ],
                "role": "model"
            },
            "index": 0
        }
    ],
    "usageMetadata": {
        "promptTokenCount": 8,
        "totalTokenCount": 8,
        "promptTokensDetails": [
            {
                "modality": "TEXT",
                "tokenCount": 8
            }
        ]
    },
    "modelVersion": "gemini-2.0-flash-exp"
}

However, it seems that NextChat currently doesn't support displaying these images.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant