fix(core): add aliases and thinking config for gemini-3.1 models#27007
fix(core): add aliases and thinking config for gemini-3.1 models#27007anishs1207 wants to merge 3 commits into
Conversation
Summary of ChangesHello, 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 API errors encountered when using Gemini 3.1 models by ensuring they are correctly registered and mapped to the appropriate base configuration. By inheriting from chat-base-3, these models now correctly include the required thinkingLevel parameter, preventing invalid argument errors during API requests. 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 the 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 counterproductive. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds configurations for new Gemini 3.1 models (gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools, and gemini-3.1-flash-lite-preview) to the default model configurations, extending the chat-base-3 base. It also includes unit tests to ensure these models correctly resolve their configurations, specifically verifying the thinkingLevel property. I have no feedback to provide.
|
Ready for review of PR @scidomino |
Summary
This PR resolves the
INVALID_ARGUMENT (400)API error encountered when using Gemini 3.1 models. It ensures that all Gemini 3.1 variants are correctly mapped to thechat-base-3configuration, which includes the mandatorythinkingLevelparameter required by the Google Generative AI API.Details
The investigation revealed that while
gemini-3.1-pro-previewwas present, it lacked an entry in the aliases section ofdefaultModelConfigs.ts. This caused the CLI to fall back to a basic configuration that enabled "Thinking" mode but failed to provide athinkingLevel(e.g.,HIGH). Gemini 3.1 models strictly require this level when thinking is enabled; without it, the API rejects the request as an invalid argument.Changes include:
gemini-3.1-pro-preview,gemini-3.1-pro-preview-customtools, andgemini-3.1-flash-lite-previewto the core alias registry.chat-base-3to ensureThinkingLevel.HIGHis included in all requests.Related Issues
Fixes #26997, #27000, #27005, #26996
How to Validate
packages/core/src/config/models.test.tsto ensure 3.1 models resolve with the correct config.npm run test core400error no longer occurs.Pre-Merge Checklist