Skip to content

feat(gemma4): support Gemma4 in Gemini - #5117

Closed
douglas-reid wants to merge 3 commits into
google:mainfrom
douglas-reid:gemma4-docs-clarity
Closed

douglas-reid wants to merge 3 commits into
google:mainfrom
douglas-reid:gemma4-docs-clarity

Conversation

@douglas-reid

@douglas-reid douglas-reid commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor

The main intent of this PR is to clarify Gemma 3 classes and add Gemma 4 sample now that Gemma 4 is released. As part of that work, this PR adds gemma-4-* to the allowlist for Gemini models for use in ADK.

This PR:

  • Adds gemma-4-* to the allowlist for Gemini models
  • Updates docstrings for Gemma, Gemma3Ollama, and GemmaFunctionCallingMixin to clarify they are Gemma 3-only
  • Adds Gemma 4 usage guidance pointing to Gemini/LiteLlm classes
  • Adds hello_world_gemma4 sample using standard Gemini class
  • Adds header comments and READMEs to existing Gemma 3 samples
  • Adds registry non-collision test for Gemma 4 model strings
  • Updates registration comments in models/init.py

Testing Plan

Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes.

Unit Tests:

  • [ X ] I have added or updated unit tests for my change.
  • [ X ] All unit tests pass locally.

Please include a summary of passed pytest results.

❯ pytest tests/unittests/models/test_google_llm.py
...
tests/unittests/models/test_google_llm.py ...............................................                                                                                              [100%]
...
=============================================================================== 47 passed, 3 warnings in 4.40s ===============================================================================

❯ pytest tests/unittests/models/test_gemma_llm.py
....
tests/unittests/models/test_gemma_llm.py ......................                                                                                                                        [100%]

===================================================================================== 22 passed in 1.05s =====================================================================================

Manual End-to-End (E2E) Tests:

Ran adk run contributing/samples/hello_world_gemma4 with success

Checklist

  • [ X ] I have read the CONTRIBUTING.md document.
  • [ X ] I have performed a self-review of my own code.
  • [ X ] I have commented my code, particularly in hard-to-understand areas.
  • [ X ] I have added tests that prove my fix is effective or that my feature works.
  • [ X ] New and existing unit tests pass locally with my changes.
  • [ X ] I have manually tested my changes end-to-end.
  • [ X ] Any dependent changes have been merged and published in downstream modules.

Additional context

@adk-bot adk-bot added the models [Component] This issue is related to model support label Apr 2, 2026
@douglas-reid douglas-reid changed the title docs(models): clarify Gemma 3 classes, add Gemma 4 sample feat(gemma4): support Gemma4 in Gemini Apr 2, 2026
@rohityan rohityan self-assigned this Apr 2, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @douglas-reid , Thank you for your contribution through this pull request! This PR has merge conflicts that require changes from your end. Could you please rebase your branch with the latest main branch to address these? Once this is complete, please let us know so we can proceed with the review.

@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label Apr 13, 2026
@douglas-reid

Copy link
Copy Markdown
Contributor Author

Hi @douglas-reid , Thank you for your contribution through this pull request! This PR has merge conflicts that require changes from your end. Could you please rebase your branch with the latest main branch to address these? Once this is complete, please let us know so we can proceed with the review.

Should be done now. Please let me know if more is needed.

- Update docstrings for Gemma, Gemma3Ollama, and
  GemmaFunctionCallingMixin to clarify they are Gemma 3-only
- Add Gemma 4 usage guidance pointing to Gemini/LiteLlm classes
- Add hello_world_gemma4 sample using standard Gemini class
- Add header comments and READMEs to existing Gemma 3 samples
- Add registry non-collision test for Gemma 4 model strings
- Update registration comments in models/__init__.py
@douglas-reid

Copy link
Copy Markdown
Contributor Author

@rohityan what else can i do to move this forward?

@DeanChensj

Copy link
Copy Markdown
Collaborator

Hi @douglas-reid, thanks for the PR, we should have gemma support for ADK, but we should not have one sample for each model version, it's ok to have one sample for one model type, e.g gemma in general.

@DeanChensj DeanChensj assigned DeanChensj and unassigned rohityan Jun 15, 2026
copybara-service Bot pushed a commit that referenced this pull request Jun 16, 2026
Merge #5117

The main intent of this PR is to clarify Gemma 3 classes and add Gemma 4 sample now that Gemma 4 is released. As part of that work, this PR adds `gemma-4-*` to the allowlist for Gemini models for use in ADK.

This PR:
- Adds `gemma-4-*` to the allowlist for Gemini models
- Updates docstrings for Gemma, Gemma3Ollama, and GemmaFunctionCallingMixin to clarify they are Gemma 3-only
- Adds Gemma 4 usage guidance pointing to Gemini/LiteLlm classes
- Adds hello_world_gemma4 sample using standard Gemini class
- Adds header comments and READMEs to existing Gemma 3 samples
- Adds registry non-collision test for Gemma 4 model strings
- Updates registration comments in models/__init__.py

### Testing Plan

_Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes._

**Unit Tests:**

- [ X ] I have added or updated unit tests for my change.
- [ X ] All unit tests pass locally.

_Please include a summary of passed `pytest` results._

```
❯ pytest tests/unittests/models/test_google_llm.py
...
tests/unittests/models/test_google_llm.py ...............................................                                                                                              [100%]
...
=============================================================================== 47 passed, 3 warnings in 4.40s ===============================================================================

❯ pytest tests/unittests/models/test_gemma_llm.py
....
tests/unittests/models/test_gemma_llm.py ......................                                                                                                                        [100%]

===================================================================================== 22 passed in 1.05s =====================================================================================
```

**Manual End-to-End (E2E) Tests:**

Ran `adk run contributing/samples/hello_world_gemma4` with success

### Checklist

- [ X ] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document.
- [ X ] I have performed a self-review of my own code.
- [ X ] I have commented my code, particularly in hard-to-understand areas.
- [ X ] I have added tests that prove my fix is effective or that my feature works.
- [ X ] New and existing unit tests pass locally with my changes.
- [ X ] I have manually tested my changes end-to-end.
- [ X ] Any dependent changes have been merged and published in downstream modules.

### Additional context

Co-authored-by: George Weale <gweale@google.com>
COPYBARA_INTEGRATE_REVIEW=#5117 from douglas-reid:gemma4-docs-clarity 9c90961
PiperOrigin-RevId: 933295498
@adk-bot

adk-bot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Thank you @douglas-reid for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 573f043.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Jun 16, 2026
@adk-bot adk-bot closed this Jun 16, 2026
FrigaZzz pushed a commit to FrigaZzz/adk-python that referenced this pull request Aug 11, 2026
Merge google#5117

The main intent of this PR is to clarify Gemma 3 classes and add Gemma 4 sample now that Gemma 4 is released. As part of that work, this PR adds `gemma-4-*` to the allowlist for Gemini models for use in ADK.

This PR:
- Adds `gemma-4-*` to the allowlist for Gemini models
- Updates docstrings for Gemma, Gemma3Ollama, and GemmaFunctionCallingMixin to clarify they are Gemma 3-only
- Adds Gemma 4 usage guidance pointing to Gemini/LiteLlm classes
- Adds hello_world_gemma4 sample using standard Gemini class
- Adds header comments and READMEs to existing Gemma 3 samples
- Adds registry non-collision test for Gemma 4 model strings
- Updates registration comments in models/__init__.py

### Testing Plan

_Please describe the tests that you ran to verify your changes. This is required
for all PRs that are not small documentation or typo fixes._

**Unit Tests:**

- [ X ] I have added or updated unit tests for my change.
- [ X ] All unit tests pass locally.

_Please include a summary of passed `pytest` results._

```
❯ pytest tests/unittests/models/test_google_llm.py
...
tests/unittests/models/test_google_llm.py ...............................................                                                                                              [100%]
...
=============================================================================== 47 passed, 3 warnings in 4.40s ===============================================================================

❯ pytest tests/unittests/models/test_gemma_llm.py
....
tests/unittests/models/test_gemma_llm.py ......................                                                                                                                        [100%]

===================================================================================== 22 passed in 1.05s =====================================================================================
```

**Manual End-to-End (E2E) Tests:**

Ran `adk run contributing/samples/hello_world_gemma4` with success

### Checklist

- [ X ] I have read the [CONTRIBUTING.md](https://github.com/google/adk-python/blob/main/CONTRIBUTING.md) document.
- [ X ] I have performed a self-review of my own code.
- [ X ] I have commented my code, particularly in hard-to-understand areas.
- [ X ] I have added tests that prove my fix is effective or that my feature works.
- [ X ] New and existing unit tests pass locally with my changes.
- [ X ] I have manually tested my changes end-to-end.
- [ X ] Any dependent changes have been merged and published in downstream modules.

### Additional context

Co-authored-by: George Weale <gweale@google.com>
COPYBARA_INTEGRATE_REVIEW=google#5117 from douglas-reid:gemma4-docs-clarity 9c90961
PiperOrigin-RevId: 933295498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged models [Component] This issue is related to model support request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants