-
Notifications
You must be signed in to change notification settings - Fork 840
fix(samples): Use native Gemini integration instead of LiteLLM #603
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
base: main
Are you sure you want to change the base?
fix(samples): Use native Gemini integration instead of LiteLLM #603
Conversation
Replace LiteLlm wrapper with ADK's native Gemini class for better performance, reliability, and access to latest features. This removes the warning about using Gemini via LiteLLM. Changes: - Import Gemini from google.adk.models.google_llm instead of LiteLlm - Rename env var from LITELLM_MODEL to GEMINI_MODEL - Update model format from "gemini/gemini-2.5-flash" to "gemini-2.5-flash"
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly replaces the LiteLlm wrapper with the native Gemini class across several sample agent files, which should improve performance and reliability. The changes are mostly straightforward replacements of imports, environment variable names, and model instantiation. I've identified a minor inconsistency in variable naming for the Gemini model across the modified files and have provided suggestions to align them with Python's PEP 8 style guide for local variables (snake_case). This will improve code consistency and maintainability. Overall, this is a solid improvement.
| GEMINI_MODEL = os.getenv("GEMINI_MODEL", "gemini-2.5-flash") | ||
| agent = LlmAgent( | ||
| model=LiteLlm(model=LITELLM_MODEL), | ||
| model=Gemini(model=GEMINI_MODEL), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable GEMINI_MODEL should be renamed to gemini_model to follow Python's snake_case convention for local variables. This improves consistency with the style used in samples/agent/adk/rizzcharts/__main__.py and adheres to PEP 8.
| GEMINI_MODEL = os.getenv("GEMINI_MODEL", "gemini-2.5-flash") | |
| agent = LlmAgent( | |
| model=LiteLlm(model=LITELLM_MODEL), | |
| model=Gemini(model=GEMINI_MODEL), | |
| gemini_model = os.getenv("GEMINI_MODEL", "gemini-2.5-flash") | |
| agent = LlmAgent( | |
| model=Gemini(model=gemini_model), |
References
- The repository style guide (line 9) states that code should follow relevant style guides for each language. For Python, PEP 8 is the standard, which recommends
snake_casefor local variables. (link)
Summary
Test plan