| 48 | const modelServiceClient = new ModelServiceClient(clientOptions); |
| 49 | |
| 50 | async function exportModel() { |
| 51 | // Configure the name resources |
| 52 | const name = `projects/${project}/locations/${location}/models/${modelId}`; |
| 53 | // Configure the outputConfig resources |
| 54 | const outputConfig = { |
| 55 | exportFormatId: exportFormat, |
| 56 | gcsDestination: { |
| 57 | outputUriPrefix: gcsDestinationOutputUriPrefix, |
| 58 | }, |
| 59 | }; |
| 60 | const request = { |
| 61 | name, |
| 62 | outputConfig, |
| 63 | }; |
| 64 | |
| 65 | // Export Model request |
| 66 | const [response] = await modelServiceClient.exportModel(request); |
| 67 | console.log(`Long running operation : ${response.name}`); |
| 68 | |
| 69 | // Wait for operation to complete |
| 70 | await response.promise(); |
| 71 | const result = response.result; |
| 72 | |
| 73 | console.log(`Export model response : ${JSON.stringify(result)}`); |
| 74 | } |
| 75 | exportModel(); |
| 76 | // [END aiplatform_export_model_sample] |
| 77 | } |