fix: compute best Gemini model by tier and version - #6845
Open
Matvey-Kuk wants to merge 1 commit into
Open
Conversation
Gemini's "best" marker matched a hardcoded, ordered id list. With no gemini-3.5-pro in Google's catalog, a 3.5 Flash outranked the available Pro models, so Flash was marked best. Replace the list with a computed score from the id (Pro > Flash > Flash-lite, then newest generation, then GA over preview), so best tracks releases with no list to maintain.
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.
What
Gemini's "best" model marker was matched against a hardcoded, manually-ordered list of exact model-id substrings (
MODEL_MARKER_PATTERNS.gemini). Google has not shipped agemini-3.5-pro, so thegemini-3.5-flashentry outranked the actually-available Pro models (gemini-3.1-pro-preview,gemini-3-pro-preview) and a Flash was marked "best".Replaces the static list with a score computed from the model id in
pickBestGeminiModelId(shared/gemini-models.ts): tier (Pro > Flash > Flash-lite), then newest generation, then GA over-preview. This tracks new releases with no list to maintain and can't re-break when Google ships the next model.Changes
shared/gemini-models.ts—pickBestGeminiModelId+geminiChatScore.shared/model-constants.ts—MODEL_MARKER_PATTERNS.gemininow[](computed instead).backend/src/models/llm-provider-api-key-model.ts—findBestModeldispatches Gemini to the computed selector; other providers unchanged.Verified
Unit + integration tests pass; refreshing models on a dev stack marks
gemini-3.1-pro-preview(newest available Pro) as best.