Repository navigation
💡 Platform feature: Gemini model abstraction layer (config-driven model selection with automatic version fallback) #608
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Create a shared Gemini model management utility in
gas-utils.jsthat centralizes model version selection, provides fallback chains when a model is deprecated, and standardizes theUrlFetchAppcall pattern across all AI-powered scripts. This prevents the recurring breakage seen when Google deprecates Gemini model versions (2.0 Flash was shut down June 1, 2026) and reduces per-script boilerplate as the catalog adds more AI-powered automations.Market Signal
Gemini 2.0 Flash was deprecated and shut down on June 1, 2026 — any script hardcoding that model string is now broken. Google's rapid model iteration cycle (1.5 → 2.0 → 3.5 Flash in ~18 months) means this will happen again. The
gmail-ai-classifierREADME still referencesgemini-2.0-flashas a supported model. Meanwhile, every major AI framework (LangChain, LiteLLM, etc.) has adopted model abstraction as a core pattern because model churn is the norm, not the exception.Sources:
User Signal
The
gmail-ai-classifieris under active development (PRs #605, #606 merged Sep 29–30 with prompt architecture migration). Issue #491 proposes an AI-Powered Gemini Email Classifier. Multiple existing idea Discussions propose new Gemini-powered scripts: #597 (gmail-action-extractor), #587 (AI-assisted config wizard), #589 (AI-structured archive), #552 (AI daily briefing). Each of these will face the same model version migration burden unless there is a shared abstraction.Technical Opportunity
gas-utils.jsalready serves as the shared utility module. AgetGeminiResponse(prompt, options)function that reads the model version fromconfig.gsand falls back through a version chain (e.g.,gemini-3.5-flash→gemini-2.5-flash) would be ~30 lines. The existingUrlFetchApppattern ingmail-ai-classifier'scode.gsis the starting template. Structured output support (responseSchema) can be standardized across all AI scripts.Proposed function signature:
Assessment
Adversarial Review
Strongest objection: This is over-engineering a simple string change. Just update the model name when Google deprecates it. Different scripts may need different models (cheap vs. capable) so a single abstraction doesn't fit.
Rebuttal: The "just change the string" approach already failed —
gemini-2.0-flashis shut down and the README still references it. With 5+ planned AI scripts, a model deprecation now requires 5+ coordinated changes instead of 1. The abstraction handles the "different models for different scripts" case naturally: eachconfig.gsspecifies its preferred model, and the shared utility handles theUrlFetchAppcall pattern, error handling, and fallback logic. The complexity is in the call boilerplate (headers, JSON parsing, error codes, rate limiting), not the model string.Suggested Next Step
Audit current Gemini API usage in
gmail-ai-classifierto catalog the exact call pattern (headers, payload shape, error handling). Design thegas-utils.jsfunction signature. Updateconfig.gsto usegemini-3.5-flashas the primary model. Write tests for the fallback chain logic.All reactions