Skip to content

Commit 6fe10d2

Browse files
committed
fix(aiplatform): list tuned models test
1 parent 7a360b6 commit 6fe10d2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ai-platform/snippets/list-tuned-models.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
'use strict';
1717

18-
function main(project, location, model = 'text-bison@001') {
18+
async function main(project, location, model = 'text-bison-001') {
1919
// [START aiplatform_list_tuned_models]
2020
/**
2121
* TODO(developer): Uncomment these variables before running the sample.\
@@ -34,7 +34,7 @@ function main(project, location, model = 'text-bison@001') {
3434
// Instantiate the service client.
3535
const modelServiceClient = new ModelServiceClient(clientOptions);
3636

37-
function listTunedModels() {
37+
async function listTunedModels() {
3838
// Configure the parent resource
3939
const parent = `projects/${project}/locations/${location}`;
4040
const filter = `labels.google-vertex-llm-tuning-base-model-id=${model}`;
@@ -44,14 +44,14 @@ function main(project, location, model = 'text-bison@001') {
4444
filter,
4545
};
4646

47-
const [response] = modelServiceClient.listModels(request);
47+
const [response] = await modelServiceClient.listModels(request);
4848
console.log('List Tuned Models response');
4949
for (const model of response) {
5050
console.log(`\tModel name: ${model.name}`);
5151
console.log(`\tDisplay name: ${model.displayName}`);
5252
}
5353
}
54-
listTunedModels();
54+
await listTunedModels();
5555
// [END aiplatform_list_tuned_models]
5656
}
5757

ai-platform/snippets/test/list-tuned-models.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const project = process.env.CAIP_PROJECT_ID;
2525

2626
const {listTunedModels} = require('../list-tuned-models');
2727

28-
describe('AI platform list tuned models', () => {
28+
describe('List tuned models', async () => {
2929
const stubConsole = function () {
3030
sinon.stub(console, 'error');
3131
sinon.stub(console, 'log');
@@ -39,8 +39,8 @@ describe('AI platform list tuned models', () => {
3939
beforeEach(stubConsole);
4040
afterEach(restoreConsole);
4141

42-
it('should list all tuned LLM models', () => {
43-
listTunedModels(project, LOCATION);
42+
it('should list all tuned LLM models', async () => {
43+
await listTunedModels(project, LOCATION);
4444
assert.include(console.log.firstCall.args, 'List Tuned Models response');
4545
});
4646
});

0 commit comments

Comments
 (0)