-
Notifications
You must be signed in to change notification settings - Fork 9.3k
fix: add flash lite with respect to api defaults #4652
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
fix: add flash lite with respect to api defaults #4652
Conversation
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.
Summary of Changes
Hello @psinha40898, 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 addresses a functional issue with the gemini-2.5-flash-lite model within the Gemini CLI. The core problem was that flash-lite requires explicit enablement of its 'thinking' capability, unlike other gemini-2.5 models which have it on by default. My changes introduce logic to correctly identify and configure models based on their specific API defaults for 'thinking', ensuring flash-lite operates as intended.
Highlights
- Model Configuration Logic: Introduced a new helper function
isThinkingDefaultto accurately determine if a given Gemini model has 'thinking' enabled by default according to API specifications. This function specifically identifiesgemini-2.5-flash-liteas a model where thinking is not enabled by default. - Flash Lite Thinking Fix: Modified the
GeminiClient's content generation configuration to correctly applythinkingConfigparameters. This change ensures that for models likegemini-2.5-flash-lite, where thinking is supported but not enabled by default, thethinkingBudget: -1parameter is explicitly added to enable thinking functionality, resolving the issue with its behavior in the CLI.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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 or fill out our survey to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 adjusts the content generation configuration to enable 'thinking' for the gemini-2.5-flash-lite model, which has it disabled by default. The logic appears sound. However, my review identifies two important areas for improvement: a critical lack of unit tests for the new logic, and a high-severity issue regarding the use of a magic number, which impacts code maintainability. Addressing these points will significantly improve the quality and robustness of the changes.
|
Thanks for the fix, LGTM modulo the comment about making -1 a constant. You'll need to wait for another approver, but this seems fine to me. |
It is now corrected. Thank you for reviewing this! |
Co-authored-by: Gal Zahavi <38544478+galz10@users.noreply.github.com>
|
This introduced some unneeded code. The issue was fixed by merge of #3033. Very sad that nobody tried to reproduce the problem. Not here, not there. Absolutely non-google level of engineering. |
The PR was opened against main and your PR was merged separately weeks after this was opened because this is a big repo with duplicate issues. Sorry about that. I also didn't see your PR which was opened first. I still think it is better to have the code reflect the intention of the API than to hardcode the thinkingBudget at -1, but I can't make that call for sure. Ty for checking |
TLDR
2.5 flash lite was not working with the Gemini CLI because unlike the other models in the 2.5 series, flash-lite requires thinking to be explicitly turned on otherwise it is treated like a non thinking model.
Dive Deeper
The GenAI Gemini API states that 2.5 Pro always has thinking enabled, and 2.5 Flash has thinking enabled by default.
2.5 Flash Lite has thinking disabled by default.
Gemini API
View full docs →
Vertex API
View full docs →
Therefore if Flash Lite is to be treated as a thinking model and
includeThoughtsis an essential parameter in a minimalistgenerateContentConfig, then Flash Lite should be treated as a special case.Alternatively,
thinkingBudgetparameters, even though they do not require it to enable thinking.Reviewer Test Plan
Check that the following commands with and without the changes
Non interactive prompting for flash lite:
gemini -m gemini-2.5-flash-lite -p "just reply with pong"Running the CLI with flash lite:
gemini --model gemini-2.5-flash-liteTesting Matrix
Linked issues / bugs
Fixes #4548