Skip to content

feat(genai): bumping version and fixing tests #4146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
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 genai/controlled-generation/ctrlgen-with-enum-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function generateContent(
};

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: 'What type of instrument is an oboe?',
config: {
responseMimeType: 'text/x.enum',
Expand Down
2 changes: 1 addition & 1 deletion genai/count-tokens/counttoken-with-txt-vid.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function countTokens(
};

const response = await ai.models.countTokens({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: [video, 'Provide a description of the video.'],
});

Expand Down
2 changes: 1 addition & 1 deletion genai/count-tokens/counttoken-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function countTokens(
});

const response = await ai.models.countTokens({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: 'What is the highest mountain in Africa?',
});

Expand Down
2 changes: 1 addition & 1 deletion genai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js test/**/*.test.js"
},
"dependencies": {
"@google/genai": "^0.13.0",
"@google/genai": "1.12.0",
"axios": "^1.6.2",
"supertest": "^7.0.0"
},
Expand Down
11 changes: 8 additions & 3 deletions genai/test/textgen-with-multi-img.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ const {describe, it} = require('mocha');
const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../text-generation/textgen-with-multi-img.js');

describe('textgen-with-multi-img', async () => {
it('should generate text content from a text prompt and multiple images', async () => {
describe('textgen-with-multi-img', () => {
it('should generate text content from a text prompt and multiple images', async function () {
this.timeout(300000);

const output = await sample.generateContent(projectId);
assert(output.length > 0 && output.includes('blueberry'));
console.log('Generated output:', output);

assert.isString(output, 'Output should be a string');
assert.isAbove(output.length, 0, 'Output should not be empty');
});
});
2 changes: 1 addition & 1 deletion genai/text-generation/textgen-sys-instr-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function generateContent(
`;

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: prompt,
config: {
systemInstruction: [
Expand Down
2 changes: 1 addition & 1 deletion genai/text-generation/textgen-with-multi-img.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ async function generateContent(
};

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: [
image1,
image2,
Expand Down
2 changes: 1 addition & 1 deletion genai/text-generation/textgen-with-txt-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function generateContent(
});

const response = await ai.models.generateContentStream({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: 'Why is the sky blue?',
});

Expand Down
2 changes: 1 addition & 1 deletion genai/text-generation/textgen-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function generateContent(
});

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: 'How does AI work?',
});

Expand Down
2 changes: 1 addition & 1 deletion genai/text-generation/textgen-with-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function generateContent(
};

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: 'gemini-2.5-flash',
contents: [video, prompt],
});

Expand Down
4 changes: 3 additions & 1 deletion genai/tools/tools-code-exec-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ async function generateContent(
location: location,
});

const MODEL_NAME = 'gemini-2.5-flash';

const response = await ai.models.generateContent({
model: 'gemini-2.5-flash-preview-05-20',
model: MODEL_NAME,
contents:
'What is the sum of the first 50 prime numbers? Generate and run code for the calculation, and make sure you get all 50.',
config: {
Expand Down
4 changes: 3 additions & 1 deletion genai/tools/tools-func-desc-with-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ async function generateContent(
trends in music consumption.
`;

const MODEL_NAME = 'gemini-2.5-flash';

const response = await ai.models.generateContent({
model: 'gemini-2.0-flash',
model: MODEL_NAME,
contents: prompt,
config: {
tools: [sales_tool],
Expand Down