Repository navigation
feat: add Google AI Studio Gemini image generation plugin - #1
Conversation
Add the native Google AI Studio Gemini (Nano Banana 2, Nano Banana 2 Lite, and Nano Banana Pro) image generation and editing backend plugin for Hermes Agent, along with unit tests and Apache 2.0 licensing.
There was a problem hiding this comment.
Code Review
This pull request introduces a new Google AI Studio Gemini image generation plugin, including its implementation, configuration, and a comprehensive test suite, while removing the legacy NOTICE file and updating the README. The review feedback highlights three important areas for improvement: addressing a potential Denial of Service (DoS) vulnerability when reading non-regular local files, relaxing base64 decoding validation to gracefully handle whitespaces or line wraps in data URIs, and correcting the upscaling logic to prioritize 4K resolution over 2K when both are supported.
1. upscale request - prioritise 4K if available, then 2K resolution 2. raw = base64.b64decode(b64) remove Validate=True to gracefully ignore whitespace & newlines. `_sniff_mime` on line 295 still guarantees the decoded bytes start with valid PNG, JPEG, WebP, or GIF magic headers. 3. Add "path is a regular file" verification before reading image Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
philschmid
left a comment
There was a problem hiding this comment.
Can you check against the internal docs we have it seems that we are missing some pieces as the Notice in the README that this is not an official google product etc.
Replaces the short SPDX snippet headers with the full 13-line Apache 2.0 header, restores the unmodified Apache 2.0 LICENSE appendix, updates the repository name in CODEOWNERS, and adds the Gemini API Terms of Service link to the README disclaimer. Also strips ASCII whitespace from RFC 2397 data URI payloads before strict base64 validation and adds a corresponding unit test.
|
Updated:
|
Adds Gemini Nano Banana 2.1 (gemini-nano-banana-2.1) as the default image generation model with 14 aspect ratios, 1K/2K/4K output resolutions, and Google Web and Image Search grounding, while keeping Nano Banana 2 (gemini-3.1-flash-image), Nano Banana 2 Lite (gemini-3.1-flash-lite-image), and Nano Banana Pro (gemini-3-pro-image) in the model catalog. Updates the README supported models table and unit tests to cover all four catalog entries and per-model resolution gating.
markmcd
left a comment
There was a problem hiding this comment.
Just a couple of small nits - otherwise looks pretty comprehensive. LGTM!
Asserts provider.default_model() against gemini_plugin.DEFAULT_MODEL, uses subset comparison (>=) for catalog model IDs so future model additions do not break the picker test, and switches fake test API keys from AIza- to AQ. prefixes to avoid secret-scanner false positives.
Summary
Adds the native Google AI Studio Gemini (Nano Banana) image generation and editing backend plugin (
gemini-image) for Hermes Agent, usingGEMINI_API_KEYagainstPOST /v1beta/models/{model}:generateContent.Key Features
gemini-3.1-flash-image(Nano Banana 2, default),gemini-3.1-flash-lite-image(Nano Banana 2 Lite), andgemini-3-pro-image(Nano Banana Pro).data:URIs, or local paths), model-gated aspect ratios (up to 14 ratios on 3.1 Flash), output resolutions (512,1K,2K,4K), and optional Google Search grounding viaconfig.yaml(image_gen.gemini.*).tests/test_gemini_provider.py) covering setup schema readiness, model resolution, reference image validation, and wire payload formatting.Future Work
google-gemini/hermes-gemini-api-plugin(this initial PR focuses on shipping thegemini-imageplugin first).Previous Work: