Skip to content

Update Gemini LLM and Embeddings to use google-genai SDK #2881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

philschmid
Copy link

Update Gemini LLM and Embeddings to use google-genai SDK

This commit migrates the Gemini LLM and embedding integrations from the previous google.generativeai SDK to the new google.genai SDK.

Key changes include:

  • Updated mem0/llms/gemini.py and mem0/embeddings/gemini.py to use the new SDK, including changes to client initialization, API call methods, and parameter handling.
  • Modified tests/llms/test_gemini_llm.py and tests/embeddings/test_gemini.py to align with the SDK changes, updating mocks and assertions.
  • Updated pyproject.toml to include google-genai as a dependency.

Targeted tests for the Gemini integration are passing.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • Unit Test
  • Test Script (please provide)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed

Update Gemini LLM and Embeddings to use google-genai SDK

This commit migrates the Gemini LLM and embedding integrations from the previous `google.generativeai` SDK to the new `google.genai` SDK.

Key changes include:
- Updated `mem0/llms/gemini.py` and `mem0/embeddings/gemini.py` to use the new SDK, including changes to client initialization, API call methods, and parameter handling.
- Modified `tests/llms/test_gemini_llm.py` and `tests/embeddings/test_gemini.py` to align with the SDK changes, updating mocks and assertions.
- Updated `pyproject.toml` to include `google-genai` as a dependency.

Targeted tests for the Gemini integration are passing.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@deshraj deshraj requested a review from Dev-Khant June 4, 2025 17:40
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.

2 participants