Skip to content

Commit 6cf15e0

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent 652322e commit 6cf15e0

6 files changed

Lines changed: 46 additions & 2 deletions

genai/test/imggen-mmflash-with-txt.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const {delay} = require('./util');
2424
describe('imggen-mmflash-with-txt', async () => {
2525
it('should generate images from a text prompt', async function () {
2626
this.timeout(180000);
27-
this.retries(4);
27+
this.retries(6);
2828
await delay(this.test);
2929
const generatedFileNames = await sample.generateContent(projectId);
3030
assert(Array.isArray(generatedFileNames));

genai/tools/tools-code-exec-with-txt-local-img.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ async function generateContent(
8383

8484
return response.codeExecutionResult;
8585
}
86+
// Example response:
87+
// Win percentage when switching: 65.50%
88+
// Win percentage when not switching: 34.50%
8689
// [END googlegenaisdk_tools_code_exec_with_txt]
8790

8891
module.exports = {

genai/tools/tools-code-exec-with-txt.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ async function generateContent(
4545

4646
return response.codeExecutionResult;
4747
}
48+
// Example response:
49+
// // Code:
50+
// function fibonacci(n) {
51+
// if (n <= 0) {
52+
// return 0;
53+
// } else if (n === 1) {
54+
// return 1;
55+
// } else {
56+
// let a = 0, b = 1;
57+
// for (let i = 2; i <= n; i++) {
58+
// [a, b] = [b, a + b];
59+
// }
60+
// return b;
61+
// }
62+
// }
63+
//
64+
// const fib20 = fibonacci(20);
65+
// console.log(`fib20=${fib20}`);
66+
//
67+
// // Outcome:
68+
// // fib20=6765
69+
4870
// [END googlegenaisdk_tools_code_exec_with_txt]
4971

5072
module.exports = {

genai/tools/tools-func-desc-with-txt.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ async function generateContent(
8383

8484
return output;
8585
}
86+
// Example response:
87+
// [FunctionCall(
88+
// id=None,
89+
// name="get_album_sales",
90+
// args={
91+
// "albums": [
92+
// {"album_name": "Echoes of the Night", "copies_sold": 350000},
93+
// {"copies_sold": 120000, "album_name": "Reckless Hearts"},
94+
// {"copies_sold": 75000, "album_name": "Whispers of Dawn"},
95+
// {"copies_sold": 100000, "album_name": "Street Symphony"},
96+
// ]
97+
// },
98+
// )]
8699
// [END googlegenaisdk_tools_func_desc_with_txt]
87100

88101
module.exports = {

genai/tools/tools-google-search-with-txt.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ async function generateContent(
4646

4747
return response.text;
4848
}
49+
// Example response:
50+
// 'The next total solar eclipse in Poland will occur on ...'
4951
// [END googlegenaisdk_tools_google_search_with_txt]
5052

5153
module.exports = {

genai/tools/tools-vais-with-txt.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ async function generateContent(
3333
},
3434
});
3535

36-
const datastore = `projects/${projectId}/locations/global/collections/default_collection/dataStores/grounding-test-datastore`;
36+
const datastore =
37+
'projects/cloud-ai-devrel-softserve/locations/global/collections/default_collection/dataStores/grounding-test-datastore';
3738

39+
// const datastore = `projects/${projectId}/locations/global/collections/default_collection/dataStores/grounding-test-datastore`;
3840
const response = await ai.models.generateContent({
3941
model: 'gemini-2.5-flash',
4042
contents: "How do I make an appointment to renew my driver's license?",
@@ -55,6 +57,8 @@ async function generateContent(
5557

5658
return response.text;
5759
}
60+
// Example response:
61+
// 'The process for making an appointment to renew your driver's license varies depending on your location. To provide you with the most accurate instructions...'
5862
// [END googlegenaisdk_tools_vais_with_txt]
5963

6064
module.exports = {

0 commit comments

Comments
 (0)