Description
Gemma 4 models (e.g. gemma-4-31b-it) are available via the Gemini API but cannot be used through ADK because the model registry does not match them.
The Gemma class in google/adk/models/gemma_llm.py registers only r'gemma-3.*' as its supported model pattern. This means any Gemma 4 model name fails with:
ValueError: Model gemma-4-31b-it not found.
Similarly, the Gemma3Ollama subclass only registers r'ollama/gemma3.*'.
Steps to reproduce
- Set
gemma-4-31b-it as the model for an LlmAgent:
agent = LlmAgent(model="gemma-4-31b-it", name="test")
- Run the agent
- ADK raises
ValueError: Model gemma-4-31b-it not found. from registry.py:124
Expected behavior
Gemma 4 models should be resolved by the registry and handled by Gemma, just like Gemma 3 models are.
Environment
google-adk 1.29.0 (also tested with 1.28.0)
- Python 3.14
- The model works fine when called directly via the REST API:
curl "https://generativelanguage.googleapis.com/v1beta/models/gemma-4-31b-it:generateContent?key=$API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{"contents": [{"parts":[{"text": "Hello"}]}]}'
Root cause
In gemma_llm.py, Gemma.supported_models() returns:
And Gemma3Ollama.supported_models() returns:
return [
r'ollama/gemma3.*',
]
Neither pattern matches gemma-4-*.
Suggested fix
Broaden the regex to cover current and future Gemma versions:
# Gemma.supported_models()
return [
r'gemma-\d+.*',
]
# Gemma3Ollama.supported_models() (consider renaming class to GemmaOllama)
return [
r'ollama/gemma\d+.*',
]
Or, if Gemma 4 needs its own class, add a Gemma4 class with r'gemma-4.*' and register it alongside the existing Gemma class.
It would be nice to have Gemma 4 models supported soon in ADK.
Description
Gemma 4 models (e.g.
gemma-4-31b-it) are available via the Gemini API but cannot be used through ADK because the model registry does not match them.The
Gemmaclass ingoogle/adk/models/gemma_llm.pyregisters onlyr'gemma-3.*'as its supported model pattern. This means any Gemma 4 model name fails with:Similarly, the
Gemma3Ollamasubclass only registersr'ollama/gemma3.*'.Steps to reproduce
gemma-4-31b-itas the model for anLlmAgent:ValueError: Model gemma-4-31b-it not found.fromregistry.py:124Expected behavior
Gemma 4 models should be resolved by the registry and handled by
Gemma, just like Gemma 3 models are.Environment
google-adk1.29.0 (also tested with 1.28.0)Root cause
In
gemma_llm.py,Gemma.supported_models()returns:And
Gemma3Ollama.supported_models()returns:Neither pattern matches
gemma-4-*.Suggested fix
Broaden the regex to cover current and future Gemma versions:
Or, if Gemma 4 needs its own class, add a
Gemma4class withr'gemma-4.*'and register it alongside the existingGemmaclass.It would be nice to have Gemma 4 models supported soon in ADK.