Skip to content

Commit fbf04fc

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent ad1469c commit fbf04fc

File tree

7 files changed

+47
-1
lines changed

7 files changed

+47
-1
lines changed

genai/controlled-generation/ctrlgen-with-class-schema.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ async function generateContent(
5353
console.log(response.text);
5454
return response.text;
5555
}
56+
// Example output:
57+
// [Recipe(recipe_name='Chocolate Chip Cookies', ingredients=['2 1/4 cups all-purpose flour'
58+
// {
59+
// "ingredients": [
60+
// "2 1/4 cups all-purpose flour",
61+
// "1 teaspoon baking soda",
62+
// "1 teaspoon salt",
63+
// "1 cup (2 sticks) unsalted butter, softened",
64+
// "3/4 cup granulated sugar",
65+
// "3/4 cup packed brown sugar",
66+
// "1 teaspoon vanilla extract",
67+
// "2 large eggs",
68+
// "2 cups chocolate chips"
69+
// ],
70+
// "recipe_name": "Classic Chocolate Chip Cookies"
71+
// }, ... ]
5672
// [END googlegenaisdk_ctrlgen_with_class_schema]
5773

5874
module.exports = {

genai/controlled-generation/ctrlgen-with-enum-class-schema.js

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

6767
return response.text;
6868
}
69+
// Example output:
70+
// String
6971
// [END googlegenaisdk_ctrlgen_with_enum_class_schema]
7072

7173
module.exports = {

genai/controlled-generation/ctrlgen-with-enum-schema.js

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

4949
return response.text;
5050
}
51+
// Example output:
52+
// Woodwind
5153
// [END googlegenaisdk_ctrlgen_with_enum_schema]
5254

5355
module.exports = {

genai/controlled-generation/ctrlgen-with-nested-class-schema.js

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

6868
return response.text;
6969
}
70+
// Example output:
71+
// [{"rating": "a+", "recipe_name": "Classic Chocolate Chip Cookies"}, ...]
7072
// [END googlegenaisdk_ctrlgen_with_nested_class_schema]
7173

7274
module.exports = {

genai/controlled-generation/ctrlgen-with-nullable-schema.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ async function generateContent(
7373

7474
return response.text;
7575
}
76+
// Example output:
77+
// {"forecast": [{"Day": "Sunday", "Forecast": "sunny", "Temperature": 77, "Wind Speed": 10, "Humidity": "50%"},
78+
// {"Day": "Monday", "Forecast": "partly cloudy", "Temperature": 72, "Wind Speed": 15},
79+
// {"Day": "Tuesday", "Forecast": "rain showers", "Temperature": 64, "Wind Speed": null, "Humidity": "70%"},
80+
// {"Day": "Wednesday", "Forecast": "thunderstorms", "Temperature": 68, "Wind Speed": null},
81+
// {"Day": "Thursday", "Forecast": "cloudy", "Temperature": 66, "Wind Speed": null, "Humidity": "60%"},
82+
// {"Day": "Friday", "Forecast": "partly cloudy", "Temperature": 73, "Wind Speed": 12},
83+
// {"Day": "Saturday", "Forecast": "sunny", "Temperature": 80, "Wind Speed": 8, "Humidity": "40%"}]}
7684
// [END googlegenaisdk_ctrlgen_with_nullable_schema]
7785

7886
module.exports = {

genai/controlled-generation/ctrlgen-with-resp-schema.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ async function generateContent(
6060

6161
return response.text;
6262
}
63+
// Example output:
64+
// [
65+
// {
66+
// "ingredients": [
67+
// "2 1/4 cups all-purpose flour",
68+
// "1 teaspoon baking soda",
69+
// "1 teaspoon salt",
70+
// "1 cup (2 sticks) unsalted butter, softened",
71+
// "3/4 cup granulated sugar",
72+
// "3/4 cup packed brown sugar",
73+
// "1 teaspoon vanilla extract",
74+
// "2 large eggs",
75+
// "2 cups chocolate chips",
76+
// ],
77+
// "recipe_name": "Chocolate Chip Cookies",
78+
// }
79+
// ]
6380
// [END googlegenaisdk_ctrlgen_with_resp_schema]
6481

6582
module.exports = {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../tools/tools-code-exec-with-txt.js');
2222
const {delay} = require('./util');
2323

24-
2524
describe('tools-code-exec-with-txt', async () => {
2625
it('should generate code and execution result', async function () {
2726
this.timeout(180000);

0 commit comments

Comments
 (0)