fix: add Gemma 4 model support and stop silent model ID fallback#12167
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: add Gemma 4 model support and stop silent model ID fallback#12167roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
…fallback - Add gemma-4-31b-it, gemma-4-12b-it, gemma-4-6b-it, gemma-4-4b-it, and gemma-4-1b-it to the geminiModels map with correct context windows and capabilities - Fix silent fallback in GeminiHandler.getModel() that replaced unknown model IDs with geminiDefaultModelId (gemini-3.1-pro-preview) - Apply the same fix to VertexHandler.getModel() - Now preserves user-provided model ID and only falls back on model info - Update tests to verify unknown models are passed through and Gemma 4 models are natively recognized Closes #12166
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #12166
Description
This PR attempts to address Issue #12166. Feedback and guidance are welcome.
Two changes:
Add Gemma 4 models to the
geminiModelsmap (packages/types/src/providers/gemini.ts):gemma-4-31b-it(131K context, image support)gemma-4-12b-it(131K context, image support)gemma-4-6b-it(32K context, image support)gemma-4-4b-it(32K context, image support)gemma-4-1b-it(32K context, text only)Fix silent model ID fallback in both
GeminiHandler.getModel()andVertexHandler.getModel():gemini-3.1-pro-preview), causing 429 quota errors when users specified custom models like Gemma 4Test Procedure
cd src && npx vitest run api/providers/__tests__/gemini.spec.ts api/providers/__tests__/vertex.spec.ts-- all 28 tests passPre-Submission Checklist
Documentation Updates
Additional Notes
The fix applies the same pattern used by the DeepSeek provider (
deepseek.ts:37-48), which preserves the user-provided model ID and only falls back on model info for unknown models.Interactively review PR in Roo Code Cloud