From 01c3c990a701b592f45c16bf3ac93fd19c01146c Mon Sep 17 00:00:00 2001 From: Ingrid Fielker Date: Tue, 17 Feb 2026 20:46:17 -0500 Subject: [PATCH 1/2] chore(js/testapps, samples): Remove deprecated model from testapps and samples --- js/testapps/basic-gemini/src/index-vertexai.ts | 2 +- js/testapps/basic-gemini/src/index.ts | 2 +- samples/js-gemini/src/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/testapps/basic-gemini/src/index-vertexai.ts b/js/testapps/basic-gemini/src/index-vertexai.ts index 4cb089cf09..c18b02aedc 100644 --- a/js/testapps/basic-gemini/src/index-vertexai.ts +++ b/js/testapps/basic-gemini/src/index-vertexai.ts @@ -434,7 +434,7 @@ ai.defineFlow('gemini-image-editing', async (_) => { const room = fs.readFileSync('my_room.png', { encoding: 'base64' }); const { media } = await ai.generate({ - model: vertexAI.model('gemini-2.5-flash-image-preview'), + model: vertexAI.model('gemini-2.5-flash-image'), prompt: [ { text: 'add the plant to my room' }, { media: { url: `data:image/png;base64,${plant}` } }, diff --git a/js/testapps/basic-gemini/src/index.ts b/js/testapps/basic-gemini/src/index.ts index 1c5e8fb8da..f453a4cc37 100644 --- a/js/testapps/basic-gemini/src/index.ts +++ b/js/testapps/basic-gemini/src/index.ts @@ -465,7 +465,7 @@ ai.defineFlow('gemini-image-editing', async (_) => { const room = fs.readFileSync('my_room.png', { encoding: 'base64' }); const { media } = await ai.generate({ - model: googleAI.model('gemini-2.5-flash-image-preview'), + model: googleAI.model('gemini-2.5-flash-image'), prompt: [ { text: 'add the plant to my room' }, { media: { url: `data:image/png;base64,${plant}` } }, diff --git a/samples/js-gemini/src/index.ts b/samples/js-gemini/src/index.ts index 9093f01ea0..36369afa89 100644 --- a/samples/js-gemini/src/index.ts +++ b/samples/js-gemini/src/index.ts @@ -238,7 +238,7 @@ ai.defineFlow('gemini-image-editing', async (_) => { const room = fs.readFileSync('my_room.png', { encoding: 'base64' }); const { media } = await ai.generate({ - model: googleAI.model('gemini-2.5-flash-image-preview'), + model: googleAI.model('gemini-2.5-flash-image'), prompt: [ { text: 'add the plant to my room' }, { media: { url: `data:image/png;base64,${plant}` } }, From e205a3eac7c83b14b1b9ae307274054c9fefb1d4 Mon Sep 17 00:00:00 2001 From: Ingrid Fielker Date: Tue, 17 Feb 2026 21:07:57 -0500 Subject: [PATCH 2/2] chore: deprecate gemini-2.0-flash --- js/ai/src/model-types.ts | 2 +- js/core/src/registry.ts | 4 ++-- js/plugins/google-genai/src/googleai/gemini.ts | 7 +------ js/plugins/google-genai/src/vertexai/gemini.ts | 4 ---- .../google-genai/tests/googleai/gemini_test.ts | 18 +++++++++--------- .../google-genai/tests/googleai/index_test.ts | 2 +- .../google-genai/tests/vertexai/gemini_test.ts | 4 ++-- .../google-genai/tests/vertexai/index_test.ts | 2 +- js/testapps/basic-gemini/src/index.ts | 17 ----------------- 9 files changed, 17 insertions(+), 43 deletions(-) diff --git a/js/ai/src/model-types.ts b/js/ai/src/model-types.ts index cf20755ac8..d76a555c9a 100644 --- a/js/ai/src/model-types.ts +++ b/js/ai/src/model-types.ts @@ -174,7 +174,7 @@ export const GenerationCommonConfigSchema = z version: z .string() .describe( - 'A specific version of a model family, e.g. `gemini-2.0-flash` ' + + 'A specific version of a model family, e.g. `gemini-2.5-flash` ' + 'for the `googleai` family.' ) .optional(), diff --git a/js/core/src/registry.ts b/js/core/src/registry.ts index 5caa0eed5b..7bc2f478ed 100644 --- a/js/core/src/registry.ts +++ b/js/core/src/registry.ts @@ -89,7 +89,7 @@ interface ParsedRegistryKey { /** * Parses the registry key into key parts as per the key format convention. Ex: * - mcp-host:tool/my-tool - * - /model/googleai/gemini-2.0-flash + * - /model/googleai/gemini-2.5-flash * - /prompt/my-plugin/folder/my-prompt * - /util/generate */ @@ -125,7 +125,7 @@ export function parseRegistryKey( // Invalid key format return undefined; } - // ex: /model/googleai/gemini-2.0-flash or /prompt/my-plugin/folder/my-prompt + // ex: /model/googleai/gemini-2.5-flash or /prompt/my-plugin/folder/my-prompt if (tokens.length >= 4) { return { actionType: tokens[1] as ActionType, diff --git a/js/plugins/google-genai/src/googleai/gemini.ts b/js/plugins/google-genai/src/googleai/gemini.ts index 38d5bf7d7a..393dc06823 100644 --- a/js/plugins/google-genai/src/googleai/gemini.ts +++ b/js/plugins/google-genai/src/googleai/gemini.ts @@ -193,10 +193,7 @@ export const GeminiConfigSchema = GenerationCommonConfigSchema.extend({ .optional(), responseModalities: z .array(z.enum(['TEXT', 'IMAGE', 'AUDIO'])) - .describe( - 'The modalities to be used in response. Only supported for ' + - "'gemini-2.0-flash-exp' model at present." - ) + .describe('The modalities to be used in response.') .optional(), googleSearchRetrieval: z .union([z.boolean(), z.object({}).passthrough()]) @@ -426,8 +423,6 @@ const KNOWN_GEMINI_MODELS = { 'gemini-2.5-pro': commonRef('gemini-2.5-pro'), 'gemini-2.5-flash': commonRef('gemini-2.5-flash'), 'gemini-2.5-flash-lite': commonRef('gemini-2.5-flash-lite'), - 'gemini-2.0-flash': commonRef('gemini-2.0-flash'), - 'gemini-2.0-flash-lite': commonRef('gemini-2.0-flash-lite'), }; export type KnownGeminiModels = keyof typeof KNOWN_GEMINI_MODELS; export type GeminiModelName = `gemini-${string}`; diff --git a/js/plugins/google-genai/src/vertexai/gemini.ts b/js/plugins/google-genai/src/vertexai/gemini.ts index 1715bd973d..ba1ff06016 100644 --- a/js/plugins/google-genai/src/vertexai/gemini.ts +++ b/js/plugins/google-genai/src/vertexai/gemini.ts @@ -427,10 +427,6 @@ export const KNOWN_GEMINI_MODELS = { 'gemini-2.5-flash-lite': commonRef('gemini-2.5-flash-lite'), 'gemini-2.5-pro': commonRef('gemini-2.5-pro'), 'gemini-2.5-flash': commonRef('gemini-2.5-flash'), - 'gemini-2.0-flash-001': commonRef('gemini-2.0-flash-001'), - 'gemini-2.0-flash': commonRef('gemini-2.0-flash'), - 'gemini-2.0-flash-lite': commonRef('gemini-2.0-flash-lite'), - 'gemini-2.0-flash-lite-001': commonRef('gemini-2.0-flash-lite-001'), } as const; export type KnownGeminiModels = keyof typeof KNOWN_GEMINI_MODELS; export type GeminiModelName = `gemini-${string}`; diff --git a/js/plugins/google-genai/tests/googleai/gemini_test.ts b/js/plugins/google-genai/tests/googleai/gemini_test.ts index bae64a681a..68d24f3789 100644 --- a/js/plugins/google-genai/tests/googleai/gemini_test.ts +++ b/js/plugins/google-genai/tests/googleai/gemini_test.ts @@ -109,12 +109,12 @@ describe('Google AI Gemini', () => { describe('API Key Handling', () => { it('throws if no API key is provided', () => { assert.throws(() => { - defineModel('gemini-2.0-flash'); + defineModel('gemini-2.5-flash'); }, MISSING_API_KEY_ERROR); }); it('uses API key from pluginOptions', async () => { - const model = defineModel('gemini-2.0-flash', { + const model = defineModel('gemini-2.5-flash', { apiKey: 'plugin-key', }); mockFetchResponse(defaultApiResponse); @@ -129,7 +129,7 @@ describe('Google AI Gemini', () => { it('uses API key from GEMINI_API_KEY env var', async () => { process.env.GEMINI_API_KEY = 'gemini-key'; - const model = defineModel('gemini-2.0-flash'); + const model = defineModel('gemini-2.5-flash'); mockFetchResponse(defaultApiResponse); await model.run(minimalRequest); const fetchOptions = fetchStub.lastCall.args[1]; @@ -141,13 +141,13 @@ describe('Google AI Gemini', () => { it('works if apiKey is false and not in call config', async () => { mockFetchResponse(defaultApiResponse); - const model = defineModel('gemini-2.0-flash', { apiKey: false }); + const model = defineModel('gemini-2.5-flash', { apiKey: false }); assert.ok(await model.run(minimalRequest)); sinon.assert.calledOnce(fetchStub); }); it('uses API key from call config if apiKey is false', async () => { - const model = defineModel('gemini-2.0-flash', { apiKey: false }); + const model = defineModel('gemini-2.5-flash', { apiKey: false }); mockFetchResponse(defaultApiResponse); const request: GenerateRequest = { ...minimalRequest, @@ -430,7 +430,7 @@ describe('Google AI Gemini', () => { describe('Error Handling', () => { it('throws if no candidates are returned', async () => { - const model = defineModel('gemini-2.0-flash', defaultPluginOptions); + const model = defineModel('gemini-2.5-flash', defaultPluginOptions); mockFetchResponse({ candidates: [] }); await assert.rejects( model.run(minimalRequest), @@ -439,7 +439,7 @@ describe('Google AI Gemini', () => { }); it('throws on fetch error', async () => { - const model = defineModel('gemini-2.0-flash', defaultPluginOptions); + const model = defineModel('gemini-2.5-flash', defaultPluginOptions); fetchStub.rejects(new Error('Network error')); await assert.rejects(model.run(minimalRequest), /Failed to fetch/); }); @@ -458,7 +458,7 @@ describe('Google AI Gemini', () => { }); it('API call works with debugTraces: false', async () => { - const model = defineModel('gemini-2.0-flash', { + const model = defineModel('gemini-2.5-flash', { ...defaultPluginOptions, experimental_debugTraces: false, }); @@ -472,7 +472,7 @@ describe('Google AI Gemini', () => { describe('gemini() function', () => { it('returns a ModelReference for a known model string', () => { - const name = 'gemini-2.0-flash'; + const name = 'gemini-2.5-flash'; const modelRef = model(name); assert.strictEqual(modelRef.name, `googleai/${name}`); assert.strictEqual(modelRef.info?.supports?.multiturn, true); diff --git a/js/plugins/google-genai/tests/googleai/index_test.ts b/js/plugins/google-genai/tests/googleai/index_test.ts index 16831e8a22..72c22092ab 100644 --- a/js/plugins/google-genai/tests/googleai/index_test.ts +++ b/js/plugins/google-genai/tests/googleai/index_test.ts @@ -214,7 +214,7 @@ describe('GoogleAI Plugin', () => { describe('googleAI.model', () => { it('should return a gemini ModelReference with correct schema', () => { - const modelName = 'gemini-2.0-flash'; + const modelName = 'gemini-2.5-flash'; const modelRef = googleAI.model(modelName); assert.strictEqual( modelRef.name, diff --git a/js/plugins/google-genai/tests/vertexai/gemini_test.ts b/js/plugins/google-genai/tests/vertexai/gemini_test.ts index 290bafab75..b23e4a87e2 100644 --- a/js/plugins/google-genai/tests/vertexai/gemini_test.ts +++ b/js/plugins/google-genai/tests/vertexai/gemini_test.ts @@ -125,7 +125,7 @@ describe('Vertex AI Gemini', () => { describe('model() function', () => { it('returns a ModelReference for a known model string', () => { - const name = 'gemini-2.0-flash'; + const name = 'gemini-2.5-flash'; const modelRef: ModelReference = model(name); assert.strictEqual(modelRef.name, `vertexai/${name}`); assert.ok(modelRef.info?.supports?.multiturn); @@ -159,7 +159,7 @@ describe('Vertex AI Gemini', () => { it('applies options to the ModelReference', () => { const options = { temperature: 0.9, topK: 20 }; const modelRef: ModelReference = model( - 'gemini-2.0-flash', + 'gemini-2.5-flash', options ); assert.deepStrictEqual(modelRef.config, options); diff --git a/js/plugins/google-genai/tests/vertexai/index_test.ts b/js/plugins/google-genai/tests/vertexai/index_test.ts index bb1d62be78..5385b6f3f4 100644 --- a/js/plugins/google-genai/tests/vertexai/index_test.ts +++ b/js/plugins/google-genai/tests/vertexai/index_test.ts @@ -196,7 +196,7 @@ describe('VertexAI Plugin', () => { describe('Helper Functions', () => { it('vertexAI.model should return a ModelReference for Gemini with correct schema', () => { - const modelName = 'gemini-2.0-flash'; + const modelName = 'gemini-2.5-flash'; const modelRef = vertexAI.model(modelName); assert.strictEqual( modelRef.name, diff --git a/js/testapps/basic-gemini/src/index.ts b/js/testapps/basic-gemini/src/index.ts index f453a4cc37..e00cc1d69e 100644 --- a/js/testapps/basic-gemini/src/index.ts +++ b/js/testapps/basic-gemini/src/index.ts @@ -746,23 +746,6 @@ async function downloadVideo(video: MediaPart, path: string) { Readable.from(videoDownloadResponse.body).pipe(fs.createWriteStream(path)); } -// Test external URL with Gemini 2.0 (should download and inline) -ai.defineFlow('external-url-gemini-2.0', async () => { - const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), - prompt: [ - { text: 'Describe this image.' }, - { - media: { - url: 'https://storage.googleapis.com/generativeai-downloads/images/scones.jpg', - contentType: 'image/jpeg', - }, - }, - ], - }); - return text; -}); - // Test external URL with Gemini 3.0 (should pass as fileUri) ai.defineFlow('external-url-gemini-3.0', async () => { const { text } = await ai.generate({