Skip to content
Merged
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
6 changes: 3 additions & 3 deletions js/ai/src/model/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const DEFAULT_FALLBACK_STATUSES: StatusName[] = [
*
* ```ts
* const { text } = await ai.generate({
* model: googleAI.model('gemini-2.5-pro'),
* model: googleAI.model('gemini-pro-latest'),
* prompt: 'You are a helpful AI assistant named Walt, say hello',
* use: [
* retry({
Expand Down Expand Up @@ -406,11 +406,11 @@ export interface FallbackOptions {
*
* ```ts
* const { text } = await ai.generate({
* model: googleAI.model('gemini-2.5-pro'),
* model: googleAI.model('gemini-pro-latest'),
* prompt: 'You are a helpful AI assistant named Walt, say hello',
* use: [
* fallback(ai, {
* models: [googleAI.model('gemini-2.5-flash')],
* models: [googleAI.model('gemini-flash-latest')],
* statuses: ['RESOURCE_EXHAUSTED'],
* }),
* ],
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-2.5-flash',
model: 'googleai/gemini-flash-latest',
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-2.5-flash',
model: 'googleai/gemini-flash-latest',
input: {
schema: z.object({
name: z.string(),
Expand Down
10 changes: 5 additions & 5 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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: `Invent a menu item for a ${restaurantTheme} themed restaurant.`,
});

Expand Down Expand Up @@ -178,7 +178,7 @@ Today's menu
}
);
const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
});

async function main() {
Expand Down
4 changes: 2 additions & 2 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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
});

async function fn01() {
// [START ex01]
const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: 'Invent a menu item for a pirate themed restaurant.',
});
// [END ex01]
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.5-flash'),
model: googleAI.model('gemini-flash-latest'),
});

