fix(gemini): restore Gemma model discovery in model picker#42693
Open
BorisDay wants to merge 2 commits into
Open
fix(gemini): restore Gemma model discovery in model picker#42693BorisDay wants to merge 2 commits into
BorisDay wants to merge 2 commits into
Conversation
Three bugs conspired to hide Gemma models (gemma-4-31b-it, gemma-4-26b-a4b-it) from the /model picker despite the Google API listing them with thinking support: 1. fetch_models() used Bearer auth — Google requires ?key= query param (HTTP 401) 2. fetch_models() read m['id'] — Google returns 'name': 'models/gemma-4-...' 3. _PROVIDER_MODELS static fallback omitted Gemma models entirely Fixes: - GeminiProfile.fetch_models(): override with ?key= auth + name-field parser - _PROVIDER_MODELS['gemini']: add gemma-4-31b-it and gemma-4-26b-a4b-it - _build_gemini_thinking_config(): accept gemma-4 models (API lists thinking:true) Closes: NousResearch#17426 (related — thinking_config now safe for Gemma 4)
- Fix auth bypass when models_url is set: always append ?key= to URL - Move stdlib imports to module level (matching codebase style) - Sanitize debug log to avoid API key leakage in exception strings - Use URLError-specific catch with safe log message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three independent bugs that conspired to hide Gemma models from the Hermes
/modelpicker:fetch_models()sends Bearer token; Google requires?key=query paramfetch_models()readsm["id"]; Google returns"name": "models/gemma-4-31b-it"_PROVIDER_MODELS["gemini"]only had Gemini modelsChanges
1.
plugins/model-providers/gemini/__init__.py(+61 lines)Override
fetch_models()inGeminiProfileto:?key={api_key}query-param auth (matching Google API requirements)"name"field withmodels/prefix stripping2.
hermes_cli/models.py(+2 lines)Add
gemma-4-31b-itandgemma-4-26b-a4b-itto_PROVIDER_MODELS["gemini"]as static fallback when live fetch fails (belt and suspenders).3.
agent/transports/chat_completions.py(5 lines changed)Update
_build_gemini_thinking_config()to acceptgemma-4models. Google's API now lists both Gemma 4 models with"thinking": true, indicating they supportthinking_config. Limited togemma-4prefix to avoid regressions with older Gemma <=3 models (#17426).Verification
Live fetch from Google AI Studio now returns Gemma models:
Both models appear in
/modelpicker with selectable reasoning effort.Related