Skip to content

Feat/gemma 4 models#1507

Open
3kin0x wants to merge 4 commits into
Gitlawb:mainfrom
3kin0x:feat/gemma-4-models
Open

Feat/gemma 4 models#1507
3kin0x wants to merge 4 commits into
Gitlawb:mainfrom
3kin0x:feat/gemma-4-models

Conversation

@3kin0x
Copy link
Copy Markdown
Contributor

@3kin0x 3kin0x commented Jun 3, 2026

Summary

  • what changed: Added support for the newly released Google DeepMind Gemma 4 hosted models (gemma-4-26b-a4b-it and gemma-4-31b-it) under the Gemini provider.
  • why it changed: To allow users to select, configure, and use the new state-of-the-art open-weights Gemma 4 models natively through the OpenClaude UI when setting up the Gemini integration.
    Impact
  • user-facing impact: Users will now see the supported Gemma 4 models populated in the default catalog list when selecting or adding a Gemini provider in the CLI. Context windows and reasoning capabilities are properly configured.
  • developer/maintainer impact: Minimal. We introduced a gemmaModel helper in gemini.ts to manage the large 256K context windows specific to the Gemma 4 architecture while inheriting standard Gemini API capabilities.

Testing

  • bun run build
  • bun run smoke
  • bun run check
  • focused tests: Verified typechecks pass and that the catalog arrays correctly map the new model IDs.

Notes

  • provider/model path tested: gemini provider -> gemma-4-* models
  • screenshots attached (if UI changed): N/A
  • follow-up work or known limitations: N/A

Summary by CodeRabbit

  • New Features
    • Added support for two new Gemini Gemma 4 models: Gemma 4-26B and Gemma 4-31B, now available for use in the model catalog.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 89965c72-e355-4be7-bfb5-1804e8409670

📥 Commits

Reviewing files that changed from the base of the PR and between 3659eaa and c6800d4.

📒 Files selected for processing (3)
  • src/integrations/brands/gemini.ts
  • src/integrations/models/gemini.ts
  • src/integrations/vendors/gemini.ts

📝 Walkthrough

Walkthrough

Adds a gemmaModel factory and two Gemma-4 model entries (gemma-4-26b-a4b-it, gemma-4-31b-it), registering them in the module exports, the Gemini brand modelIds, and the Gemini vendor catalog.models.

Changes

Gemma-4 Model Integration

Layer / File(s) Summary
Gemma model factory definition
src/integrations/models/gemini.ts
New gemmaModel factory builds gemini-branded model definitions, accepts contextWindow, forwards maxOutputTokens, and sets classifications including vision.
Gemma model catalog and system registration
src/integrations/models/gemini.ts, src/integrations/brands/gemini.ts, src/integrations/vendors/gemini.ts
Two Gemma-4 models (gemma-4-26b-a4b-it, gemma-4-31b-it) are created via the factory, added to the exported model array, appended to the Gemini brand modelIds, and added to the Gemini vendor catalog.models.

🎯 3 (Moderate) | ⏱️ ~20 minutes

