-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add more options to Gemini class to pass to genai.Client constructor. #3813
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?
Conversation
This change adds `vertexai`, `api_key`, `credentials`, `project`, `location`, and `debug_config` fields to the `Gemini` class in `src/google/adk/models/google_llm.py`. These fields are then passed to the `google.genai.Client` constructor in both `_api_client` and `_live_api_client` methods. This allows for more granular configuration of the Gemini client.
Summary of ChangesHello @ehmm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the configurability of the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Response from ADK Triaging Agent Hello @ehmm, thank you for creating this PR! Could you please provide logs or screenshots of your manual end-to-end tests? This will help reviewers to better understand and verify your changes. Thanks! |
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 adds several configuration options to the Gemini class, allowing for more granular control over the google.genai.Client initialization. The changes are straightforward and align with the goal of moving away from environment variables for configuration. My review includes a couple of suggestions to improve maintainability and fully implement the intended changes as described in the pull request description.
| vertexai: Optional[bool] = None | ||
| api_key: Optional[str] = None | ||
| credentials: Optional[google.auth.credentials.Credentials] = None | ||
| project: Optional[str] = None | ||
| location: Optional[str] = None |
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 pull request description mentions adding a debug_config field, but it appears to be missing here. To align with the PR's goal, you should add it. This will also require passing self.debug_config to the Client constructor in api_client and _live_api_client.
| vertexai: Optional[bool] = None | |
| api_key: Optional[str] = None | |
| credentials: Optional[google.auth.credentials.Credentials] = None | |
| project: Optional[str] = None | |
| location: Optional[str] = None | |
| vertexai: Optional[bool] = None | |
| api_key: Optional[str] = None | |
| credentials: Optional[google.auth.credentials.Credentials] = None | |
| project: Optional[str] = None | |
| location: Optional[str] = None | |
| debug_config: Optional[types.DebugConfig] = None |
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.
Perferred at the end not to add DebugConfig as it is for internal use and probably not worth it will edit commit message
|
Hi @ehmm , Thank you for your work on this pull request. We appreciate the effort you've invested. |
This change adds
vertexai,api_key,credentials,project,location, fields to theGeminiclass insrc/google/adk/models/google_llm.py. These fields are then passed to thegoogle.genai.Clientconstructor in both_api_clientand_live_api_clientmethods. This allows for more granular configuration of the Gemini client.Problem:
Before this the only way to set Gemini model options was via env vars (quite messy)
Solution:
Add optional variables that can propagate to genai.Client
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:
3360 passed, 1 skipped, 2521 warnings in 94.33s (0:01:34)
Manual End-to-End (E2E) Tests: