-
-
Notifications
You must be signed in to change notification settings - Fork 41
[Fix] Disable thinking parameters for non-Gemini 3 models #654
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
Conversation
Reset thinkingBudget and thinkingLevel to undefined for models that don't support thinking mode to prevent API errors.
…o 1.3.15 Use the local 'model' variable instead of 'params.model' for image generation detection to ensure consistency with earlier variable extraction.
|
Caution Review failedThe pull request is closed. 📋 Walkthrough修复了 📊 Changes
⏱️ Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
🔗 Possibly related PRs
🐰 Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @dingyi222666, 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 resolves critical issues within the Gemini adapter by preventing the incorrect transmission of 'thinking' parameters to models that do not support them, thereby avoiding API errors. It also enhances code consistency by standardizing model variable usage and includes a routine version update for the package. 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
|
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 aims to prevent sending 'thinking' parameters to unsupported Gemini models, specifically when image generation is active. It correctly switches from using params.model to the processed model variable for consistency. However, the current implementation has a logical flaw where it unconditionally disables thinking parameters for any model if image generation is enabled in the configuration, even if the model doesn't support image generation. This could break the 'thinking' feature for models that support it. I've provided a suggestion to correct this logic. The version bump to 1.3.15 is also noted.
| imageGeneration = | ||
| params.model.includes('gemini-2.0-flash-exp') || | ||
| params.model.includes('image') | ||
| model.includes('gemini-2.0-flash-exp') || model.includes('image') | ||
|
|
||
| thinkingBudget = undefined | ||
| thinkingLevel = undefined |
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.
There's a logical issue here. If imageGeneration is enabled in the config, thinkingBudget and thinkingLevel are reset to undefined regardless of whether the current model actually supports image generation. This can incorrectly disable the 'thinking' feature for models that support it but don't support image generation (e.g., a gemini-3-pro model with thinking enabled).
The reset of thinking parameters should only occur if the model is determined to be an image generation model. The imageGeneration flag should also be set to false if the model does not support it, to prevent issues later.
if (model.includes('gemini-2.0-flash-exp') || model.includes('image')) {
thinkingBudget = undefined
thinkingLevel = undefined
} else {
imageGeneration = false
}
This PR fixes issues with the Gemini adapter where thinking parameters were incorrectly sent to models that don't support them.
Bug Fixes
thinkingBudgetandthinkingLevelparameters for non-Gemini 3 models to prevent API errorsmodelinstead ofparams.modelfor image generation detectionOther Changes