From 818dfd51299b61b12c5b0641d5d34d6a4a6247fb Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Fri, 31 Oct 2025 00:48:22 +0000 Subject: [PATCH 1/3] chore(js): update gemini models in docs and samples --- js/ai/src/model-types.ts | 4 +- js/core/src/registry.ts | 6 +-- js/doc-snippets/src/dotprompt/index.ts | 4 +- .../src/dotprompt/prompts/ex01.prompt | 2 +- .../src/dotprompt/prompts/ex02.prompt | 2 +- .../src/dotprompt/prompts/ex03.prompt | 2 +- .../src/dotprompt/prompts/ex04.prompt | 2 +- .../src/dotprompt/prompts/ex05.prompt | 2 +- .../src/dotprompt/prompts/ex06.prompt | 2 +- .../src/dotprompt/prompts/ex08.prompt | 2 +- js/doc-snippets/src/flows/index.ts | 12 +++--- js/doc-snippets/src/index.ts | 2 +- js/doc-snippets/src/models/index.ts | 6 +-- js/doc-snippets/src/models/minimal.ts | 2 +- js/genkit/tests/prompts/badSchemaRef.prompt | 4 +- js/genkit/tests/prompts/schemaRef.prompt | 4 +- .../google-genai/tests/common/utils_test.ts | 22 +++++------ .../tests/googleai/client_test.ts | 8 ++-- .../tests/googleai/gemini_test.ts | 18 ++++----- .../google-genai/tests/googleai/index_test.ts | 12 +++--- .../tests/vertexai/client_test.ts | 16 ++++---- .../tests/vertexai/gemini_test.ts | 8 ++-- .../google-genai/tests/vertexai/index_test.ts | 12 +++--- js/plugins/googleai/README.md | 2 +- js/plugins/googleai/tests/gemini_test.ts | 30 +++++++------- js/plugins/mcp/README.md | 39 ++++++++++--------- js/plugins/vertexai/tests/plugin_test.ts | 30 +++++++------- .../dev-ui-gallery/prompts/code.prompt | 2 +- .../prompts/hello.first-last-name.prompt | 2 +- .../prompts/hello.history.prompt | 2 +- .../prompts/hello.json-output.prompt | 2 +- .../dev-ui-gallery/prompts/hello.prompt | 2 +- .../prompts/hello.system.prompt | 2 +- .../dev-ui-gallery/prompts/markdown.prompt | 2 +- .../prompts/tools/weather.prompt | 2 +- .../flow-simple-ai/prompts/TellJoke.prompt | 4 +- .../prompts/dotpromptContext.prompt | 4 +- js/testapps/flow-simple-ai/src/index.ts | 36 ++++++++--------- js/testapps/format-tester/src/index.ts | 9 ++--- 39 files changed, 163 insertions(+), 161 deletions(-) diff --git a/js/ai/src/model-types.ts b/js/ai/src/model-types.ts index e64381345f..9a290a5d9c 100644 --- a/js/ai/src/model-types.ts +++ b/js/ai/src/model-types.ts @@ -174,8 +174,8 @@ export const GenerationCommonConfigSchema = z version: z .string() .describe( - 'A specific version of a model family, e.g. `gemini-2.0-flash` ' + - 'for the `googleai` family.' + 'A specific version of a model family, e.g. `gemini-2.5-flash` ' + + 'for the `googleai` family.' ) .optional(), temperature: z diff --git a/js/core/src/registry.ts b/js/core/src/registry.ts index 90fbe91411..b2f8b81219 100644 --- a/js/core/src/registry.ts +++ b/js/core/src/registry.ts @@ -88,7 +88,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 */ @@ -124,7 +124,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, @@ -224,7 +224,7 @@ export class Registry { if ( parsedKey?.dynamicActionHost && this.actionsById[ - `/dynamic-action-provider/${parsedKey.dynamicActionHost}` + `/dynamic-action-provider/${parsedKey.dynamicActionHost}` ] ) { // If it's a dynamic action provider, get the dynamic action. diff --git a/js/doc-snippets/src/dotprompt/index.ts b/js/doc-snippets/src/dotprompt/index.ts index 18c184f226..7854487b7f 100644 --- a/js/doc-snippets/src/dotprompt/index.ts +++ b/js/doc-snippets/src/dotprompt/index.ts @@ -153,7 +153,7 @@ function fn09() { // [START definePromptTempl] const myPrompt = ai.definePrompt({ name: 'myPrompt', - model: 'googleai/gemini-1.5-flash', + model: 'googleai/gemini-2.5-flash', input: { schema: z.object({ name: z.string(), @@ -168,7 +168,7 @@ function fn10() { // [START definePromptFn] const myPrompt = ai.definePrompt({ name: 'myPrompt', - model: 'googleai/gemini-1.5-flash', + model: 'googleai/gemini-2.5-flash', input: { schema: z.object({ name: z.string(), diff --git a/js/doc-snippets/src/dotprompt/prompts/ex01.prompt b/js/doc-snippets/src/dotprompt/prompts/ex01.prompt index 808989a655..68468abe1b 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex01.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex01.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash config: temperature: 0.9 input: diff --git a/js/doc-snippets/src/dotprompt/prompts/ex02.prompt b/js/doc-snippets/src/dotprompt/prompts/ex02.prompt index 32f5b8eca2..262a1af53c 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex02.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex02.prompt @@ -1,4 +1,4 @@ --- -model: vertexai/gemini-1.5-flash +model: vertexai/gemini-2.5-flash --- You are the world's most welcoming AI assistant. Greet the user and offer your assistance. \ No newline at end of file diff --git a/js/doc-snippets/src/dotprompt/prompts/ex03.prompt b/js/doc-snippets/src/dotprompt/prompts/ex03.prompt index b9e53b4a2d..716f28c66e 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex03.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex03.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash config: temperature: 1.4 topK: 50 diff --git a/js/doc-snippets/src/dotprompt/prompts/ex04.prompt b/js/doc-snippets/src/dotprompt/prompts/ex04.prompt index 54f23637dd..8c2b108b55 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex04.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex04.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: theme?: string diff --git a/js/doc-snippets/src/dotprompt/prompts/ex05.prompt b/js/doc-snippets/src/dotprompt/prompts/ex05.prompt index 4099ba82ea..9402d2d810 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex05.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex05.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: theme?: string diff --git a/js/doc-snippets/src/dotprompt/prompts/ex06.prompt b/js/doc-snippets/src/dotprompt/prompts/ex06.prompt index 6c55a29454..326fa6d9d8 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex06.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex06.prompt @@ -1,5 +1,5 @@ --- -model: vertexai/gemini-1.5-flash +model: vertexai/gemini-2.5-flash input: schema: userQuestion: string diff --git a/js/doc-snippets/src/dotprompt/prompts/ex08.prompt b/js/doc-snippets/src/dotprompt/prompts/ex08.prompt index 3df55e7876..b936a5fce1 100644 --- a/js/doc-snippets/src/dotprompt/prompts/ex08.prompt +++ b/js/doc-snippets/src/dotprompt/prompts/ex08.prompt @@ -1,5 +1,5 @@ --- -model: vertexai/gemini-1.5-flash +model: vertexai/gemini-2.5-flash input: schema: photoUrl: string diff --git a/js/doc-snippets/src/flows/index.ts b/js/doc-snippets/src/flows/index.ts index 05271e8dce..0f9a476fa2 100644 --- a/js/doc-snippets/src/flows/index.ts +++ b/js/doc-snippets/src/flows/index.ts @@ -29,7 +29,7 @@ export const menuSuggestionFlow = ai.defineFlow( }, async (restaurantTheme) => { const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: `Invent a menu item for a ${restaurantTheme} themed restaurant.`, }); return text; @@ -51,7 +51,7 @@ export const menuSuggestionFlowWithSchema = ai.defineFlow( }, async (restaurantTheme) => { const { output } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: `Invent a menu item for a ${restaurantTheme} themed restaurant.`, output: { schema: MenuItemSchema }, }); @@ -72,7 +72,7 @@ export const menuSuggestionFlowMarkdown = ai.defineFlow( }, async (restaurantTheme) => { const { output } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: `Invent a menu item for a ${restaurantTheme} themed restaurant.`, output: { schema: MenuItemSchema }, }); @@ -94,7 +94,7 @@ export const menuSuggestionStreamingFlow = ai.defineFlow( }, async (restaurantTheme, { sendChunk }) => { const response = await ai.generateStream({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: `Invent a menu item for a ${restaurantTheme} themed restaurant.`, }); @@ -128,7 +128,7 @@ export const complexMenuSuggestionFlow = ai.defineFlow( outputSchema: PrixFixeMenuSchema, }, async (theme: string): Promise> => { - const chat = ai.chat({ model: googleAI.model('gemini-2.0-flash') }); + const chat = ai.chat({ model: googleAI.model('gemini-2.5-flash') }); await chat.send('What makes a good prix fixe menu?'); await chat.send( 'What are some ingredients, seasonings, and cooking techniques that ' + @@ -178,7 +178,7 @@ Today's menu } ); const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), system: "Help the user answer questions about today's menu.", prompt: input, docs: [{ content: [{ text: menu }] }], diff --git a/js/doc-snippets/src/index.ts b/js/doc-snippets/src/index.ts index 853a968558..a24913d9c0 100644 --- a/js/doc-snippets/src/index.ts +++ b/js/doc-snippets/src/index.ts @@ -19,7 +19,7 @@ import { genkit } from 'genkit'; const ai = genkit({ plugins: [googleAI()], - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), }); async function main() { diff --git a/js/doc-snippets/src/models/index.ts b/js/doc-snippets/src/models/index.ts index e3db35c5cd..387385c309 100644 --- a/js/doc-snippets/src/models/index.ts +++ b/js/doc-snippets/src/models/index.ts @@ -19,13 +19,13 @@ import { genkit } from 'genkit'; const ai = genkit({ plugins: [googleAI()], - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), }); async function fn01() { // [START ex01] const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: 'Invent a menu item for a pirate themed restaurant.', }); // [END ex01] @@ -34,7 +34,7 @@ async function fn01() { async function fn02() { // [START ex02] const { text } = await ai.generate({ - model: 'googleai/gemini-2.0-flash-001', + model: 'googleai/gemini-2.5-flash-001', prompt: 'Invent a menu item for a pirate themed restaurant.', }); // [END ex02] diff --git a/js/doc-snippets/src/models/minimal.ts b/js/doc-snippets/src/models/minimal.ts index 49834cd1f6..20984739e8 100644 --- a/js/doc-snippets/src/models/minimal.ts +++ b/js/doc-snippets/src/models/minimal.ts @@ -20,7 +20,7 @@ import { genkit } from 'genkit'; const ai = genkit({ plugins: [googleAI()], - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), }); async function main() { diff --git a/js/genkit/tests/prompts/badSchemaRef.prompt b/js/genkit/tests/prompts/badSchemaRef.prompt index 84956e4727..2eaca4930b 100644 --- a/js/genkit/tests/prompts/badSchemaRef.prompt +++ b/js/genkit/tests/prompts/badSchemaRef.prompt @@ -1,9 +1,9 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: badSchemaRef1 output: schema: badSchemaRef2 --- -doesn't matter \ No newline at end of file +doesn't matter diff --git a/js/genkit/tests/prompts/schemaRef.prompt b/js/genkit/tests/prompts/schemaRef.prompt index 3c4d37f6b1..98d154d3ca 100644 --- a/js/genkit/tests/prompts/schemaRef.prompt +++ b/js/genkit/tests/prompts/schemaRef.prompt @@ -1,9 +1,9 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: myInputSchema output: schema: myOutputSchema --- -Write a poem about {{foo}}. \ No newline at end of file +Write a poem about {{foo}}. diff --git a/js/plugins/google-genai/tests/common/utils_test.ts b/js/plugins/google-genai/tests/common/utils_test.ts index 56e6d0ade0..5ce65ddbee 100644 --- a/js/plugins/google-genai/tests/common/utils_test.ts +++ b/js/plugins/google-genai/tests/common/utils_test.ts @@ -55,15 +55,15 @@ describe('Common Utils', () => { describe('extractVersion', () => { it('should return version from modelRef if present', () => { const ref = modelRef({ - name: 'vertexai/gemini-1.5-pro', - version: 'gemini-1.5-pro-001', + name: 'vertexai/gemini-2.5-pro', + version: 'gemini-2.5-pro-001', }); - assert.strictEqual(extractVersion(ref), 'gemini-1.5-pro-001'); + assert.strictEqual(extractVersion(ref), 'gemini-2.5-pro-001'); }); it('should extract version from name if version field is missing', () => { - const ref = modelRef({ name: 'vertexai/gemini-1.5-flash' }); - assert.strictEqual(extractVersion(ref), 'gemini-1.5-flash'); + const ref = modelRef({ name: 'vertexai/gemini-2.5-flash' }); + assert.strictEqual(extractVersion(ref), 'gemini-2.5-flash'); }); it('should work with embedderRef', () => { @@ -75,12 +75,12 @@ describe('Common Utils', () => { describe('modelName', () => { it('extracts model name from a full path', () => { assert.strictEqual( - modelName('models/googleai/gemini-1.5-pro'), - 'gemini-1.5-pro' + modelName('models/googleai/gemini-2.5-pro'), + 'gemini-2.5-pro' ); assert.strictEqual( - modelName('vertexai/gemini-1.5-flash'), - 'gemini-1.5-flash' + modelName('vertexai/gemini-2.5-flash'), + 'gemini-2.5-flash' ); assert.strictEqual(modelName('model/foo'), 'foo'); assert.strictEqual(modelName('embedders/bar'), 'bar'); @@ -102,8 +102,8 @@ describe('Common Utils', () => { describe('checkModelName', () => { it('extracts model name from a full path', () => { - const name = 'models/vertexai/gemini-1.5-pro'; - assert.strictEqual(checkModelName(name), 'gemini-1.5-pro'); + const name = 'models/vertexai/gemini-2.5-pro'; + assert.strictEqual(checkModelName(name), 'gemini-2.5-pro'); }); it('returns name if no prefix', () => { diff --git a/js/plugins/google-genai/tests/googleai/client_test.ts b/js/plugins/google-genai/tests/googleai/client_test.ts index 44100f97ca..37e67675a6 100644 --- a/js/plugins/google-genai/tests/googleai/client_test.ts +++ b/js/plugins/google-genai/tests/googleai/client_test.ts @@ -108,12 +108,12 @@ describe('Google AI Client', () => { it('should build URL with resourceMethod', () => { const url = getGoogleAIUrl({ - resourcePath: 'models/gemini-2.0-pro', + resourcePath: 'models/gemini-2.5-pro', resourceMethod: 'generateContent', }); assert.strictEqual( url, - `${defaultBaseUrl}/${defaultApiVersion}/models/gemini-2.0-pro:generateContent` + `${defaultBaseUrl}/${defaultApiVersion}/models/gemini-2.5-pro:generateContent` ); }); @@ -164,7 +164,7 @@ describe('Google AI Client', () => { describe('listModels', () => { it('should return a list of models', async () => { const mockModels: Model[] = [ - { name: 'models/gemini-2.0-pro' } as Model, + { name: 'models/gemini-2.5-pro' } as Model, { name: 'models/gemini-2.5-flash' } as Model, ]; mockFetchResponse({ models: mockModels }); @@ -242,7 +242,7 @@ describe('Google AI Client', () => { }); describe('generateContent', () => { - const model = 'gemini-2.0-pro'; + const model = 'gemini-2.5-pro'; const request: GenerateContentRequest = { contents: [{ role: 'user', parts: [{ text: 'hello' }] }], }; diff --git a/js/plugins/google-genai/tests/googleai/gemini_test.ts b/js/plugins/google-genai/tests/googleai/gemini_test.ts index 965b3b5f1f..2c9ef9f8a4 100644 --- a/js/plugins/google-genai/tests/googleai/gemini_test.ts +++ b/js/plugins/google-genai/tests/googleai/gemini_test.ts @@ -105,12 +105,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); @@ -125,7 +125,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]; @@ -136,7 +136,7 @@ describe('Google AI Gemini', () => { }); it('throws if apiKey is false and not in call config', async () => { - const model = defineModel('gemini-2.0-flash', { apiKey: false }); + const model = defineModel('gemini-2.5-flash', { apiKey: false }); await assert.rejects( model.run(minimalRequest), /GoogleAI plugin was initialized with \{apiKey: false\}/ @@ -145,7 +145,7 @@ describe('Google AI Gemini', () => { }); 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, @@ -289,7 +289,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), @@ -298,7 +298,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/); }); @@ -317,7 +317,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, }); @@ -331,7 +331,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 b38270c50e..3571f0e0f5 100644 --- a/js/plugins/google-genai/tests/googleai/index_test.ts +++ b/js/plugins/google-genai/tests/googleai/index_test.ts @@ -213,7 +213,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, @@ -367,15 +367,15 @@ describe('GoogleAI Plugin', () => { }); it('should handle names with googleai/ prefix', () => { - const modelName = 'googleai/gemini-2.0-pro'; + const modelName = 'googleai/gemini-2.5-pro'; const modelRef = googleAI.model(modelName); assert.strictEqual(modelRef.name, modelName); }); it('should handle names with models/ prefix', () => { - const modelName = 'models/gemini-2.0-pro'; + const modelName = 'models/gemini-2.5-pro'; const modelRef = googleAI.model(modelName); - assert.strictEqual(modelRef.name, 'googleai/gemini-2.0-pro'); + assert.strictEqual(modelRef.name, 'googleai/gemini-2.5-pro'); }); }); @@ -487,7 +487,7 @@ describe('GoogleAI Plugin', () => { it('should filter out deprecated models', async () => { const mockModels = [ { - name: 'models/gemini-1.5-flash', + name: 'models/gemini-2.5-flash', supportedGenerationMethods: ['generateContent'], }, { @@ -517,7 +517,7 @@ describe('GoogleAI Plugin', () => { const plugin = googleAI(); const actions = await plugin.list!(); const actionNames = actions.map((a) => a.name); - assert.deepStrictEqual(actionNames, ['googleai/gemini-1.5-flash']); + assert.deepStrictEqual(actionNames, ['googleai/gemini-2.5-flash']); }); it('should handle fetch errors gracefully', async () => { diff --git a/js/plugins/google-genai/tests/vertexai/client_test.ts b/js/plugins/google-genai/tests/vertexai/client_test.ts index f5b1050d52..ecb4fdca3f 100644 --- a/js/plugins/google-genai/tests/vertexai/client_test.ts +++ b/js/plugins/google-genai/tests/vertexai/client_test.ts @@ -135,13 +135,13 @@ describe('Vertex AI Client', () => { it('should build URL for generateContent', () => { const url = getVertexAIUrl({ includeProjectAndLocation: true, - resourcePath: 'publishers/google/models/gemini-2.0-pro', + resourcePath: 'publishers/google/models/gemini-2.5-pro', resourceMethod: 'generateContent', clientOptions: opts, }); assert.strictEqual( url, - 'https://us-east1-aiplatform.googleapis.com/v1beta1/projects/test-proj/locations/us-east1/publishers/google/models/gemini-2.0-pro:generateContent' + 'https://us-east1-aiplatform.googleapis.com/v1beta1/projects/test-proj/locations/us-east1/publishers/google/models/gemini-2.5-pro:generateContent' ); }); @@ -288,13 +288,13 @@ describe('Vertex AI Client', () => { it('should build URL for generateContent', () => { const url = getVertexAIUrl({ includeProjectAndLocation: true, - resourcePath: 'publishers/google/models/gemini-2.0-pro', + resourcePath: 'publishers/google/models/gemini-2.5-pro', resourceMethod: 'generateContent', clientOptions: opts, }); assert.strictEqual( url, - 'https://aiplatform.googleapis.com/v1beta1/projects/test-proj/locations/global/publishers/google/models/gemini-2.0-pro:generateContent' + 'https://aiplatform.googleapis.com/v1beta1/projects/test-proj/locations/global/publishers/google/models/gemini-2.5-pro:generateContent' ); }); }); @@ -340,13 +340,13 @@ describe('Vertex AI Client', () => { it('should build URL for generateContent', () => { const url = getVertexAIUrl({ includeProjectAndLocation: true, // This is ignored for express - resourcePath: 'publishers/google/models/gemini-2.0-pro', + resourcePath: 'publishers/google/models/gemini-2.5-pro', resourceMethod: 'generateContent', clientOptions: opts, }); assert.strictEqual( url, - 'https://aiplatform.googleapis.com/v1beta1/publishers/google/models/gemini-2.0-pro:generateContent' + 'https://aiplatform.googleapis.com/v1beta1/publishers/google/models/gemini-2.5-pro:generateContent' ); }); @@ -490,7 +490,7 @@ describe('Vertex AI Client', () => { if (!isExpress) { it('should return a list of models', async () => { const mockModels: Model[] = [ - { name: 'gemini-2.0-pro', launchStage: 'GA' }, + { name: 'gemini-2.5-pro', launchStage: 'GA' }, ]; mockFetchResponse({ publisherModels: mockModels }); @@ -523,7 +523,7 @@ describe('Vertex AI Client', () => { const request: GenerateContentRequest = { contents: [{ role: 'user', parts: [{ text: 'hello' }] }], }; - const model = 'gemini-2.0-pro'; + const model = 'gemini-2.5-pro'; const tunedModel = 'endpoints/123456789'; it('should return GenerateContentResponse for published model', async () => { diff --git a/js/plugins/google-genai/tests/vertexai/gemini_test.ts b/js/plugins/google-genai/tests/vertexai/gemini_test.ts index 0353c49559..7757d7a2e9 100644 --- a/js/plugins/google-genai/tests/vertexai/gemini_test.ts +++ b/js/plugins/google-genai/tests/vertexai/gemini_test.ts @@ -123,7 +123,7 @@ describe('Vertex 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: ModelReference = model(name); assert.strictEqual(modelRef.name, `vertexai/${name}`); assert.ok(modelRef.info?.supports?.multiturn); @@ -141,7 +141,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); @@ -580,8 +580,8 @@ describe('Vertex AI Gemini', () => { describe('defineModel - Regional Client', () => { runCommonTests(defaultRegionalClientOptions); - it('handles googleSearchRetrieval tool for gemini-1.5', async () => { - const model = defineModel('gemini-1.5-pro', defaultRegionalClientOptions); + it('handles googleSearchRetrieval tool for gemini-2.5', async () => { + const model = defineModel('gemini-2.5-pro', defaultRegionalClientOptions); mockFetchResponse(defaultApiResponse); const request: GenerateRequest = { ...minimalRequest, diff --git a/js/plugins/google-genai/tests/vertexai/index_test.ts b/js/plugins/google-genai/tests/vertexai/index_test.ts index 2e11e89f44..838a7beb13 100644 --- a/js/plugins/google-genai/tests/vertexai/index_test.ts +++ b/js/plugins/google-genai/tests/vertexai/index_test.ts @@ -185,7 +185,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, @@ -354,7 +354,7 @@ describe('VertexAI Plugin', () => { }); it('should use auth token for Gemini generateContent', async () => { - const modelRef = vertexAI.model('gemini-1.5-flash'); + const modelRef = vertexAI.model('gemini-2.5-flash'); const generateAction = await ai.registry.lookupAction( '/model/' + modelRef.name ); @@ -442,7 +442,7 @@ describe('VertexAI Plugin', () => { }); it('should use API key for Gemini generateContent', async () => { - const modelRef = vertexAI.model('gemini-1.5-flash'); + const modelRef = vertexAI.model('gemini-2.5-flash'); const generateAction = await ai.registry.lookupAction( '/model/' + modelRef.name ); @@ -473,7 +473,7 @@ describe('VertexAI Plugin', () => { assert.ok(!url.includes('?key=test-api-key')); assert.ok( url.includes('aiplatform.googleapis.com') && - !url.includes('us-central1-') + !url.includes('us-central1-') ); }); @@ -537,7 +537,7 @@ describe('VertexAI Plugin', () => { }); it('should use API key for Gemini generateContent', async () => { - const modelRef = vertexAI.model('gemini-1.5-flash'); + const modelRef = vertexAI.model('gemini-2.5-flash'); const generateAction = await ai.registry.lookupAction( '/model/' + modelRef.name ); @@ -568,7 +568,7 @@ describe('VertexAI Plugin', () => { assert.ok(!url.includes('test-express-api-key')); assert.ok( url.includes('aiplatform.googleapis.com') && - !url.includes('us-central1-') + !url.includes('us-central1-') ); }); diff --git a/js/plugins/googleai/README.md b/js/plugins/googleai/README.md index 5342d19804..021ab8f946 100644 --- a/js/plugins/googleai/README.md +++ b/js/plugins/googleai/README.md @@ -14,7 +14,7 @@ import { googleAI, gemini } from '@genkit-ai/googleai'; const ai = genkit({ plugins: [googleAI()], - model: gemini('gemini-1.5-flash'), + model: gemini('gemini-2.5-flash'), }); async () => { diff --git a/js/plugins/googleai/tests/gemini_test.ts b/js/plugins/googleai/tests/gemini_test.ts index 658adc7d90..df63aeec19 100644 --- a/js/plugins/googleai/tests/gemini_test.ts +++ b/js/plugins/googleai/tests/gemini_test.ts @@ -562,15 +562,15 @@ describe('plugin', () => { }); const pro = await ai.registry.lookupAction( - `/model/${gemini('gemini-1.5-pro').name}` + `/model/${gemini('gemini-2.5-pro').name}` ); assert.ok(pro); - assert.strictEqual(pro.__action.name, 'googleai/gemini-1.5-pro'); + assert.strictEqual(pro.__action.name, 'googleai/gemini-2.5-pro'); const flash = await ai.registry.lookupAction( - `/model/${gemini('gemini-1.5-flash').name}` + `/model/${gemini('gemini-2.5-flash').name}` ); assert.ok(flash); - assert.strictEqual(flash.__action.name, 'googleai/gemini-1.5-flash'); + assert.strictEqual(flash.__action.name, 'googleai/gemini-2.5-flash'); }); it('references dynamic models', async () => { @@ -592,35 +592,35 @@ describe('plugin', () => { }); it('references pre-registered models', async () => { - const flash002Ref = gemini('gemini-1.5-flash-002'); + const flash002Ref = gemini('gemini-2.5-flash-002'); const ai = genkit({ plugins: [ googleAI({ - models: ['gemini-1.5-pro-002', flash002Ref, 'gemini-4.0-banana'], + models: ['gemini-2.5-pro-002', flash002Ref, 'gemini-4.0-banana'], }), ], }); - const pro002Ref = gemini('gemini-1.5-pro-002'); - assert.strictEqual(pro002Ref.name, 'googleai/gemini-1.5-pro-002'); + const pro002Ref = gemini('gemini-2.5-pro-002'); + assert.strictEqual(pro002Ref.name, 'googleai/gemini-2.5-pro-002'); assertEqualModelInfo( pro002Ref.info!, - 'Google AI - gemini-1.5-pro-002', + 'Google AI - gemini-2.5-pro-002', gemini15Pro.info! ); const pro002 = await ai.registry.lookupAction(`/model/${pro002Ref.name}`); assert.ok(pro002); - assert.strictEqual(pro002.__action.name, 'googleai/gemini-1.5-pro-002'); + assert.strictEqual(pro002.__action.name, 'googleai/gemini-2.5-pro-002'); assertEqualModelInfo( pro002.__action.metadata?.model, - 'Google AI - gemini-1.5-pro-002', + 'Google AI - gemini-2.5-pro-002', gemini15Pro.info! ); - assert.strictEqual(flash002Ref.name, 'googleai/gemini-1.5-flash-002'); + assert.strictEqual(flash002Ref.name, 'googleai/gemini-2.5-flash-002'); assertEqualModelInfo( flash002Ref.info!, - 'Google AI - gemini-1.5-flash-002', + 'Google AI - gemini-2.5-flash-002', gemini15Flash.info! ); const flash002 = await ai.registry.lookupAction( @@ -629,11 +629,11 @@ describe('plugin', () => { assert.ok(flash002); assert.strictEqual( flash002.__action.name, - 'googleai/gemini-1.5-flash-002' + 'googleai/gemini-2.5-flash-002' ); assertEqualModelInfo( flash002.__action.metadata?.model, - 'Google AI - gemini-1.5-flash-002', + 'Google AI - gemini-2.5-flash-002', gemini15Flash.info! ); diff --git a/js/plugins/mcp/README.md b/js/plugins/mcp/README.md index 5240691dc4..34b4f23113 100644 --- a/js/plugins/mcp/README.md +++ b/js/plugins/mcp/README.md @@ -3,6 +3,7 @@ See [Genkit MCP documentation](https://genkit.dev/docs/model-context-protocol/). This plugin provides integration between Genkit and the [Model Context Protocol](https://modelcontextprotocol.io) (MCP). MCP is an open standard allowing developers to build "servers" which provide tools, resources, and prompts to clients. Genkit MCP allows Genkit developers to: + - Consume MCP tools, prompts, and resources as a client using `createMcpHost` or `createMcpClient`. - Provide Genkit tools and prompts as an MCP server using `createMcpServer`. @@ -45,7 +46,7 @@ const ai = genkit({ (async () => { // Provide MCP tools to the model of your choice. const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: `Analyze all files in ${process.cwd()}.`, tools: await mcpHost.getActiveTools(ai), resources: await mcpHost.getActiveResources(ai), @@ -61,21 +62,20 @@ The `createMcpHost` function initializes a `GenkitMcpHost` instance, which handl ### `createMcpHost()` Options -- **`name`**: (optional, string) A name for the MCP host plugin itself. Defaults to 'genkitx-mcp'. -- **`version`**: (optional, string) The version of the MCP host plugin. Defaults to "1.0.0". -- **`rawToolResponses`**: (optional, boolean) When `true`, tool responses are returned in their raw MCP format; otherwise, they are processed for Genkit compatibility. Defaults to `false`. -- **`mcpServers`**: (required, object) An object where each key is a client-side name (namespace) for an MCP server, and the value is the configuration for that server. +- **`name`**: (optional, string) A name for the MCP host plugin itself. Defaults to 'genkitx-mcp'. +- **`version`**: (optional, string) The version of the MCP host plugin. Defaults to "1.0.0". +- **`rawToolResponses`**: (optional, boolean) When `true`, tool responses are returned in their raw MCP format; otherwise, they are processed for Genkit compatibility. Defaults to `false`. +- **`mcpServers`**: (required, object) An object where each key is a client-side name (namespace) for an MCP server, and the value is the configuration for that server. Each server configuration object can include: - - **`disabled`**: (optional, boolean) If `true`, this server connection will not be attempted. Defaults to `false`. - - One of the following server connection configurations: - - Parameters for launching a local server process using the stdio MCP transport. - - **`command`**: (required, string) Shell command path for launching the MCP server (e.g., `npx`, `python`). - - **`args`**: (optional, string[]) Array of string arguments to pass to the command. - - **`env`**: (optional, Record) Key-value object of environment variables. - - **`url`**: (string) The URL of a remote server to connect to using the Streamable HTTP MCP transport. - - **`transport`**: An existing MCP transport object for connecting to the server. - + - **`disabled`**: (optional, boolean) If `true`, this server connection will not be attempted. Defaults to `false`. + - One of the following server connection configurations: + - Parameters for launching a local server process using the stdio MCP transport. + - **`command`**: (required, string) Shell command path for launching the MCP server (e.g., `npx`, `python`). + - **`args`**: (optional, string[]) Array of string arguments to pass to the command. + - **`env`**: (optional, Record) Key-value object of environment variables. + - **`url`**: (string) The URL of a remote server to connect to using the Streamable HTTP MCP transport. + - **`transport`**: An existing MCP transport object for connecting to the server. ## MCP Client (Single Server) @@ -107,7 +107,7 @@ const ai = genkit({ const fsTools = await myFsClient.getActiveTools(ai); const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), // Replace with your model + model: googleAI.model('gemini-2.5-flash'), // Replace with your model prompt: 'List files in ' + process.cwd(), tools: fsTools, }); @@ -120,9 +120,10 @@ const ai = genkit({ ### `createMcpClient()` Options The `createMcpClient` function takes an `McpClientOptions` object: -- **`name`**: (required, string) A unique name for this client instance. This name will be used as the namespace for its tools and prompts. -- **`version`**: (optional, string) Version for this client instance. Defaults to "1.0.0". -- Additionally, it supports all options from `McpServerConfig` (e.g., `disabled`, `rawToolResponses`, and transport configurations), as detailed in the `createMcpHost` options section. + +- **`name`**: (required, string) A unique name for this client instance. This name will be used as the namespace for its tools and prompts. +- **`version`**: (optional, string) Version for this client instance. Defaults to "1.0.0". +- Additionally, it supports all options from `McpServerConfig` (e.g., `disabled`, `rawToolResponses`, and transport configurations), as detailed in the `createMcpHost` options section. ### Using MCP Actions (Tools, Prompts) @@ -131,6 +132,7 @@ Both `GenkitMcpHost` (via `getActiveTools()`) and `GenkitMcpClient` (via `getAct MCP prompts can be fetched using `McpHost.getPrompt(serverName, promptName)` or `mcpClient.getPrompt(promptName)`. These return an `ExecutablePrompt`. All MCP actions (tools, prompts, resources) are namespaced. + - For `createMcpHost`, the namespace is the key you provide for that server in the `mcpServers` configuration (e.g., `localFs/read_file`). - For `createMcpClient`, the namespace is the `name` you provide in its options (e.g., `myFileSystemClient/list_resources`). @@ -230,6 +232,7 @@ server.setup().then(async () => { The `createMcpServer` function returns a `GenkitMcpServer` instance. The `start()` method on this instance will start an MCP server (using the stdio transport by default) that exposes all registered Genkit tools and prompts. To start the server with a different MCP transport, you can pass the transport instance to the `start()` method (e.g., `server.start(customMcpTransport)`). ### `createMcpServer()` Options + - **`name`**: (required, string) The name you want to give your server for MCP inspection. - **`version`**: (optional, string) The version your server will advertise to clients. Defaults to "1.0.0". diff --git a/js/plugins/vertexai/tests/plugin_test.ts b/js/plugins/vertexai/tests/plugin_test.ts index 57020881b8..bb25231aa2 100644 --- a/js/plugins/vertexai/tests/plugin_test.ts +++ b/js/plugins/vertexai/tests/plugin_test.ts @@ -51,15 +51,15 @@ describe('plugin', () => { }); const pro = await ai.registry.lookupAction( - `/model/${gemini('gemini-1.5-pro').name}` + `/model/${gemini('gemini-2.5-pro').name}` ); assert.ok(pro); - assert.strictEqual(pro.__action.name, 'vertexai/gemini-1.5-pro'); + assert.strictEqual(pro.__action.name, 'vertexai/gemini-2.5-pro'); const flash = await ai.registry.lookupAction( - `/model/${gemini('gemini-1.5-flash').name}` + `/model/${gemini('gemini-2.5-flash').name}` ); assert.ok(flash); - assert.strictEqual(flash.__action.name, 'vertexai/gemini-1.5-flash'); + assert.strictEqual(flash.__action.name, 'vertexai/gemini-2.5-flash'); }); it('references dynamic models', async () => { @@ -79,46 +79,46 @@ describe('plugin', () => { }); it('references pre-registered models', async () => { - const flash002Ref = gemini('gemini-1.5-flash-002'); + const flash002Ref = gemini('gemini-2.5-flash-002'); const ai = genkit({ plugins: [ vertexAI({ location: 'us-central1', - models: ['gemini-1.5-pro-002', flash002Ref, 'gemini-4.0-banana'], + models: ['gemini-2.5-pro-002', flash002Ref, 'gemini-4.0-banana'], }), ], }); - const pro002Ref = gemini('gemini-1.5-pro-002'); - assert.strictEqual(pro002Ref.name, 'vertexai/gemini-1.5-pro-002'); + const pro002Ref = gemini('gemini-2.5-pro-002'); + assert.strictEqual(pro002Ref.name, 'vertexai/gemini-2.5-pro-002'); assertEqualModelInfo( pro002Ref.info!, - 'Vertex AI - gemini-1.5-pro-002', + 'Vertex AI - gemini-2.5-pro-002', gemini15Pro.info! ); const pro002 = await ai.registry.lookupAction(`/model/${pro002Ref.name}`); assert.ok(pro002); - assert.strictEqual(pro002.__action.name, 'vertexai/gemini-1.5-pro-002'); + assert.strictEqual(pro002.__action.name, 'vertexai/gemini-2.5-pro-002'); assertEqualModelInfo( pro002.__action.metadata?.model, - 'Vertex AI - gemini-1.5-pro-002', + 'Vertex AI - gemini-2.5-pro-002', gemini15Pro.info! ); - assert.strictEqual(flash002Ref.name, 'vertexai/gemini-1.5-flash-002'); + assert.strictEqual(flash002Ref.name, 'vertexai/gemini-2.5-flash-002'); assertEqualModelInfo( flash002Ref.info!, - 'Vertex AI - gemini-1.5-flash-002', + 'Vertex AI - gemini-2.5-flash-002', gemini15Flash.info! ); const flash002 = await ai.registry.lookupAction( `/model/${flash002Ref.name}` ); assert.ok(flash002); - assert.strictEqual(flash002.__action.name, 'vertexai/gemini-1.5-flash-002'); + assert.strictEqual(flash002.__action.name, 'vertexai/gemini-2.5-flash-002'); assertEqualModelInfo( flash002.__action.metadata?.model, - 'Vertex AI - gemini-1.5-flash-002', + 'Vertex AI - gemini-2.5-flash-002', gemini15Flash.info! ); diff --git a/js/testapps/dev-ui-gallery/prompts/code.prompt b/js/testapps/dev-ui-gallery/prompts/code.prompt index 231bfcf249..5de2f2b927 100644 --- a/js/testapps/dev-ui-gallery/prompts/code.prompt +++ b/js/testapps/dev-ui-gallery/prompts/code.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-2.0-flash +model: googleai/gemini-2.5-flash config: temperature: 0.4 safetySettings: diff --git a/js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt b/js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt index a88163bb5e..fa139e9cd9 100644 --- a/js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt +++ b/js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: firstName: string diff --git a/js/testapps/dev-ui-gallery/prompts/hello.history.prompt b/js/testapps/dev-ui-gallery/prompts/hello.history.prompt index 31f7468b27..3fffa09663 100644 --- a/js/testapps/dev-ui-gallery/prompts/hello.history.prompt +++ b/js/testapps/dev-ui-gallery/prompts/hello.history.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash config: maxOutputTokens: 2048 temperature: 0.6 diff --git a/js/testapps/dev-ui-gallery/prompts/hello.json-output.prompt b/js/testapps/dev-ui-gallery/prompts/hello.json-output.prompt index 60483c339d..909984f2f6 100644 --- a/js/testapps/dev-ui-gallery/prompts/hello.json-output.prompt +++ b/js/testapps/dev-ui-gallery/prompts/hello.json-output.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: name: string diff --git a/js/testapps/dev-ui-gallery/prompts/hello.prompt b/js/testapps/dev-ui-gallery/prompts/hello.prompt index 6e0c4631a5..26da699a08 100644 --- a/js/testapps/dev-ui-gallery/prompts/hello.prompt +++ b/js/testapps/dev-ui-gallery/prompts/hello.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash config: maxOutputTokens: 2048 temperature: 0.6 diff --git a/js/testapps/dev-ui-gallery/prompts/hello.system.prompt b/js/testapps/dev-ui-gallery/prompts/hello.system.prompt index daf1ef1d5e..9da24dbd3b 100644 --- a/js/testapps/dev-ui-gallery/prompts/hello.system.prompt +++ b/js/testapps/dev-ui-gallery/prompts/hello.system.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash config: maxOutputTokens: 2048 temperature: 0.6 diff --git a/js/testapps/dev-ui-gallery/prompts/markdown.prompt b/js/testapps/dev-ui-gallery/prompts/markdown.prompt index 492bb26a92..d7c713d49e 100644 --- a/js/testapps/dev-ui-gallery/prompts/markdown.prompt +++ b/js/testapps/dev-ui-gallery/prompts/markdown.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-2.0-flash +model: googleai/gemini-2.5-flash config: temperature: 0.4 safetySettings: diff --git a/js/testapps/dev-ui-gallery/prompts/tools/weather.prompt b/js/testapps/dev-ui-gallery/prompts/tools/weather.prompt index 4a55dac664..0f806935eb 100644 --- a/js/testapps/dev-ui-gallery/prompts/tools/weather.prompt +++ b/js/testapps/dev-ui-gallery/prompts/tools/weather.prompt @@ -1,5 +1,5 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash config: maxOutputTokens: 2048 temperature: 0.6 diff --git a/js/testapps/flow-simple-ai/prompts/TellJoke.prompt b/js/testapps/flow-simple-ai/prompts/TellJoke.prompt index 1865390c79..3e8f95d7bf 100644 --- a/js/testapps/flow-simple-ai/prompts/TellJoke.prompt +++ b/js/testapps/flow-simple-ai/prompts/TellJoke.prompt @@ -1,7 +1,7 @@ --- -model: googleai/gemini-1.5-flash +model: googleai/gemini-2.5-flash input: schema: subject: string --- -Tell a joke about {subject} \ No newline at end of file +Tell a joke about {subject} diff --git a/js/testapps/flow-simple-ai/prompts/dotpromptContext.prompt b/js/testapps/flow-simple-ai/prompts/dotpromptContext.prompt index f3ead5bb32..dfd26ae22f 100644 --- a/js/testapps/flow-simple-ai/prompts/dotpromptContext.prompt +++ b/js/testapps/flow-simple-ai/prompts/dotpromptContext.prompt @@ -1,5 +1,5 @@ --- -model: vertexai/gemini-2.0-flash +model: vertexai/gemini-2.5-flash input: schema: question: string @@ -14,4 +14,4 @@ output: You are a mystic wisdom bot designed to help people with their problems. Use the provided sayings to answer the question. -Question: {{question}} \ No newline at end of file +Question: {{question}} diff --git a/js/testapps/flow-simple-ai/src/index.ts b/js/testapps/flow-simple-ai/src/index.ts index 45ffc25680..53da543708 100644 --- a/js/testapps/flow-simple-ai/src/index.ts +++ b/js/testapps/flow-simple-ai/src/index.ts @@ -152,7 +152,7 @@ export const streamFlowVertex = ai.defineFlow( }, async (prompt, { sendChunk }) => { const { response, stream } = ai.generateStream({ - model: vertexAI.model('gemini-2.0-flash-001', { temperature: 0.77 }), + model: vertexAI.model('gemini-2.5-flash', { temperature: 0.77 }), prompt, }); @@ -172,7 +172,7 @@ export const streamFlowGemini = ai.defineFlow( }, async (prompt, { sendChunk }) => { const { response, stream } = ai.generateStream({ - model: googleAI.model('gemini-2.0-flash-001', { temperature: 0.77 }), + model: googleAI.model('gemini-2.5-flash', { temperature: 0.77 }), prompt, }); @@ -208,7 +208,7 @@ export const streamJsonFlow = ai.defineFlow( }, async (count, { sendChunk }) => { const { response, stream } = ai.generateStream({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), output: { schema: GameCharactersSchema, }, @@ -510,7 +510,7 @@ export const dynamicToolCaller = ai.defineFlow( ); const { response, stream } = ai.generateStream({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), config: { temperature: 1, }, @@ -905,7 +905,7 @@ ai.defineFlow( }, async ({ url, prompt, model }) => { const { text } = await ai.generate({ - model: model || 'googleai/gemini-2.0-flash', + model: model || 'googleai/gemini-2.5-flash', prompt: [{ text: prompt }, { media: { url, contentType: 'video/mp4' } }], }); return text; @@ -914,7 +914,7 @@ ai.defineFlow( ai.defineFlow('geminiImages', async (_, { sendChunk }) => { const { response, stream } = ai.generateStream({ - model: googleAI.model('gemini-2.0-flash-preview-image-generation'), + model: googleAI.model('gemini-2.5-flash-image'), prompt: `generate an image of a banana riding a bicycle`, config: { responseModalities: ['TEXT', 'IMAGE'], @@ -1043,14 +1043,14 @@ ai.defineFlow( .string() .default( "Genkit (pronounced as Gen Kit). here's the dialog:\n\n" + - 'Speaker1: "Genkit is an amazing Gen AI **library**!"\n' + - 'Speaker2: "Library? I thought it was a **framework**."\n' + - 'Speaker1: "No, it\'s definitely a library. You just import components and use functions. It\'s a toolkit, not a prescriptive structure for your whole app."\n' + - 'Speaker2: "But it defines how you *structure* your Gen AI application. It has its own lifecycle, handles models and prompts. You build *on top* of it, which is framework-like."\n' + - "Speaker1: \"It doesn't dictate your *entire* app's architecture. You can use it for just one feature. Like NumPy, it's powerful functions, not an overall design.\"\n" + - 'Speaker2: "Yet it orchestrates your Gen AI pipeline, managing things from data to output. That\'s more than just functions; it\'s an integrated system, providing the structure and conventions. That sounds like a framework."\n' + - 'Speaker1: "It\'s an opinionated library then, or a specialized toolkit."\n' + - 'Speaker2: "And that is why the line often blurs."' + 'Speaker1: "Genkit is an amazing Gen AI **library**!"\n' + + 'Speaker2: "Library? I thought it was a **framework**."\n' + + 'Speaker1: "No, it\'s definitely a library. You just import components and use functions. It\'s a toolkit, not a prescriptive structure for your whole app."\n' + + 'Speaker2: "But it defines how you *structure* your Gen AI application. It has its own lifecycle, handles models and prompts. You build *on top* of it, which is framework-like."\n' + + "Speaker1: \"It doesn't dictate your *entire* app's architecture. You can use it for just one feature. Like NumPy, it's powerful functions, not an overall design.\"\n" + + 'Speaker2: "Yet it orchestrates your Gen AI pipeline, managing things from data to output. That\'s more than just functions; it\'s an integrated system, providing the structure and conventions. That sounds like a framework."\n' + + 'Speaker1: "It\'s an opinionated library then, or a specialized toolkit."\n' + + 'Speaker2: "And that is why the line often blurs."' ), outputSchema: z.void(), }, @@ -1116,7 +1116,7 @@ async function saveWaveFile( ai.defineFlow('googleSearch', async (thing) => { const { text } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: `What is a banana?`, config: { tools: [{ googleSearch: {} }] }, }); @@ -1126,7 +1126,7 @@ ai.defineFlow('googleSearch', async (thing) => { ai.defineFlow('googleSearchRetrieval', async (thing) => { const { text } = await ai.generate({ - model: vertexAI.model('gemini-2.0-flash'), + model: vertexAI.model('gemini-2.5-flash'), prompt: `What is a banana?`, config: { googleSearchRetrieval: {} }, }); @@ -1148,7 +1148,7 @@ ai.defineFlow('googleai-imagen', async (thing) => { ai.defineFlow('meme-of-the-day', async () => { const { text: script } = await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: 'Write a detailed script for a 8 second video. The video should be a meme of the day. ' + 'A Silly DIY FAIL situation like a: broken tools, or bad weather or crooked assembly, etc. Be creative. The FAIL should be very obvious. ' + @@ -1270,7 +1270,7 @@ ai.defineResource( ai.defineFlow('resource', async () => { return await ai.generate({ - model: googleAI.model('gemini-2.0-flash'), + model: googleAI.model('gemini-2.5-flash'), prompt: [ { text: 'analyze this: ' }, { resource: { uri: 'my://resource/value' } }, diff --git a/js/testapps/format-tester/src/index.ts b/js/testapps/format-tester/src/index.ts index c8ef88c016..6056e689b6 100644 --- a/js/testapps/format-tester/src/index.ts +++ b/js/testapps/format-tester/src/index.ts @@ -150,11 +150,10 @@ for (const format in prompts) { let models = process.argv.slice(2); if (!models.length) { models = [ - 'vertexai/gemini-1.5-pro', - 'vertexai/gemini-1.5-flash', - 'googleai/gemini-1.5-pro', - 'googleai/gemini-1.5-flash', - 'googleai/gemini-2.0-flash', + 'vertexai/gemini-2.5-pro', + 'vertexai/gemini-2.5-flash', + 'googleai/gemini-2.5-pro', + 'googleai/gemini-2.5-flash', ]; } From 7714c06a877185233e0f5c9ba2523bb0e34bf8fb Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Fri, 31 Oct 2025 00:53:51 +0000 Subject: [PATCH 2/3] pretty --- js/ai/src/model-types.ts | 2 +- js/core/src/registry.ts | 2 +- .../google-genai/tests/vertexai/index_test.ts | 4 ++-- js/plugins/vertexai/src/common/utils.ts | 14 +++++++------- js/testapps/flow-simple-ai/src/index.ts | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/js/ai/src/model-types.ts b/js/ai/src/model-types.ts index 9a290a5d9c..1c49e4185f 100644 --- a/js/ai/src/model-types.ts +++ b/js/ai/src/model-types.ts @@ -175,7 +175,7 @@ export const GenerationCommonConfigSchema = z .string() .describe( 'A specific version of a model family, e.g. `gemini-2.5-flash` ' + - 'for the `googleai` family.' + 'for the `googleai` family.' ) .optional(), temperature: z diff --git a/js/core/src/registry.ts b/js/core/src/registry.ts index b2f8b81219..10f4e5eeb5 100644 --- a/js/core/src/registry.ts +++ b/js/core/src/registry.ts @@ -224,7 +224,7 @@ export class Registry { if ( parsedKey?.dynamicActionHost && this.actionsById[ - `/dynamic-action-provider/${parsedKey.dynamicActionHost}` + `/dynamic-action-provider/${parsedKey.dynamicActionHost}` ] ) { // If it's a dynamic action provider, get the dynamic action. diff --git a/js/plugins/google-genai/tests/vertexai/index_test.ts b/js/plugins/google-genai/tests/vertexai/index_test.ts index 838a7beb13..365eae023f 100644 --- a/js/plugins/google-genai/tests/vertexai/index_test.ts +++ b/js/plugins/google-genai/tests/vertexai/index_test.ts @@ -473,7 +473,7 @@ describe('VertexAI Plugin', () => { assert.ok(!url.includes('?key=test-api-key')); assert.ok( url.includes('aiplatform.googleapis.com') && - !url.includes('us-central1-') + !url.includes('us-central1-') ); }); @@ -568,7 +568,7 @@ describe('VertexAI Plugin', () => { assert.ok(!url.includes('test-express-api-key')); assert.ok( url.includes('aiplatform.googleapis.com') && - !url.includes('us-central1-') + !url.includes('us-central1-') ); }); diff --git a/js/plugins/vertexai/src/common/utils.ts b/js/plugins/vertexai/src/common/utils.ts index 2a56f75cbd..defb475f87 100644 --- a/js/plugins/vertexai/src/common/utils.ts +++ b/js/plugins/vertexai/src/common/utils.ts @@ -51,13 +51,13 @@ export function modelName(name?: string): string | undefined { // Remove any of these prefixes: const escapedPrefixes = [ - 'background-model\/', - 'model\/', - 'models\/', - 'embedders\/', - 'vertex-model-garden\/', - 'vertex-rerankers\/', - 'vertexai\/', + 'background-model/', + 'model/', + 'models/', + 'embedders/', + 'vertex-model-garden/', + 'vertex-rerankers/', + 'vertexai/', ]; const prefixesToRemove = new RegExp(escapedPrefixes.join('|'), 'g'); return name.replace(prefixesToRemove, ''); diff --git a/js/testapps/flow-simple-ai/src/index.ts b/js/testapps/flow-simple-ai/src/index.ts index 53da543708..efa15f5e24 100644 --- a/js/testapps/flow-simple-ai/src/index.ts +++ b/js/testapps/flow-simple-ai/src/index.ts @@ -1043,14 +1043,14 @@ ai.defineFlow( .string() .default( "Genkit (pronounced as Gen Kit). here's the dialog:\n\n" + - 'Speaker1: "Genkit is an amazing Gen AI **library**!"\n' + - 'Speaker2: "Library? I thought it was a **framework**."\n' + - 'Speaker1: "No, it\'s definitely a library. You just import components and use functions. It\'s a toolkit, not a prescriptive structure for your whole app."\n' + - 'Speaker2: "But it defines how you *structure* your Gen AI application. It has its own lifecycle, handles models and prompts. You build *on top* of it, which is framework-like."\n' + - "Speaker1: \"It doesn't dictate your *entire* app's architecture. You can use it for just one feature. Like NumPy, it's powerful functions, not an overall design.\"\n" + - 'Speaker2: "Yet it orchestrates your Gen AI pipeline, managing things from data to output. That\'s more than just functions; it\'s an integrated system, providing the structure and conventions. That sounds like a framework."\n' + - 'Speaker1: "It\'s an opinionated library then, or a specialized toolkit."\n' + - 'Speaker2: "And that is why the line often blurs."' + 'Speaker1: "Genkit is an amazing Gen AI **library**!"\n' + + 'Speaker2: "Library? I thought it was a **framework**."\n' + + 'Speaker1: "No, it\'s definitely a library. You just import components and use functions. It\'s a toolkit, not a prescriptive structure for your whole app."\n' + + 'Speaker2: "But it defines how you *structure* your Gen AI application. It has its own lifecycle, handles models and prompts. You build *on top* of it, which is framework-like."\n' + + "Speaker1: \"It doesn't dictate your *entire* app's architecture. You can use it for just one feature. Like NumPy, it's powerful functions, not an overall design.\"\n" + + 'Speaker2: "Yet it orchestrates your Gen AI pipeline, managing things from data to output. That\'s more than just functions; it\'s an integrated system, providing the structure and conventions. That sounds like a framework."\n' + + 'Speaker1: "It\'s an opinionated library then, or a specialized toolkit."\n' + + 'Speaker2: "And that is why the line often blurs."' ), outputSchema: z.void(), }, From 0dc04070836903412257b838cc83d1b16bdcee23 Mon Sep 17 00:00:00 2001 From: Hugo Aguirre Parra Date: Fri, 31 Oct 2025 20:07:18 +0000 Subject: [PATCH 3/3] fix imports --- js/plugins/googleai/tests/gemini_test.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/plugins/googleai/tests/gemini_test.ts b/js/plugins/googleai/tests/gemini_test.ts index df63aeec19..f61466d949 100644 --- a/js/plugins/googleai/tests/gemini_test.ts +++ b/js/plugins/googleai/tests/gemini_test.ts @@ -25,8 +25,8 @@ import { cleanSchema, fromGeminiCandidate, gemini, - gemini15Flash, - gemini15Pro, + gemini25Flash, + gemini25Pro, toGeminiMessage, toGeminiSystemInstruction, toGeminiTool, @@ -552,8 +552,8 @@ describe('plugin', () => { plugins: [googleAI()], }); - assert.ok(await ai.registry.lookupAction(`/model/${gemini15Flash.name}`)); - assert.ok(await ai.registry.lookupAction(`/model/${gemini15Pro.name}`)); + assert.ok(await ai.registry.lookupAction(`/model/${gemini25Flash.name}`)); + assert.ok(await ai.registry.lookupAction(`/model/${gemini25Pro.name}`)); }); it('allow referencing models using `gemini` helper', async () => { @@ -606,7 +606,7 @@ describe('plugin', () => { assertEqualModelInfo( pro002Ref.info!, 'Google AI - gemini-2.5-pro-002', - gemini15Pro.info! + gemini25Pro.info! ); const pro002 = await ai.registry.lookupAction(`/model/${pro002Ref.name}`); assert.ok(pro002); @@ -614,14 +614,14 @@ describe('plugin', () => { assertEqualModelInfo( pro002.__action.metadata?.model, 'Google AI - gemini-2.5-pro-002', - gemini15Pro.info! + gemini25Pro.info! ); assert.strictEqual(flash002Ref.name, 'googleai/gemini-2.5-flash-002'); assertEqualModelInfo( flash002Ref.info!, 'Google AI - gemini-2.5-flash-002', - gemini15Flash.info! + gemini25Flash.info! ); const flash002 = await ai.registry.lookupAction( `/model/${flash002Ref.name}` @@ -634,7 +634,7 @@ describe('plugin', () => { assertEqualModelInfo( flash002.__action.metadata?.model, 'Google AI - gemini-2.5-flash-002', - gemini15Flash.info! + gemini25Flash.info! ); const bananaRef = gemini('gemini-4.0-banana');