MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

ai-platform/snippets/get-model.js:19–122  ·  view source on GitHub ↗
(modelId, project, location = 'us-central1')

Source from the content-addressed store, hash-verified

17'use strict';
18
19async function main(modelId, project, location = 'us-central1') {
20 // [START aiplatform_get_model_sample]
21 /**
22 * TODO(developer): Uncomment these variables before running the sample.\
23 * (Not necessary if passing values as arguments)
24 */
25
26 // const modelId = 'YOUR_MODEL_ID';
27 // const project = 'YOUR_PROJECT_ID';
28 // const location = 'YOUR_PROJECT_LOCATION';
29
30 // Imports the Google Cloud Model Service Client library
31 const {ModelServiceClient} = require('@google-cloud/aiplatform');
32
33 // Specifies the location of the api endpoint
34 const clientOptions = {
35 apiEndpoint: 'us-central1-aiplatform.googleapis.com',
36 };
37
38 // Instantiates a client
39 const modelServiceClient = new ModelServiceClient(clientOptions);
40
41 async function getModel() {
42 // Configure the parent resource
43 const name = `projects/${project}/locations/${location}/models/${modelId}`;
44 const request = {
45 name,
46 };
47 // Get and print out a list of all the endpoints for this resource
48 const [response] = await modelServiceClient.getModel(request);
49
50 console.log('Get model response');
51 console.log(`\tName : ${response.name}`);
52 console.log(`\tDisplayName : ${response.displayName}`);
53 console.log(`\tDescription : ${response.description}`);
54 console.log(`\tMetadata schema uri : ${response.metadataSchemaUri}`);
55 console.log(`\tMetadata : ${JSON.stringify(response.metadata)}`);
56 console.log(`\tTraining pipeline : ${response.trainingPipeline}`);
57 console.log(`\tArtifact uri : ${response.artifactUri}`);
58 console.log(
59 `\tSupported deployment resource types : \
60 ${response.supportedDeploymentResourceTypes}`
61 );
62 console.log(
63 `\tSupported input storage formats : \
64 ${response.supportedInputStorageFormats}`
65 );
66 console.log(
67 `\tSupported output storage formats : \
68 ${response.supportedOutputStoragFormats}`
69 );
70 console.log(`\tCreate time : ${JSON.stringify(response.createTime)}`);
71 console.log(`\tUpdate time : ${JSON.stringify(response.updateTime)}`);
72 console.log(`\tLabels : ${JSON.stringify(response.labels)}`);
73
74 const predictSchemata = response.predictSchemata;
75 console.log('\tPredict schemata');
76 console.log(`\tInstance schema uri : ${predictSchemata.instanceSchemaUri}`);

Callers 1

get-model.jsFile · 0.70

Calls 1

getModelFunction · 0.70

Tested by

no test coverage detected