"A rabbit stitched two Gemma seeds in the night,
sprouted factory code under soft moonlight,
models filed their names in brand and cart,
vendor shelves stocked them, ready to start,
hop—deployment hums, tiny feet take flight."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding support for Gemma 4 models to the Gemini integration.
Description check ✅ Passed The description follows the template structure with all required sections completed: Summary, Impact, Testing, and Notes with specific details about changes and testing performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/models/gemini.ts`:
- Around line 26-38: The gemmaModel function currently sets classification
without 'vision' while it uses geminiCapabilities that indicate supportsVision:
true; update gemmaModel (the function named gemmaModel) so its classification
array includes 'vision' (e.g., ['chat','reasoning','coding','vision']) or
otherwise split/adjust the capability object (geminiCapabilities) if you intend
to disable vision for certain gemma-4-* models; ensure the change is made where
defineModel is invoked so model metadata and geminiCapabilities remain
consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c8f65351-2087-4c9a-9048-17c44713757f

📥 Commits

Reviewing files that changed from the base of the PR and between 3659eaa and 456a838.

📒 Files selected for processing (3)
  • src/integrations/brands/gemini.ts
  • src/integrations/models/gemini.ts
  • src/integrations/vendors/gemini.ts

Comment thread src/integrations/models/gemini.ts
Comment thread src/integrations/models/gemini.ts Outdated
Copy link
Copy Markdown
Collaborator

@jatmn jatmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found issues that need to be addressed before this is ready.

Findings

  • [P1] Use the documented Gemma API model IDs in the Gemini catalog
    src/integrations/vendors/gemini.ts:39
    The catalog now exposes gemma-4-e2b, gemma-4-e4b, gemma-4-12b, gemma-4-26b-a4b, and gemma-4-31b as Gemini apiNames, but the Gemini API docs show hosted Gemma calls using instruction-tuned IDs such as gemma-4-26b-a4b-it, and Google's launch material only points Gemini API / AI Studio access at the hosted 26B MoE and 31B models. Since this route sends the catalog apiName as the model name, selecting these new rows would call non-documented model IDs like gemma-4-31b and also advertise variants that are not shown as hosted Gemini API choices. Please update the catalog/model/brand IDs to the actual Gemini API model names and only expose variants that this route can call successfully.

  • [P2] Complete CodeRabbit's request to keep Gemma vision metadata consistent
    src/integrations/models/gemini.ts:32
    CodeRabbit's inline review request is still valid: gemmaModel omits vision from classification while reusing geminiCapabilities, which sets supportsVision: true. Google's Gemma 4 model card lists image input/image understanding for the family, so the model metadata currently disagrees with both the capability flags and the documented model behavior. Please complete that review request by adding the vision classification for supported Gemma entries, or split the capabilities if any entry should truly be text-only.

@3kin0x
Copy link
Copy Markdown
Contributor Author

3kin0x commented Jun 3, 2026

@jatmn Thanks for the feedback!

Both issues have been addressed:

[P1]: I updated the catalog, brand, and model definitions to only include the hosted models and appended the correct -it suffix (gemma-4-26b-a4b-it and gemma-4-31b-it). The smaller edge variants (E2B, E4B, 12B) have been removed since they aren't accessible via this route.
[P2]: I added 'vision' to the classification array in the gemmaModel helper to correctly reflect Gemma 4's multimodal capabilities and match the inherited supportsVision: true flag.
The updates have been pushed to the branch. Let me know if everything looks good now!

@3kin0x 3kin0x requested a review from jatmn June 3, 2026 20:53
Copy link
Copy Markdown
Contributor

@kevincodex1 kevincodex1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Collaborator

@jatmn jatmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. I rechecked the changed paths and found one small drift item that still needs to be addressed.

Findings

  • [P3] Update the PR description to match the hosted Gemma entries
    PR description
    The implementation now only exposes gemma-4-26b-a4b-it and gemma-4-31b-it, which addresses the earlier request to avoid advertising unsupported Gemma variants through the Gemini route. However, the PR description still says this adds gemma-4-e2b, gemma-4-e4b, gemma-4-12b, gemma-4-26b-a4b, and gemma-4-31b, mentions both 128K and 256K architectures, and lists E2B/E4B as possible follow-up tuning targets. Please update the PR body so the public summary and release-note context do not still advertise the removed, unsupported model variants.

@3kin0x
Copy link
Copy Markdown
Contributor Author

3kin0x commented Jun 4, 2026

@jatmn Good catch! I've updated the PR description to remove all references to the unsupported edge models and the 128K context window. It now accurately reflects that only the hosted gemma-4-26b-a4b-it and gemma-4-31b-it models (with 256K context) are included in this PR.

@3kin0x 3kin0x requested a review from jatmn June 4, 2026 05:35
@jatmn
Copy link
Copy Markdown
Collaborator

jatmn commented Jun 4, 2026

@coderabbitai please do full review and approve

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== src/integrations/brands/gemini.ts ==="
cat src/integrations/brands/gemini.ts

echo ""
echo "=== src/integrations/models/gemini.ts ==="
cat src/integrations/models/gemini.ts

echo ""
echo "=== src/integrations/vendors/gemini.ts ==="
cat src/integrations/vendors/gemini.ts

Length of output: 4214



@jatmn I've reviewed all three changed files. Here's a summary:

src/integrations/brands/gemini.ts

  • gemma-4-26b-a4b-it and gemma-4-31b-it correctly added to modelIds. No edge variants present.

src/integrations/models/gemini.ts

  • gemmaModel helper is well-structured, correctly sets brandId: 'gemini', vendorId: 'gemini', contextWindow: 262_144 (256K), and maxOutputTokens: 65_536 (64K).
  • Classification includes 'vision' ✓, matching the inherited supportsVision: true from geminiCapabilities.
  • Both model entries are consistent with the brand and vendor catalog.

src/integrations/vendors/gemini.ts

  • Catalog entries for both models have matching id, apiName, and label — no mismatches.

Minor cosmetic note (non-blocking): geminiModel uses classification order ['chat', 'reasoning', 'vision', 'coding'] while gemmaModel uses ['chat', 'reasoning', 'coding', 'vision']. This has no functional impact but could be aligned for consistency in a future cleanup.

Everything looks solid. Approving.

✅ Action performed

Full review finished.

Copy link
Copy Markdown
Collaborator

@jatmn jatmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I do not see any actionable issues from my review.

@kevincodex1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants