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

Function main

ai-platform/snippets/delete-model.js:19–57  ·  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_delete_model_sample]
21 /**
22 * TODO(developer): Uncomment these variables before running the sample.\
23 */
24
25 // const modelId = 'YOUR_MODEL_ID';
26 // const project = 'YOUR_PROJECT_ID';
27 // const location = 'YOUR_PROJECT_LOCATION';
28
29 // Imports the Google Cloud Model Service Client library
30 const {ModelServiceClient} = require('@google-cloud/aiplatform');
31
32 // Specifies the location of the api endpoint
33 const clientOptions = {
34 apiEndpoint: 'us-central1-aiplatform.googleapis.com',
35 };
36
37 // Instantiates a client
38 const modelServiceClient = new ModelServiceClient(clientOptions);
39
40 async function deleteModel() {
41 // Configure the resource
42 const name = modelServiceClient.modelPath(project, location, modelId);
43 const request = {name};
44
45 // Delete Model Request
46 const [response] = await modelServiceClient.deleteModel(request);
47 console.log(`Long running operation: ${response.name}`);
48
49 // Wait for operation to complete
50 await response.promise();
51 const result = response.result;
52
53 console.log('Delete model response:\n', result);
54 }
55 deleteModel();
56 // [END aiplatform_delete_model_sample]
57}
58
59process.on('unhandledRejection', err => {
60 console.error(err.message);

Callers 1

delete-model.jsFile · 0.70

Calls 1

deleteModelFunction · 0.70

Tested by

no test coverage detected