Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/ai/src/model-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions js/core/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions js/doc-snippets/src/dotprompt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex01.prompt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-1.5-flash
model: googleai/gemini-2.5-flash
config:
temperature: 0.9
input:
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex02.prompt
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex03.prompt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-1.5-flash
model: googleai/gemini-2.5-flash
config:
temperature: 1.4
topK: 50
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex04.prompt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-1.5-flash
model: googleai/gemini-2.5-flash
input:
schema:
theme?: string
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex05.prompt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: googleai/gemini-1.5-flash
model: googleai/gemini-2.5-flash
input:
schema:
theme?: string
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex06.prompt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: vertexai/gemini-1.5-flash
model: vertexai/gemini-2.5-flash
input:
schema:
userQuestion: string
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/dotprompt/prompts/ex08.prompt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
model: vertexai/gemini-1.5-flash
model: vertexai/gemini-2.5-flash
input:
schema:
photoUrl: string
Expand Down
12 changes: 6 additions & 6 deletions js/doc-snippets/src/flows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 },
});
Expand All @@ -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 },
});
Expand All @@ -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.`,
});

Expand Down Expand Up @@ -128,7 +128,7 @@ export const complexMenuSuggestionFlow = ai.defineFlow(
outputSchema: PrixFixeMenuSchema,
},
async (theme: string): Promise<z.infer<typeof PrixFixeMenuSchema>> => {
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 ' +
Expand Down Expand Up @@ -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 }] }],
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions js/doc-snippets/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/models/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions js/genkit/tests/prompts/badSchemaRef.prompt
Original file line number Diff line number Diff line change
@@ -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
doesn't matter
4 changes: 2 additions & 2 deletions js/genkit/tests/prompts/schemaRef.prompt
Original file line number Diff line number Diff line change
@@ -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}}.
Write a poem about {{foo}}.
22 changes: 11 additions & 11 deletions js/plugins/google-genai/tests/common/utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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');
Expand All @@ -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', () => {
Expand Down
8 changes: 4 additions & 4 deletions js/plugins/google-genai/tests/googleai/client_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
);
});

Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -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' }] }],
};
Expand Down
18 changes: 9 additions & 9 deletions js/plugins/google-genai/tests/googleai/gemini_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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];
Expand All @@ -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\}/
Expand All @@ -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<typeof GeminiConfigSchema> = {
...minimalRequest,
Expand Down Expand Up @@ -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),
Expand All @@ -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/);
});
Expand All @@ -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,
});
Expand All @@ -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);
Expand Down
Loading
Loading