Skip to content

Commit baf1128

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent 92ae8af commit baf1128

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function generateContent(
2424
projectId = GOOGLE_CLOUD_PROJECT,
2525
location = GOOGLE_CLOUD_LOCATION
2626
) {
27-
const ai = new GoogleGenAI({
27+
const client = new GoogleGenAI({
2828
vertexai: true,
2929
project: projectId,
3030
location: location,
@@ -41,7 +41,7 @@ async function generateContent(
4141
}
4242
}
4343

44-
const response = await ai.models.generateContent({
44+
const response = await client.models.generateContent({
4545
model: 'gemini-2.5-flash',
4646
contents: 'List a few popular cookie recipes?',
4747
config: {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function generateContent(
2424
projectId = GOOGLE_CLOUD_PROJECT,
2525
location = GOOGLE_CLOUD_LOCATION
2626
) {
27-
const ai = new GoogleGenAI({
27+
const client = new GoogleGenAI({
2828
vertexai: true,
2929
project: projectId,
3030
location: location,
@@ -53,7 +53,7 @@ async function generateContent(
5353
enum: InstrumentClass.values(),
5454
};
5555

56-
const response = await ai.models.generateContent({
56+
const response = await client.models.generateContent({
5757
model: 'gemini-2.5-flash',
5858
contents: 'What type of instrument is a guitar?',
5959
config: {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function generateContent(
2424
projectId = GOOGLE_CLOUD_PROJECT,
2525
location = GOOGLE_CLOUD_LOCATION
2626
) {
27-
const ai = new GoogleGenAI({
27+
const client = new GoogleGenAI({
2828
vertexai: true,
2929
project: projectId,
3030
location: location,
@@ -35,7 +35,7 @@ async function generateContent(
3535
enum: ['Percussion', 'String', 'Woodwind', 'Brass', 'Keyboard'],
3636
};
3737

38-
const response = await ai.models.generateContent({
38+
const response = await client.models.generateContent({
3939
model: 'gemini-2.5-flash',
4040
contents: 'What type of instrument is an oboe?',
4141
config: {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function generateContent(
2424
projectId = GOOGLE_CLOUD_PROJECT,
2525
location = GOOGLE_CLOUD_LOCATION
2626
) {
27-
const ai = new GoogleGenAI({
27+
const client = new GoogleGenAI({
2828
vertexai: true,
2929
project: projectId,
3030
location: location,
@@ -53,7 +53,7 @@ async function generateContent(
5353
}
5454
}
5555

56-
const response = await ai.models.generateContent({
56+
const response = await client.models.generateContent({
5757
model: 'gemini-2.5-flash',
5858
contents:
5959
'List about 10 home-baked cookies and give them grades based on tastiness.',

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function generateContent(
2424
projectId = GOOGLE_CLOUD_PROJECT,
2525
location = GOOGLE_CLOUD_LOCATION
2626
) {
27-
const ai = new GoogleGenAI({
27+
const client = new GoogleGenAI({
2828
vertexai: true,
2929
project: projectId,
3030
location: location,
@@ -61,7 +61,7 @@ async function generateContent(
6161
},
6262
};
6363

64-
const response = await ai.models.generateContent({
64+
const response = await client.models.generateContent({
6565
model: 'gemini-2.5-flash',
6666
contents: prompt,
6767
config: {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function generateContent(
2424
projectId = GOOGLE_CLOUD_PROJECT,
2525
location = GOOGLE_CLOUD_LOCATION
2626
) {
27-
const ai = new GoogleGenAI({
27+
const client = new GoogleGenAI({
2828
vertexai: true,
2929
project: projectId,
3030
location: location,
@@ -47,7 +47,7 @@ async function generateContent(
4747
},
4848
};
4949

50-
const response = await ai.models.generateContent({
50+
const response = await client.models.generateContent({
5151
model: 'gemini-2.5-flash',
5252
contents: prompt,
5353
config: {

0 commit comments

Comments
 (0)