Skip to content

Commit b8809cc

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent bc930d1 commit b8809cc

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

genai/tuning/tuning-job-create.js

Lines changed: 3 additions & 3 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,
@@ -34,7 +34,7 @@ async function generateContent(
3434
return new Promise(resolve => setTimeout(resolve, ms));
3535
}
3636

37-
let tuningJob = await ai.tunings.tune({
37+
let tuningJob = await client.tunings.tune({
3838
baseModel: 'gemini-2.5-flash',
3939
trainingDataset: {
4040
gcsUri:
@@ -50,7 +50,7 @@ async function generateContent(
5050

5151
while (runningStates.has(tuningJob.state)) {
5252
console.log(`Job state: ${tuningJob.state}`);
53-
tuningJob = await ai.tunings.get({name: tuningJob.name});
53+
tuningJob = await client.tunings.get({name: tuningJob.name});
5454
await sleep(60000);
5555
}
5656

genai/tuning/tuning-job-get.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ async function generateContent(
2525
projectId = GOOGLE_CLOUD_PROJECT,
2626
location = GOOGLE_CLOUD_LOCATION
2727
) {
28-
const ai = new GoogleGenAI({
28+
const client = new GoogleGenAI({
2929
vertexai: true,
3030
project: projectId,
3131
location: location,
3232
});
3333

3434
// Get the tuning job and the tuned model.
35-
const tuningJob = await ai.tunings.get({name: tuningJobName});
35+
const tuningJob = await client.tunings.get({name: tuningJobName});
3636

3737
console.log(tuningJob.tunedModel.model);
3838
console.log(tuningJob.tunedModel.endpoint);

genai/tuning/tuning-job-list.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ async function generateContent(
2323
projectId = GOOGLE_CLOUD_PROJECT,
2424
location = GOOGLE_CLOUD_LOCATION
2525
) {
26-
const ai = new GoogleGenAI({
26+
const client = new GoogleGenAI({
2727
vertexai: true,
2828
project: projectId,
2929
location: location,
3030
});
3131

32-
const responses = await ai.tunings.list();
32+
const responses = await client.tunings.list();
3333

3434
for await (const item of responses) {
3535
if (item.name && item.name.includes('/tuningJobs/')) {

genai/tuning/tuning-textgen-with-txt.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ async function generateContent(
2525
projectId = GOOGLE_CLOUD_PROJECT,
2626
location = GOOGLE_CLOUD_LOCATION
2727
) {
28-
const ai = new GoogleGenAI({
28+
const client = new GoogleGenAI({
2929
vertexai: true,
3030
project: projectId,
3131
location: location,
3232
});
3333

34-
const tuningJob = await ai.tunings.get({name: tuningJobName});
34+
const tuningJob = await client.tunings.get({name: tuningJobName});
3535

3636
const content = 'Why lava is red?';
3737

38-
const response = await ai.models.generateContent({
38+
const response = await client.models.generateContent({
3939
model: tuningJob.tunedModel.endpoint,
4040
content: content,
4141
});

0 commit comments

Comments
 (0)