feat(ai-gemini): add support for Gemini 3.1 Flash Lite Preview model#351
feat(ai-gemini): add support for Gemini 3.1 Flash Lite Preview model#351NachoVazquez wants to merge 3 commits intoTanStack:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis change introduces support for the Gemini 3.1 Flash Lite Preview model to the AI-Gemini adapter. The model is registered in metadata with specifications for tokens, pricing, capabilities, and added to the summarization adapter. Comprehensive type tests verify full multimodal support and configuration options. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/typescript/ai-gemini/src/adapters/summarize.ts (1)
23-29:⚠️ Potential issue | 🔴 CriticalUpdate
gemini-3.1-flash-litetogemini-3.1-flash-lite-preview.The model identifier in this array does not match the official Gemini API documentation. The Gemini API publishes this model as
gemini-3.1-flash-lite-preview, and API calls using the identifier without the-previewsuffix will fail. Additionally, this inconsistency should be corrected inmodel-meta.tswhereGEMINI_3_1_FLASH_LITEis defined, as all other Gemini 3.x models in that file include the-previewsuffix.🔧 Minimal fix
export const GeminiSummarizeModels = [ - 'gemini-3.1-flash-lite', + 'gemini-3.1-flash-lite-preview',🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/typescript/ai-gemini/src/adapters/summarize.ts` around lines 23 - 29, Update the Gemini model identifier strings to match the official API: replace 'gemini-3.1-flash-lite' with 'gemini-3.1-flash-lite-preview' in the GeminiSummarizeModels array and also update the corresponding constant GEMINI_3_1_FLASH_LITE in model-meta.ts to include the '-preview' suffix so all Gemini 3.x entries are consistent with the API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/typescript/ai-gemini/src/model-meta.ts`:
- Around line 231-266: Update the GEMINI_3_1_FLASH_LITE model definition so its
name property uses the published ID "gemini-3.1-flash-lite-preview" instead of
"gemini-3.1-flash-lite", and then search for and update any hardcoded references
to the old ID in the summarize adapter and related tests to the new ID (ensure
the constant GEMINI_3_1_FLASH_LITE and its type assertion/satisfies clause
remain unchanged except for the name string).
---
Outside diff comments:
In `@packages/typescript/ai-gemini/src/adapters/summarize.ts`:
- Around line 23-29: Update the Gemini model identifier strings to match the
official API: replace 'gemini-3.1-flash-lite' with
'gemini-3.1-flash-lite-preview' in the GeminiSummarizeModels array and also
update the corresponding constant GEMINI_3_1_FLASH_LITE in model-meta.ts to
include the '-preview' suffix so all Gemini 3.x entries are consistent with the
API.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4807662e-6a0e-4986-b1f2-ffb4a594e83a
📒 Files selected for processing (3)
packages/typescript/ai-gemini/src/adapters/summarize.tspackages/typescript/ai-gemini/src/model-meta.tspackages/typescript/ai-gemini/tests/model-meta.test.ts
cbaccd7 to
43a0f1f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/pull_request_template.md:
- Line 16: Update the PR description entry that currently reads
".changeset/flat-dingos-fry.md" to reference the actual changeset filename in
this PR ".changeset/fluffy-rats-worry.md" so the listed changeset matches the
file included; locate the offending string in the PR description or template and
replace it with the correct filename.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4a22bb7d-58c8-469b-975e-37864931678c
📒 Files selected for processing (5)
.changeset/fluffy-rats-worry.md.github/pull_request_template.mdpackages/typescript/ai-gemini/src/adapters/summarize.tspackages/typescript/ai-gemini/src/model-meta.tspackages/typescript/ai-gemini/tests/model-meta.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/typescript/ai-gemini/src/adapters/summarize.ts
Add the new Gemini 3.1 Flash Lite Preview model to the Gemini adapter with full multimodal support and comprehensive type safety. Model Specifications: - Model ID: gemini-3.1-flash-lite-preview - Input tokens: 1,048,576 - Output tokens: 65,536 - Knowledge cutoff: 2025-01-01 - Pricing: $0.25/1M input, $1.50/1M output Capabilities: - Full multimodal input: text, image, audio, video, document - Thinking and structured output support - Function calling and code execution - Caching, batch API, search grounding, URL context - Available for summarization tasks Changes: - Add GEMINI_3_1_FLASH_LITE model constant to model-meta.ts - Add model to GEMINI_MODELS array and type maps - Add to GeminiSummarizeModels for summarization support - Add comprehensive type assertion tests (33 total tests) - Create changeset for minor version release All tests pass: test:types, test:eslint, test:lib, test:pr
2e8a978 to
e982818
Compare
🎯 Changes
Added support for Gemini 3.1 Flash Lite Preview model to the
@tanstack/ai-geminiadapter.Model Details
gemini-3.1-flash-lite-previewFiles Changed
packages/typescript/ai-gemini/src/model-meta.ts: AddedGEMINI_3_1_FLASH_LITE_PREVIEWmodel constant with full specifications, added toGEMINI_MODELSarray and type maps (GeminiChatModelProviderOptionsByName,GeminiModelInputModalitiesByName)packages/typescript/ai-gemini/src/adapters/summarize.ts: Addedgemini-3.1-flash-lite-previewtoGeminiSummarizeModelsarraypackages/typescript/ai-gemini/tests/model-meta.test.ts: Added comprehensive type assertion tests for the new model (thinking support, provider options, property checks, input modalities).changeset/fluffy-rats-worry.md: Generated changeset for release✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit