Skip to content

Gemma 4 models not supported in ADK model registry #5237

Closed as duplicate
Closed as duplicate

Description

@mikkokirvesoja

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

  1. Set gemma-4-31b-it as the model for an LlmAgent:
    agent = LlmAgent(model="gemma-4-31b-it", name="test")
  2. Run the agent
  3. 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:

return [
    r'gemma-3.*',
]

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.

Activity

  1. added
    models
    on Apr 10, 2026
  2. added theissue type on Apr 10, 2026
  3. llalitkumarrr commented on Apr 13, 2026

    @llalitkumarrr
    Collaborator

    Hello @mikkokirvesoja ,

    You can use Gemma with the ADK. We recommend reviewing this documentation page in ADK docs, which will guide you through implementation Gemma 4 models with Google ADK.

    Kindly let us know if this worked for you or not.

  4. mikkokirvesoja commented on Apr 13, 2026

    @mikkokirvesoja
    Author

    Got it working, thanks!

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

Metadata

Metadata

Assignees

Labels

models

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions