fix(kits): add Gemini 3.x before 2.5 retirement - #2943
Conversation
Chatbot, translate, resize filter, and vector embeddings still pin retiring or retired Gemini model ids.
There was a problem hiding this comment.
Code Review
This pull request updates several Firebase Extensions to use Gemini 3.6 Flash as the default model and gemini-embedding-2 for vector search. It also refactors model reference resolution in the GenAI Chatbot extension to support dynamic fallback instead of throwing errors. The review feedback suggests simplifying shouldUseGenkitClient since model resolution no longer throws, and adding missing Gemini 3.5 models to the translation options for consistency.
| } | ||
|
|
||
| /** Whether the Genkit client can serve this config (single candidate + known model). */ | ||
| /** Whether the Genkit client can serve this config (single candidate). */ |
There was a problem hiding this comment.
Since createModelReference has been updated to never throw and always return a ModelReference (falling back to dynamic resolution), the check !!GenkitDiscussionClient.createModelReference(...) in shouldUseGenkitClient will always evaluate to true.
We can simplify shouldUseGenkitClient to only check the candidate count, avoiding redundant model reference creation:
static shouldUseGenkitClient(config: ResolvedGenaiChatbotConfig): boolean {
const shouldReturnMultipleCandidates =
config.candidateCount && config.candidateCount > 1;
return !shouldReturnMultipleCandidates;
}| "gemini-3.1-pro-preview", | ||
| "gemini-3.6-flash", | ||
| "gemini-3.1-flash-lite", |
There was a problem hiding this comment.
The GEMINI_MODEL_OPTIONS list is missing gemini-3.5-flash and gemini-3.5-flash-lite, which are valid Gemini 3.x models and are included in the chatbot's knownIds. Adding them here ensures consistency across extensions and allows users to select these models from the dropdown in the Firebase Console.
| "gemini-3.1-pro-preview", | |
| "gemini-3.6-flash", | |
| "gemini-3.1-flash-lite", | |
| "gemini-3.6-flash", | |
| "gemini-3.5-flash", | |
| "gemini-3.5-flash-lite", | |
| "gemini-3.1-flash-lite", | |
| "gemini-3.1-pro-preview", |
Picker listed every 2.5 model; add 3.5 Flash and Flash Lite to match the current Gemini set.
Similar price to previous gemini-2.5-flash and better quality. Avoid 3.5-flash-lite and higher cost.
Summary
gemini-3.6-flash; add 3.x ids to the translate select list (2.5 kept until October 2026).Model not found.for unknown ids — falls through togoogleAI.model()/vertexAI.model().gemini-3.1-flash-lite.gemini-embedding-2(Gemini API retiredgemini-embedding-001on 14 Jul 2026). Flash completion IDs are not embedders.Why
gemini-3.1-flash-lite(notgemini-3.5-flash-liteor higher)The resize content filter is a high-volume yes/no image check, previously hardcoded to
gemini-2.5-flash. We pickedgemini-3.1-flash-litebecause it is similar in price to that previous default ($0.25/$1.50 vs $0.30/$2.50 per 1M tokens) and performs better (Google: similar or better quality than 2.5 Flash, ~2.5× faster time-to-first-token).gemini-3.5-flash-liteis the same sticker as 2.5 Flash;gemini-3.5-flashandgemini-3.6-flashare about 5× input.Test plan
firestore-genai-chatbotunit tests (includes current-model Genkit path)GEMINI_MODELselect includes 3.x and defaults to 3.6 Flashgemini-3.6-flashstorage-resize-imagescontent-filter unit testsgemini-embedding-2