Skip to content

Commit 4dc0382

Browse files
authored
feat: updates enhanced client library veneer and samples (#73)
1 parent 66ff554 commit 4dc0382

File tree

31 files changed

+60
-59
lines changed

31 files changed

+60
-59
lines changed

ai-platform/snippets/create-batch-prediction-job-video-classification.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ async function main(
3838
// const project = 'YOUR_PROJECT_ID';
3939
// const location = 'YOUR_PROJECT_LOCATION';
4040
const aiplatform = require('@google-cloud/aiplatform');
41-
const {
42-
params,
43-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
41+
const {params} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
4442

4543
// Imports the Google Cloud Job Service Client library
46-
const {JobServiceClient} = require('@google-cloud/aiplatform');
44+
const {JobServiceClient} = require('@google-cloud/aiplatform').v1;
4745

4846
// Specifies the location of the api endpoint
4947
const clientOptions = {

ai-platform/snippets/create-batch-prediction-job-video-object-tracking.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,10 @@ async function main(
3838
// const project = 'YOUR_PROJECT_ID';
3939
// const location = 'YOUR_PROJECT_LOCATION';
4040
const aiplatform = require('@google-cloud/aiplatform');
41-
const {
42-
params,
43-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
41+
const {params} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
4442

4543
// Imports the Google Cloud Job Service Client library
46-
const {JobServiceClient} = require('@google-cloud/aiplatform');
44+
const {JobServiceClient} = require('@google-cloud/aiplatform').v1;
4745

4846
// Specifies the location of the api endpoint
4947
const clientOptions = {

ai-platform/snippets/create-training-pipeline-image-classification.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function main(
4040

4141
const {
4242
definition,
43-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
43+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4444
const ModelType = definition.AutoMlImageClassificationInputs.ModelType;
4545

4646
// Specifies the location of the api endpoint
@@ -49,9 +49,8 @@ function main(
4949
};
5050

5151
// Instantiates a client
52-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
53-
clientOptions
54-
);
52+
const {PipelineServiceClient} = aiplatform.v1;
53+
const pipelineServiceClient = new PipelineServiceClient(clientOptions);
5554

5655
async function createTrainingPipelineImageClassification() {
5756
// Configure the parent resource

ai-platform/snippets/create-training-pipeline-image-object-detection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ async function main(
3838
const aiplatform = require('@google-cloud/aiplatform');
3939
const {
4040
definition,
41-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
41+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4242
const ModelType = definition.AutoMlImageObjectDetectionInputs.ModelType;
4343

4444
// Imports the Google Cloud Pipeline Service Client library
45-
const {PipelineServiceClient} = aiplatform;
45+
const {PipelineServiceClient} = aiplatform.v1;
4646

4747
// Specifies the location of the api endpoint
4848
const clientOptions = {

ai-platform/snippets/create-training-pipeline-tabular-classification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ async function main(
3939
const aiplatform = require('@google-cloud/aiplatform');
4040
const {
4141
definition,
42-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
42+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4343

4444
// Imports the Google Cloud Pipeline Service Client library
45-
const {PipelineServiceClient} = aiplatform;
45+
const {PipelineServiceClient} = aiplatform.v1;
4646
// Specifies the location of the api endpoint
4747
const clientOptions = {
4848
apiEndpoint: 'us-central1-aiplatform.googleapis.com',

ai-platform/snippets/create-training-pipeline-tabular-regression.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ async function main(
3939
const aiplatform = require('@google-cloud/aiplatform');
4040
const {
4141
definition,
42-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
42+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4343

4444
// Imports the Google Cloud Pipeline Service Client library
45-
const {PipelineServiceClient} = aiplatform;
45+
const {PipelineServiceClient} = aiplatform.v1;
4646
// Specifies the location of the api endpoint
4747
const clientOptions = {
4848
apiEndpoint: 'us-central1-aiplatform.googleapis.com',

ai-platform/snippets/create-training-pipeline-text-classification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async function main(
3737
const aiplatform = require('@google-cloud/aiplatform');
3838
const {
3939
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
40+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4141

4242
// Imports the Google Cloud Pipeline Service Client library
43-
const {PipelineServiceClient} = aiplatform;
43+
const {PipelineServiceClient} = aiplatform.v1;
4444

4545
// Specifies the location of the api endpoint
4646
const clientOptions = {

ai-platform/snippets/create-training-pipeline-text-entity-extraction.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async function main(
3737
const aiplatform = require('@google-cloud/aiplatform');
3838
const {
3939
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
40+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4141

4242
// Imports the Google Cloud Pipeline Service Client library
43-
const {PipelineServiceClient} = aiplatform;
43+
const {PipelineServiceClient} = aiplatform.v1;
4444

4545
// Specifies the location of the api endpoint
4646
const clientOptions = {

ai-platform/snippets/create-training-pipeline-text-sentiment-analysis.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async function main(
3737
const aiplatform = require('@google-cloud/aiplatform');
3838
const {
3939
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
40+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4141

4242
// Imports the Google Cloud Pipeline Service Client library
43-
const {PipelineServiceClient} = aiplatform;
43+
const {PipelineServiceClient} = aiplatform.v1;
4444

4545
// Specifies the location of the api endpoint
4646
const clientOptions = {

ai-platform/snippets/create-training-pipeline-video-classification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async function main(
3737
const aiplatform = require('@google-cloud/aiplatform');
3838
const {
3939
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
40+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4141

4242
// Imports the Google Cloud Pipeline Service Client library
43-
const {PipelineServiceClient} = aiplatform;
43+
const {PipelineServiceClient} = aiplatform.v1;
4444

4545
// Specifies the location of the api endpoint
4646
const clientOptions = {

ai-platform/snippets/create-training-pipeline-video-object-tracking.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ async function main(
3737
const aiplatform = require('@google-cloud/aiplatform');
3838
const {
3939
definition,
40-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.trainingjob;
40+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.trainingjob;
4141
const ModelType = definition.AutoMlVideoObjectTrackingInputs.ModelType;
4242

4343
// Imports the Google Cloud Pipeline Service Client library
44-
const {PipelineServiceClient} = aiplatform;
44+
const {PipelineServiceClient} = aiplatform.v1;
4545

4646
// Specifies the location of the api endpoint
4747
const clientOptions = {

ai-platform/snippets/get-model-evaluation-tabular-classification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ async function main(modelId, evaluationId, project, location = 'us-central1') {
5757

5858
const modelExplanation = response.modelExplanation;
5959
console.log('\tModel explanation');
60-
if (modelExplanation === null) {
60+
if (!modelExplanation) {
6161
console.log('\t\t{}');
6262
} else {
6363
const meanAttributions = modelExplanation.meanAttributions;
64-
if (meanAttributions === null) {
64+
if (!meanAttributions) {
6565
console.log('\t\t\t []');
6666
} else {
6767
for (const meanAttribution of meanAttributions) {

ai-platform/snippets/get-model-evaluation-tabular-regression.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ async function main(modelId, evaluationId, project, location = 'us-central1') {
5858

5959
const modelExplanation = response.modelExplanation;
6060
console.log('\tModel explanation');
61-
if (modelExplanation === null) {
61+
if (!modelExplanation) {
6262
console.log('\t\t{}');
6363
} else {
6464
const meanAttributions = modelExplanation.meanAttributions;
65-
if (meanAttributions === null) {
65+
if (!meanAttributions) {
6666
console.log('\t\t\t []');
6767
} else {
6868
for (const meanAttribution of meanAttributions) {

ai-platform/snippets/predict-image-classification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ function main(filename, endpointId, project, location = 'us-central1') {
3232
instance,
3333
params,
3434
prediction,
35-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
35+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3636

3737
// Imports the Google Cloud Prediction Service Client library
38-
const {PredictionServiceClient} = aiplatform;
38+
const {PredictionServiceClient} = aiplatform.v1;
3939

4040
// Specifies the location of the api endpoint
4141
const clientOptions = {

ai-platform/snippets/predict-image-object-detection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ async function main(filename, endpointId, project, location = 'us-central1') {
3232
instance,
3333
params,
3434
prediction,
35-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
35+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3636

3737
// Imports the Google Cloud Prediction Service Client library
38-
const {PredictionServiceClient} = aiplatform;
38+
const {PredictionServiceClient} = aiplatform.v1;
3939

4040
// Specifies the location of the api endpoint
4141
const clientOptions = {

ai-platform/snippets/predict-tabular-classification.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ async function main(endpointId, project, location = 'us-central1') {
2929
const aiplatform = require('@google-cloud/aiplatform');
3030
const {
3131
prediction,
32-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
32+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3333

34-
// Imports the Google Cloud Prediction Service Client library
35-
const {PredictionServiceClient, helpers} = aiplatform;
34+
// Imports the Google Cloud Prediction service client
35+
const {PredictionServiceClient} = aiplatform.v1;
36+
37+
// Import the helper module for converting arbitrary protobuf.Value objects.
38+
const {helpers} = aiplatform;
3639

3740
// Specifies the location of the api endpoint
3841
const clientOptions = {

ai-platform/snippets/predict-tabular-regression.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ async function main(endpointId, project, location = 'us-central1') {
2929
const aiplatform = require('@google-cloud/aiplatform');
3030
const {
3131
prediction,
32-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
32+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3333

34-
// Imports the Google Cloud Prediction Service Client library
35-
const {PredictionServiceClient, helpers} = aiplatform;
34+
// Imports the Google Cloud Prediction service client
35+
const {PredictionServiceClient} = aiplatform.v1;
36+
37+
// Import the helper module for converting arbitrary protobuf.Value objects.
38+
const {helpers} = aiplatform;
3639

3740
// Specifies the location of the api endpoint
3841
const clientOptions = {

ai-platform/snippets/predict-text-classification.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ async function main(text, endpointId, project, location) {
3131
const {
3232
instance,
3333
prediction,
34-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
34+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3535

3636
// Imports the Google Cloud Model Service Client library
37-
const {PredictionServiceClient} = aiplatform;
37+
const {PredictionServiceClient} = aiplatform.v1;
3838

3939
// Specifies the location of the api endpoint
4040
const clientOptions = {

ai-platform/snippets/predict-text-entity-extraction.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ async function main(text, endpointId, project, location = 'us-central1') {
3131
const {
3232
instance,
3333
prediction,
34-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
34+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3535

3636
// Imports the Google Cloud Model Service Client library
37-
const {PredictionServiceClient} = aiplatform;
37+
const {PredictionServiceClient} = aiplatform.v1;
3838

3939
// Specifies the location of the api endpoint
4040
const clientOptions = {

ai-platform/snippets/predict-text-sentiment-analysis.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ async function main(text, endpointId, project, location = 'us-central1') {
3131
const {
3232
instance,
3333
prediction,
34-
} = aiplatform.protos.google.cloud.aiplatform.v1beta1.schema.predict;
34+
} = aiplatform.protos.google.cloud.aiplatform.v1.schema.predict;
3535

3636
// Imports the Google Cloud Model Service Client library
37-
const {PredictionServiceClient} = aiplatform;
37+
const {PredictionServiceClient} = aiplatform.v1;
3838

3939
// Specifies the location of the api endpoint
4040
const clientOptions = {

ai-platform/snippets/test/create-batch-prediction-job-video-classification.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const clientOptions = {
2929
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3030
};
3131

32-
const jobServiceClient = new aiplatform.JobServiceClient(clientOptions);
32+
const jobServiceClient = new aiplatform.v1.JobServiceClient(clientOptions);
3333

3434
const batchPredictionDisplayName = `temp_create_batch_prediction_video_classification_test${uuid()}`;
3535
const modelId = '8596984660557299712';

ai-platform/snippets/test/create-batch-prediction-job-video-object-tracking.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const clientOptions = {
2929
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3030
};
3131

32-
const jobServiceClient = new aiplatform.JobServiceClient(clientOptions);
32+
const jobServiceClient = new aiplatform.v1.JobServiceClient(clientOptions);
3333

3434
const batchPredictionDisplayName = `temp_create_batch_prediction_video_object_tracking_test${uuid()}`;
3535
const modelId = '8609932509485989888';

ai-platform/snippets/test/create-training-pipeline-image-classification.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const clientOptions = {
2828
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
2929
};
3030

31-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
31+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3232
clientOptions
3333
);
3434

ai-platform/snippets/test/create-training-pipeline-image-object-detection.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-tabular-classification.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-tabular-regression.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-text-classification.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-text-entity-extraction.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-text-sentiment-analysis.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-video-classification.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

ai-platform/snippets/test/create-training-pipeline-video-object-tracking.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const clientOptions = {
3030
apiEndpoint: 'us-central1-aiplatform.googleapis.com',
3131
};
3232

33-
const pipelineServiceClient = new aiplatform.PipelineServiceClient(
33+
const pipelineServiceClient = new aiplatform.v1.PipelineServiceClient(
3434
clientOptions
3535
);
3636

0 commit comments

Comments
 (0)