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
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 @@ -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
*/
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions js/plugins/google-genai/src/googleai/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()])
Expand Down Expand Up @@ -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}`;
Expand Down
4 changes: 0 additions & 4 deletions js/plugins/google-genai/src/vertexai/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
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 @@ -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);
Expand All @@ -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];
Expand All @@ -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<typeof GeminiConfigSchema> = {
...minimalRequest,
Expand Down Expand Up @@ -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),
Expand All @@ -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/);
});
Expand All @@ -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,
});
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/google-genai/tests/googleai/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions js/plugins/google-genai/tests/vertexai/gemini_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof GeminiConfigSchema> = model(name);
assert.strictEqual(modelRef.name, `vertexai/${name}`);
assert.ok(modelRef.info?.supports?.multiturn);
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('Vertex AI Gemini', () => {
it('applies options to the ModelReference', () => {
const options = { temperature: 0.9, topK: 20 };
const modelRef: ModelReference<typeof GeminiConfigSchema> = model(
'gemini-2.0-flash',
'gemini-2.5-flash',
options
);
assert.deepStrictEqual(modelRef.config, options);
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/google-genai/tests/vertexai/index_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion js/testapps/basic-gemini/src/index-vertexai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` } },
Expand Down
19 changes: 1 addition & 18 deletions js/testapps/basic-gemini/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` } },
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion samples/js-gemini/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}` } },
Expand Down
Loading