async function main() {
Expand Down
2 changes: 1 addition & 1 deletion js/doc-snippets/src/multi-agent/simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const reservationTool = ai.defineTool(

// [START chat]
const chat = ai.chat({
model: googleAI.model('gemini-2.5-pro'),
model: googleAI.model('gemini-pro-latest'),
system:
"You are an AI customer service agent for Pavel's Cafe. Use the tools " +
'available to you to help the customer. If you cannot help the ' +
Expand Down
12 changes: 6 additions & 6 deletions js/genkit/src/genkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ export class Genkit implements HasRegistry {
* ```ts
* const ai = genkit({
* plugins: [googleAI()],
* model: googleAI.model('gemini-2.5-flash'), // default model
* model: googleAI.model('gemini-flash-latest'), // default model
* })
*
* const { text } = await ai.generate('hi');
Expand All @@ -697,7 +697,7 @@ export class Genkit implements HasRegistry {
* ```ts
* const ai = genkit({
* plugins: [googleAI()],
* model: googleAI.model('gemini-2.5-flash'), // default model
* model: googleAI.model('gemini-flash-latest'), // default model
* })
*
* const { text } = await ai.generate([
Expand Down Expand Up @@ -731,7 +731,7 @@ export class Genkit implements HasRegistry {
* ],
* messages: conversationHistory,
* tools: [ userInfoLookup ],
* model: googleAI.model('gemini-2.5-flash'),
* model: googleAI.model('gemini-flash-latest'),
* });
* ```
*/
Expand Down Expand Up @@ -773,7 +773,7 @@ export class Genkit implements HasRegistry {
* ```ts
* const ai = genkit({
* plugins: [googleAI()],
* model: googleAI.model('gemini-2.5-flash'), // default model
* model: googleAI.model('gemini-flash-latest'), // default model
* })
*
* const { response, stream } = ai.generateStream('hi');
Expand All @@ -793,7 +793,7 @@ export class Genkit implements HasRegistry {
* ```ts
* const ai = genkit({
* plugins: [googleAI()],
* model: googleAI.model('gemini-2.5-flash'), // default model
* model: googleAI.model('gemini-flash-latest'), // default model
* })
*
* const { response, stream } = ai.generateStream([
Expand Down Expand Up @@ -831,7 +831,7 @@ export class Genkit implements HasRegistry {
* ],
* messages: conversationHistory,
* tools: [ userInfoLookup ],
* model: googleAI.model('gemini-2.5-flash'),
* model: googleAI.model('gemini-flash-latest'),
* });
* for await (const chunk of stream) {
* console.log(chunk.text);
Expand Down
3 changes: 3 additions & 0 deletions js/plugins/google-genai/src/googleai/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ const GENERIC_GEMMA_MODEL = commonRef(
);

const KNOWN_GEMINI_MODELS = {
'gemini-pro-latest': commonRef('gemini-pro-latest'),
'gemini-flash-latest': commonRef('gemini-flash-latest'),
'gemini-flash-lite-latest': commonRef('gemini-flash-lite-latest'),
'gemini-3.1-pro-preview-customtools': commonRef(
'gemini-3.1-pro-preview-customtools'
),
Expand Down
1 change: 0 additions & 1 deletion js/plugins/vertexai/src/modelgarden/v2/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export const KNOWN_MODELS = {
'claude-opus-4-5@20251101': commonRef('claude-opus-4-5@20251101'),
'claude-opus-4-1@20250805': commonRef('claude-opus-4-1@20250805'),
'claude-opus-4@20250514': commonRef('claude-opus-4@20250514'),
'claude-3-haiku@20240307': commonRef('claude-3-haiku@20240307'),
};
export type KnownModels = keyof typeof KNOWN_MODELS;
export type AnthropicModelName = `claude-${string}`;
Expand Down
6 changes: 3 additions & 3 deletions js/plugins/vertexai/tests/modelgarden/v2/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ import { modelName as stripPrefix } from '../../../src/modelgarden/v2/utils';

describe('vertexModelGarden.model helper', () => {
it('should return an Anthropic model reference', () => {
const modelName = 'claude-3-haiku@20240307';
const modelName = 'claude-haiku-4-5@20251001';
const model = vertexModelGarden.model(modelName);
assert.ok(isAnthropicModelName(stripPrefix(model.name)));
assert.strictEqual(model.name, `vertex-model-garden/${modelName}`);
assert.deepStrictEqual(model.configSchema, AnthropicConfigSchema);
});

it('should return a Mistral model reference', () => {
const modelName = 'mistral-large-2411';
const modelName = 'mistral-medium-3';
const model = vertexModelGarden.model(modelName);
assert.ok(isMistralModelName(stripPrefix(model.name)));
assert.strictEqual(model.name, `vertex-model-garden/${modelName}`);
assert.deepStrictEqual(model.configSchema, MistralConfigSchema);
});

it('should return a Llama model reference', () => {
const modelName = 'meta/llama-3.1-8b-instruct-maas';
const modelName = 'meta/llama-4-maverick-17b-128e-instruct-maas';
const model = vertexModelGarden.model(modelName);
assert.ok(isLlamaModelName(stripPrefix(model.name)));
assert.strictEqual(model.name, `vertex-model-garden/${modelName}`);
Expand Down
35 changes: 20 additions & 15 deletions js/testapps/basic-gemini/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ai = genkit({

ai.defineFlow('basic-hi', async () => {
const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-lite-latest'),
prompt: 'You are a helpful AI assistant named Walt, say hello',
});

Expand All @@ -52,7 +52,7 @@ ai.defineFlow('basic-hi', async () => {

ai.defineFlow('basic-hi-with-retry', async () => {
const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-pro'),
model: googleAI.model('gemini-pro-latest'),
prompt: 'You are a helpful AI assistant named Walt, say hello',
use: [
retry({
Expand All @@ -71,7 +71,7 @@ ai.defineFlow('basic-hi-with-fallback', async () => {
prompt: 'You are a helpful AI assistant named Walt, say hello',
use: [
fallback(ai, {
models: [googleAI.model('gemini-2.5-flash')],
models: [googleAI.model('gemini-flash-latest')],
statuses: ['UNKNOWN'],
}),
],
Expand Down Expand Up @@ -114,7 +114,7 @@ ai.defineFlow('multimodal-input', async () => {
const photoBase64 = fs.readFileSync('photo.jpg', { encoding: 'base64' });

const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: [
{ text: 'describe this photo' },
{
Expand All @@ -132,7 +132,7 @@ ai.defineFlow('multimodal-input', async () => {
// YouTube videos
ai.defineFlow('youtube-videos', async (_, { sendChunk }) => {
const { text } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: [
{
text: 'transcribe this video',
Expand All @@ -152,7 +152,7 @@ ai.defineFlow('youtube-videos', async (_, { sendChunk }) => {
// streaming
ai.defineFlow('streaming', async (_, { sendChunk }) => {
const { stream } = ai.generateStream({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: 'Write a poem about AI.',
});

Expand All @@ -168,7 +168,7 @@ ai.defineFlow('streaming', async (_, { sendChunk }) => {
// Search grounding
ai.defineFlow('search-grounding', async () => {
const { text, raw } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: 'Who is Albert Einstein?',
config: {
tools: [{ googleSearch: {} }],
Expand All @@ -184,7 +184,7 @@ ai.defineFlow('search-grounding', async () => {
// Url context
ai.defineFlow('url-context', async () => {
const { text, raw } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt:
'Compare the ingredients and cooking times from the recipes at ' +
'https://www.foodnetwork.com/recipes/ina-garten/perfect-roast-chicken-recipe-1940592 ' +
Expand All @@ -209,7 +209,7 @@ ai.defineFlow('file-search', async () => {

// Use the file search store in your generate request
const { text, raw } = await ai.generate({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
prompt: "What is the character's name in the story?",
config: {
fileSearch: {
Expand Down Expand Up @@ -289,7 +289,7 @@ ai.defineFlow(
},
async (location, { sendChunk }) => {
const { response, stream } = ai.generateStream({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
config: {
temperature: 1,
},
Expand All @@ -314,7 +314,7 @@ ai.defineFlow(
},
async (_, { sendChunk }) => {
const { response, stream } = ai.generateStream({
model: googleAI.model('gemini-3.1-pro-preview'),
model: googleAI.model('gemini-pro-latest'),
config: {
temperature: 1,
},
Expand Down Expand Up @@ -345,7 +345,7 @@ ai.defineFlow(
},
async (location, { sendChunk }) => {
const { response, stream } = ai.generateStream({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
config: {
temperature: 1,
},
Expand Down Expand Up @@ -376,7 +376,7 @@ ai.defineFlow(
},
async (name, { sendChunk }) => {
const { response, stream } = ai.generateStream({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
config: {
temperature: 2, // we want creativity
},
Expand All @@ -392,8 +392,8 @@ ai.defineFlow(
}
);

// Gemini reasoning example.
ai.defineFlow('reasoning', async (_, { sendChunk }) => {
// Gemini reasoning example (legacy thinkingBudget)
ai.defineFlow('reasoning - thinkingBudget', async (_, { sendChunk }) => {
const { message } = await ai.generate({
prompt: 'what is heavier, one kilo of steel or one kilo of feathers',
model: googleAI.model('gemini-2.5-pro'),
Expand Down Expand Up @@ -489,6 +489,11 @@ ai.defineFlow('nano-banana-2', async (_) => {
google_search: {
searchTypes: { webSearch: {}, imageSearch: {} },
},
thinkingConfig: {
// Optional
thinkingLevel: 'HIGH',
includeThoughts: true,
},
},
});

Expand Down
4 changes: 2 additions & 2 deletions js/testapps/dev-ui-gallery/src/genkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ export const PERMISSIVE_SAFETY_SETTINGS: any = {
// a second instance, just for fun
export const ai2 = genkit({
name: 'Instance Two',
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
plugins: [googleAI()],
});

export const ai = genkit({
model: googleAI.model('gemini-2.5-flash'),
model: googleAI.model('gemini-flash-latest'),
// load at least one plugin representing each action type
plugins: [
// model providers
Expand Down
Loading