xref: /aosp_15_r20/external/googleapis/google/cloud/aiplatform/v1/model.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.aiplatform.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/aiplatform/v1/deployed_model_ref.proto";
22import "google/cloud/aiplatform/v1/encryption_spec.proto";
23import "google/cloud/aiplatform/v1/env_var.proto";
24import "google/cloud/aiplatform/v1/explanation.proto";
25import "google/protobuf/duration.proto";
26import "google/protobuf/struct.proto";
27import "google/protobuf/timestamp.proto";
28
29option csharp_namespace = "Google.Cloud.AIPlatform.V1";
30option go_package = "cloud.google.com/go/aiplatform/apiv1/aiplatformpb;aiplatformpb";
31option java_multiple_files = true;
32option java_outer_classname = "ModelProto";
33option java_package = "com.google.cloud.aiplatform.v1";
34option php_namespace = "Google\\Cloud\\AIPlatform\\V1";
35option ruby_package = "Google::Cloud::AIPlatform::V1";
36
37// A trained machine learning Model.
38message Model {
39  option (google.api.resource) = {
40    type: "aiplatform.googleapis.com/Model"
41    pattern: "projects/{project}/locations/{location}/models/{model}"
42  };
43
44  // Represents export format supported by the Model.
45  // All formats export to Google Cloud Storage.
46  message ExportFormat {
47    // The Model content that can be exported.
48    enum ExportableContent {
49      // Should not be used.
50      EXPORTABLE_CONTENT_UNSPECIFIED = 0;
51
52      // Model artifact and any of its supported files. Will be exported to the
53      // location specified by the `artifactDestination` field of the
54      // [ExportModelRequest.output_config][google.cloud.aiplatform.v1.ExportModelRequest.output_config]
55      // object.
56      ARTIFACT = 1;
57
58      // The container image that is to be used when deploying this Model. Will
59      // be exported to the location specified by the `imageDestination` field
60      // of the
61      // [ExportModelRequest.output_config][google.cloud.aiplatform.v1.ExportModelRequest.output_config]
62      // object.
63      IMAGE = 2;
64    }
65
66    // Output only. The ID of the export format.
67    // The possible format IDs are:
68    //
69    // * `tflite`
70    // Used for Android mobile devices.
71    //
72    // * `edgetpu-tflite`
73    // Used for [Edge TPU](https://cloud.google.com/edge-tpu/) devices.
74    //
75    // * `tf-saved-model`
76    // A tensorflow model in SavedModel format.
77    //
78    // * `tf-js`
79    // A [TensorFlow.js](https://www.tensorflow.org/js) model that can be used
80    // in the browser and in Node.js using JavaScript.
81    //
82    // * `core-ml`
83    // Used for iOS mobile devices.
84    //
85    // * `custom-trained`
86    // A Model that was uploaded or trained by custom code.
87    string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
88
89    // Output only. The content of this Model that may be exported.
90    repeated ExportableContent exportable_contents = 2
91        [(google.api.field_behavior) = OUTPUT_ONLY];
92  }
93
94  // Stats of data used for train or evaluate the Model.
95  message DataStats {
96    // Number of DataItems that were used for training this Model.
97    int64 training_data_items_count = 1;
98
99    // Number of DataItems that were used for validating this Model during
100    // training.
101    int64 validation_data_items_count = 2;
102
103    // Number of DataItems that were used for evaluating this Model. If the
104    // Model is evaluated multiple times, this will be the number of test
105    // DataItems used by the first evaluation. If the Model is not evaluated,
106    // the number is 0.
107    int64 test_data_items_count = 3;
108
109    // Number of Annotations that are used for training this Model.
110    int64 training_annotations_count = 4;
111
112    // Number of Annotations that are used for validating this Model during
113    // training.
114    int64 validation_annotations_count = 5;
115
116    // Number of Annotations that are used for evaluating this Model. If the
117    // Model is evaluated multiple times, this will be the number of test
118    // Annotations used by the first evaluation. If the Model is not evaluated,
119    // the number is 0.
120    int64 test_annotations_count = 6;
121  }
122
123  // Contains information about the original Model if this Model is a copy.
124  message OriginalModelInfo {
125    // Output only. The resource name of the Model this Model is a copy of,
126    // including the revision. Format:
127    // `projects/{project}/locations/{location}/models/{model_id}@{version_id}`
128    string model = 1 [
129      (google.api.field_behavior) = OUTPUT_ONLY,
130      (google.api.resource_reference) = {
131        type: "aiplatform.googleapis.com/Model"
132      }
133    ];
134  }
135
136  // User input field to specify the base model source. Currently it only
137  // supports specifing the Model Garden models and Genie models.
138  message BaseModelSource {
139    oneof source {
140      // Source information of Model Garden models.
141      ModelGardenSource model_garden_source = 1;
142
143      // Information about the base model of Genie models.
144      GenieSource genie_source = 2;
145    }
146  }
147
148  // Identifies a type of Model's prediction resources.
149  enum DeploymentResourcesType {
150    // Should not be used.
151    DEPLOYMENT_RESOURCES_TYPE_UNSPECIFIED = 0;
152
153    // Resources that are dedicated to the
154    // [DeployedModel][google.cloud.aiplatform.v1.DeployedModel], and that need
155    // a higher degree of manual configuration.
156    DEDICATED_RESOURCES = 1;
157
158    // Resources that to large degree are decided by Vertex AI, and require
159    // only a modest additional configuration.
160    AUTOMATIC_RESOURCES = 2;
161
162    // Resources that can be shared by multiple
163    // [DeployedModels][google.cloud.aiplatform.v1.DeployedModel]. A
164    // pre-configured
165    // [DeploymentResourcePool][google.cloud.aiplatform.v1.DeploymentResourcePool]
166    // is required.
167    SHARED_RESOURCES = 3;
168  }
169
170  // The resource name of the Model.
171  string name = 1;
172
173  // Output only. Immutable. The version ID of the model.
174  // A new version is committed when a new model version is uploaded or
175  // trained under an existing model id. It is an auto-incrementing decimal
176  // number in string representation.
177  string version_id = 28 [
178    (google.api.field_behavior) = IMMUTABLE,
179    (google.api.field_behavior) = OUTPUT_ONLY
180  ];
181
182  // User provided version aliases so that a model version can be referenced via
183  // alias (i.e.
184  // `projects/{project}/locations/{location}/models/{model_id}@{version_alias}`
185  // instead of auto-generated version id (i.e.
186  // `projects/{project}/locations/{location}/models/{model_id}@{version_id})`.
187  // The format is [a-z][a-zA-Z0-9-]{0,126}[a-z0-9] to distinguish from
188  // version_id. A default version alias will be created for the first version
189  // of the model, and there must be exactly one default version alias for a
190  // model.
191  repeated string version_aliases = 29;
192
193  // Output only. Timestamp when this version was created.
194  google.protobuf.Timestamp version_create_time = 31
195      [(google.api.field_behavior) = OUTPUT_ONLY];
196
197  // Output only. Timestamp when this version was most recently updated.
198  google.protobuf.Timestamp version_update_time = 32
199      [(google.api.field_behavior) = OUTPUT_ONLY];
200
201  // Required. The display name of the Model.
202  // The name can be up to 128 characters long and can consist of any UTF-8
203  // characters.
204  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
205
206  // The description of the Model.
207  string description = 3;
208
209  // The description of this version.
210  string version_description = 30;
211
212  // The schemata that describe formats of the Model's predictions and
213  // explanations as given and returned via
214  // [PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict]
215  // and
216  // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain].
217  PredictSchemata predict_schemata = 4;
218
219  // Immutable. Points to a YAML file stored on Google Cloud Storage describing
220  // additional information about the Model, that is specific to it. Unset if
221  // the Model does not have any additional information. The schema is defined
222  // as an OpenAPI 3.0.2 [Schema
223  // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
224  // AutoML Models always have this field populated by Vertex AI, if no
225  // additional metadata is needed, this field is set to an empty string.
226  // Note: The URI given on output will be immutable and probably different,
227  // including the URI scheme, than the one given on input. The output URI will
228  // point to a location where the user only has a read access.
229  string metadata_schema_uri = 5 [(google.api.field_behavior) = IMMUTABLE];
230
231  // Immutable. An additional information about the Model; the schema of the
232  // metadata can be found in
233  // [metadata_schema][google.cloud.aiplatform.v1.Model.metadata_schema_uri].
234  // Unset if the Model does not have any additional information.
235  google.protobuf.Value metadata = 6 [(google.api.field_behavior) = IMMUTABLE];
236
237  // Output only. The formats in which this Model may be exported. If empty,
238  // this Model is not available for export.
239  repeated ExportFormat supported_export_formats = 20
240      [(google.api.field_behavior) = OUTPUT_ONLY];
241
242  // Output only. The resource name of the TrainingPipeline that uploaded this
243  // Model, if any.
244  string training_pipeline = 7 [
245    (google.api.field_behavior) = OUTPUT_ONLY,
246    (google.api.resource_reference) = {
247      type: "aiplatform.googleapis.com/TrainingPipeline"
248    }
249  ];
250
251  // Optional. This field is populated if the model is produced by a pipeline
252  // job.
253  string pipeline_job = 47 [
254    (google.api.field_behavior) = OPTIONAL,
255    (google.api.resource_reference) = {
256      type: "aiplatform.googleapis.com/PipelineJob"
257    }
258  ];
259
260  // Input only. The specification of the container that is to be used when
261  // deploying this Model. The specification is ingested upon
262  // [ModelService.UploadModel][google.cloud.aiplatform.v1.ModelService.UploadModel],
263  // and all binaries it contains are copied and stored internally by Vertex AI.
264  // Not required for AutoML Models.
265  ModelContainerSpec container_spec = 9
266      [(google.api.field_behavior) = INPUT_ONLY];
267
268  // Immutable. The path to the directory containing the Model artifact and any
269  // of its supporting files. Not required for AutoML Models.
270  string artifact_uri = 26 [(google.api.field_behavior) = IMMUTABLE];
271
272  // Output only. When this Model is deployed, its prediction resources are
273  // described by the `prediction_resources` field of the
274  // [Endpoint.deployed_models][google.cloud.aiplatform.v1.Endpoint.deployed_models]
275  // object. Because not all Models support all resource configuration types,
276  // the configuration types this Model supports are listed here. If no
277  // configuration types are listed, the Model cannot be deployed to an
278  // [Endpoint][google.cloud.aiplatform.v1.Endpoint] and does not support
279  // online predictions
280  // ([PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict]
281  // or
282  // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain]).
283  // Such a Model can serve predictions by using a
284  // [BatchPredictionJob][google.cloud.aiplatform.v1.BatchPredictionJob], if it
285  // has at least one entry each in
286  // [supported_input_storage_formats][google.cloud.aiplatform.v1.Model.supported_input_storage_formats]
287  // and
288  // [supported_output_storage_formats][google.cloud.aiplatform.v1.Model.supported_output_storage_formats].
289  repeated DeploymentResourcesType supported_deployment_resources_types = 10
290      [(google.api.field_behavior) = OUTPUT_ONLY];
291
292  // Output only. The formats this Model supports in
293  // [BatchPredictionJob.input_config][google.cloud.aiplatform.v1.BatchPredictionJob.input_config].
294  // If
295  // [PredictSchemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri]
296  // exists, the instances should be given as per that schema.
297  //
298  // The possible formats are:
299  //
300  // * `jsonl`
301  // The JSON Lines format, where each instance is a single line. Uses
302  // [GcsSource][google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig.gcs_source].
303  //
304  // * `csv`
305  // The CSV format, where each instance is a single comma-separated line.
306  // The first line in the file is the header, containing comma-separated field
307  // names. Uses
308  // [GcsSource][google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig.gcs_source].
309  //
310  // * `tf-record`
311  // The TFRecord format, where each instance is a single record in tfrecord
312  // syntax. Uses
313  // [GcsSource][google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig.gcs_source].
314  //
315  // * `tf-record-gzip`
316  // Similar to `tf-record`, but the file is gzipped. Uses
317  // [GcsSource][google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig.gcs_source].
318  //
319  // * `bigquery`
320  // Each instance is a single row in BigQuery. Uses
321  // [BigQuerySource][google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig.bigquery_source].
322  //
323  // * `file-list`
324  // Each line of the file is the location of an instance to process, uses
325  // `gcs_source` field of the
326  // [InputConfig][google.cloud.aiplatform.v1.BatchPredictionJob.InputConfig]
327  // object.
328  //
329  //
330  // If this Model doesn't support any of these formats it means it cannot be
331  // used with a
332  // [BatchPredictionJob][google.cloud.aiplatform.v1.BatchPredictionJob].
333  // However, if it has
334  // [supported_deployment_resources_types][google.cloud.aiplatform.v1.Model.supported_deployment_resources_types],
335  // it could serve online predictions by using
336  // [PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict]
337  // or
338  // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain].
339  repeated string supported_input_storage_formats = 11
340      [(google.api.field_behavior) = OUTPUT_ONLY];
341
342  // Output only. The formats this Model supports in
343  // [BatchPredictionJob.output_config][google.cloud.aiplatform.v1.BatchPredictionJob.output_config].
344  // If both
345  // [PredictSchemata.instance_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.instance_schema_uri]
346  // and
347  // [PredictSchemata.prediction_schema_uri][google.cloud.aiplatform.v1.PredictSchemata.prediction_schema_uri]
348  // exist, the predictions are returned together with their instances. In other
349  // words, the prediction has the original instance data first, followed by the
350  // actual prediction content (as per the schema).
351  //
352  // The possible formats are:
353  //
354  // * `jsonl`
355  // The JSON Lines format, where each prediction is a single line. Uses
356  // [GcsDestination][google.cloud.aiplatform.v1.BatchPredictionJob.OutputConfig.gcs_destination].
357  //
358  // * `csv`
359  // The CSV format, where each prediction is a single comma-separated line.
360  // The first line in the file is the header, containing comma-separated field
361  // names. Uses
362  // [GcsDestination][google.cloud.aiplatform.v1.BatchPredictionJob.OutputConfig.gcs_destination].
363  //
364  // * `bigquery`
365  // Each prediction is a single row in a BigQuery table, uses
366  // [BigQueryDestination][google.cloud.aiplatform.v1.BatchPredictionJob.OutputConfig.bigquery_destination]
367  // .
368  //
369  //
370  // If this Model doesn't support any of these formats it means it cannot be
371  // used with a
372  // [BatchPredictionJob][google.cloud.aiplatform.v1.BatchPredictionJob].
373  // However, if it has
374  // [supported_deployment_resources_types][google.cloud.aiplatform.v1.Model.supported_deployment_resources_types],
375  // it could serve online predictions by using
376  // [PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict]
377  // or
378  // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain].
379  repeated string supported_output_storage_formats = 12
380      [(google.api.field_behavior) = OUTPUT_ONLY];
381
382  // Output only. Timestamp when this Model was uploaded into Vertex AI.
383  google.protobuf.Timestamp create_time = 13
384      [(google.api.field_behavior) = OUTPUT_ONLY];
385
386  // Output only. Timestamp when this Model was most recently updated.
387  google.protobuf.Timestamp update_time = 14
388      [(google.api.field_behavior) = OUTPUT_ONLY];
389
390  // Output only. The pointers to DeployedModels created from this Model. Note
391  // that Model could have been deployed to Endpoints in different Locations.
392  repeated DeployedModelRef deployed_models = 15
393      [(google.api.field_behavior) = OUTPUT_ONLY];
394
395  // The default explanation specification for this Model.
396  //
397  // The Model can be used for
398  // [requesting
399  // explanation][google.cloud.aiplatform.v1.PredictionService.Explain] after
400  // being [deployed][google.cloud.aiplatform.v1.EndpointService.DeployModel] if
401  // it is populated. The Model can be used for [batch
402  // explanation][google.cloud.aiplatform.v1.BatchPredictionJob.generate_explanation]
403  // if it is populated.
404  //
405  // All fields of the explanation_spec can be overridden by
406  // [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
407  // of
408  // [DeployModelRequest.deployed_model][google.cloud.aiplatform.v1.DeployModelRequest.deployed_model],
409  // or
410  // [explanation_spec][google.cloud.aiplatform.v1.BatchPredictionJob.explanation_spec]
411  // of [BatchPredictionJob][google.cloud.aiplatform.v1.BatchPredictionJob].
412  //
413  // If the default explanation specification is not set for this Model, this
414  // Model can still be used for
415  // [requesting
416  // explanation][google.cloud.aiplatform.v1.PredictionService.Explain] by
417  // setting
418  // [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec]
419  // of
420  // [DeployModelRequest.deployed_model][google.cloud.aiplatform.v1.DeployModelRequest.deployed_model]
421  // and for [batch
422  // explanation][google.cloud.aiplatform.v1.BatchPredictionJob.generate_explanation]
423  // by setting
424  // [explanation_spec][google.cloud.aiplatform.v1.BatchPredictionJob.explanation_spec]
425  // of [BatchPredictionJob][google.cloud.aiplatform.v1.BatchPredictionJob].
426  ExplanationSpec explanation_spec = 23;
427
428  // Used to perform consistent read-modify-write updates. If not set, a blind
429  // "overwrite" update happens.
430  string etag = 16;
431
432  // The labels with user-defined metadata to organize your Models.
433  //
434  // Label keys and values can be no longer than 64 characters
435  // (Unicode codepoints), can only contain lowercase letters, numeric
436  // characters, underscores and dashes. International characters are allowed.
437  //
438  // See https://goo.gl/xmQnxf for more information and examples of labels.
439  map<string, string> labels = 17;
440
441  // Stats of data used for training or evaluating the Model.
442  //
443  // Only populated when the Model is trained by a TrainingPipeline with
444  // [data_input_config][TrainingPipeline.data_input_config].
445  DataStats data_stats = 21;
446
447  // Customer-managed encryption key spec for a Model. If set, this
448  // Model and all sub-resources of this Model will be secured by this key.
449  EncryptionSpec encryption_spec = 24;
450
451  // Output only. Source of a model. It can either be automl training pipeline,
452  // custom training pipeline, BigQuery ML, or saved and tuned from Genie or
453  // Model Garden.
454  ModelSourceInfo model_source_info = 38
455      [(google.api.field_behavior) = OUTPUT_ONLY];
456
457  // Output only. If this Model is a copy of another Model, this contains info
458  // about the original.
459  OriginalModelInfo original_model_info = 34
460      [(google.api.field_behavior) = OUTPUT_ONLY];
461
462  // Output only. The resource name of the Artifact that was created in
463  // MetadataStore when creating the Model. The Artifact resource name pattern
464  // is
465  // `projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}`.
466  string metadata_artifact = 44 [(google.api.field_behavior) = OUTPUT_ONLY];
467
468  // Optional. User input field to specify the base model source. Currently it
469  // only supports specifing the Model Garden models and Genie models.
470  BaseModelSource base_model_source = 50
471      [(google.api.field_behavior) = OPTIONAL];
472}
473
474// Contains information about the Large Model.
475message LargeModelReference {
476  // Required. The unique name of the large Foundation or pre-built model. Like
477  // "chat-bison", "text-bison". Or model name with version ID, like
478  // "chat-bison@001", "text-bison@005", etc.
479  string name = 1 [(google.api.field_behavior) = REQUIRED];
480}
481
482// Contains information about the source of the models generated from Model
483// Garden.
484message ModelGardenSource {
485  // Required. The model garden source model resource name.
486  string public_model_name = 1 [(google.api.field_behavior) = REQUIRED];
487}
488
489// Contains information about the source of the models generated from Generative
490// AI Studio.
491message GenieSource {
492  // Required. The public base model URI.
493  string base_model_uri = 1 [(google.api.field_behavior) = REQUIRED];
494}
495
496// Contains the schemata used in Model's predictions and explanations via
497// [PredictionService.Predict][google.cloud.aiplatform.v1.PredictionService.Predict],
498// [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain]
499// and [BatchPredictionJob][google.cloud.aiplatform.v1.BatchPredictionJob].
500message PredictSchemata {
501  // Immutable. Points to a YAML file stored on Google Cloud Storage describing
502  // the format of a single instance, which are used in
503  // [PredictRequest.instances][google.cloud.aiplatform.v1.PredictRequest.instances],
504  // [ExplainRequest.instances][google.cloud.aiplatform.v1.ExplainRequest.instances]
505  // and
506  // [BatchPredictionJob.input_config][google.cloud.aiplatform.v1.BatchPredictionJob.input_config].
507  // The schema is defined as an OpenAPI 3.0.2 [Schema
508  // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
509  // AutoML Models always have this field populated by Vertex AI.
510  // Note: The URI given on output will be immutable and probably different,
511  // including the URI scheme, than the one given on input. The output URI will
512  // point to a location where the user only has a read access.
513  string instance_schema_uri = 1 [(google.api.field_behavior) = IMMUTABLE];
514
515  // Immutable. Points to a YAML file stored on Google Cloud Storage describing
516  // the parameters of prediction and explanation via
517  // [PredictRequest.parameters][google.cloud.aiplatform.v1.PredictRequest.parameters],
518  // [ExplainRequest.parameters][google.cloud.aiplatform.v1.ExplainRequest.parameters]
519  // and
520  // [BatchPredictionJob.model_parameters][google.cloud.aiplatform.v1.BatchPredictionJob.model_parameters].
521  // The schema is defined as an OpenAPI 3.0.2 [Schema
522  // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
523  // AutoML Models always have this field populated by Vertex AI, if no
524  // parameters are supported, then it is set to an empty string.
525  // Note: The URI given on output will be immutable and probably different,
526  // including the URI scheme, than the one given on input. The output URI will
527  // point to a location where the user only has a read access.
528  string parameters_schema_uri = 2 [(google.api.field_behavior) = IMMUTABLE];
529
530  // Immutable. Points to a YAML file stored on Google Cloud Storage describing
531  // the format of a single prediction produced by this Model, which are
532  // returned via
533  // [PredictResponse.predictions][google.cloud.aiplatform.v1.PredictResponse.predictions],
534  // [ExplainResponse.explanations][google.cloud.aiplatform.v1.ExplainResponse.explanations],
535  // and
536  // [BatchPredictionJob.output_config][google.cloud.aiplatform.v1.BatchPredictionJob.output_config].
537  // The schema is defined as an OpenAPI 3.0.2 [Schema
538  // Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#schemaObject).
539  // AutoML Models always have this field populated by Vertex AI.
540  // Note: The URI given on output will be immutable and probably different,
541  // including the URI scheme, than the one given on input. The output URI will
542  // point to a location where the user only has a read access.
543  string prediction_schema_uri = 3 [(google.api.field_behavior) = IMMUTABLE];
544}
545
546// Specification of a container for serving predictions. Some fields in this
547// message correspond to fields in the [Kubernetes Container v1 core
548// specification](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#container-v1-core).
549message ModelContainerSpec {
550  // Required. Immutable. URI of the Docker image to be used as the custom
551  // container for serving predictions. This URI must identify an image in
552  // Artifact Registry or Container Registry. Learn more about the [container
553  // publishing
554  // requirements](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#publishing),
555  // including permissions requirements for the Vertex AI Service Agent.
556  //
557  // The container image is ingested upon
558  // [ModelService.UploadModel][google.cloud.aiplatform.v1.ModelService.UploadModel],
559  // stored internally, and this original path is afterwards not used.
560  //
561  // To learn about the requirements for the Docker image itself, see
562  // [Custom container
563  // requirements](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#).
564  //
565  // You can use the URI to one of Vertex AI's [pre-built container images for
566  // prediction](https://cloud.google.com/vertex-ai/docs/predictions/pre-built-containers)
567  // in this field.
568  string image_uri = 1 [
569    (google.api.field_behavior) = REQUIRED,
570    (google.api.field_behavior) = IMMUTABLE
571  ];
572
573  // Immutable. Specifies the command that runs when the container starts. This
574  // overrides the container's
575  // [ENTRYPOINT](https://docs.docker.com/engine/reference/builder/#entrypoint).
576  // Specify this field as an array of executable and arguments, similar to a
577  // Docker `ENTRYPOINT`'s "exec" form, not its "shell" form.
578  //
579  // If you do not specify this field, then the container's `ENTRYPOINT` runs,
580  // in conjunction with the
581  // [args][google.cloud.aiplatform.v1.ModelContainerSpec.args] field or the
582  // container's [`CMD`](https://docs.docker.com/engine/reference/builder/#cmd),
583  // if either exists. If this field is not specified and the container does not
584  // have an `ENTRYPOINT`, then refer to the Docker documentation about [how
585  // `CMD` and `ENTRYPOINT`
586  // interact](https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact).
587  //
588  // If you specify this field, then you can also specify the `args` field to
589  // provide additional arguments for this command. However, if you specify this
590  // field, then the container's `CMD` is ignored. See the
591  // [Kubernetes documentation about how the
592  // `command` and `args` fields interact with a container's `ENTRYPOINT` and
593  // `CMD`](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes).
594  //
595  // In this field, you can reference [environment variables set by Vertex
596  // AI](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables)
597  // and environment variables set in the
598  // [env][google.cloud.aiplatform.v1.ModelContainerSpec.env] field. You cannot
599  // reference environment variables set in the Docker image. In order for
600  // environment variables to be expanded, reference them by using the following
601  // syntax: <code>$(<var>VARIABLE_NAME</var>)</code> Note that this differs
602  // from Bash variable expansion, which does not use parentheses. If a variable
603  // cannot be resolved, the reference in the input string is used unchanged. To
604  // avoid variable expansion, you can escape this syntax with `$$`; for
605  // example: <code>$$(<var>VARIABLE_NAME</var>)</code> This field corresponds
606  // to the `command` field of the Kubernetes Containers [v1 core
607  // API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#container-v1-core).
608  repeated string command = 2 [(google.api.field_behavior) = IMMUTABLE];
609
610  // Immutable. Specifies arguments for the command that runs when the container
611  // starts. This overrides the container's
612  // [`CMD`](https://docs.docker.com/engine/reference/builder/#cmd). Specify
613  // this field as an array of executable and arguments, similar to a Docker
614  // `CMD`'s "default parameters" form.
615  //
616  // If you don't specify this field but do specify the
617  // [command][google.cloud.aiplatform.v1.ModelContainerSpec.command] field,
618  // then the command from the `command` field runs without any additional
619  // arguments. See the [Kubernetes documentation about how the `command` and
620  // `args` fields interact with a container's `ENTRYPOINT` and
621  // `CMD`](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes).
622  //
623  // If you don't specify this field and don't specify the `command` field,
624  // then the container's
625  // [`ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#cmd) and
626  // `CMD` determine what runs based on their default behavior. See the Docker
627  // documentation about [how `CMD` and `ENTRYPOINT`
628  // interact](https://docs.docker.com/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact).
629  //
630  // In this field, you can reference [environment variables
631  // set by Vertex
632  // AI](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables)
633  // and environment variables set in the
634  // [env][google.cloud.aiplatform.v1.ModelContainerSpec.env] field. You cannot
635  // reference environment variables set in the Docker image. In order for
636  // environment variables to be expanded, reference them by using the following
637  // syntax: <code>$(<var>VARIABLE_NAME</var>)</code> Note that this differs
638  // from Bash variable expansion, which does not use parentheses. If a variable
639  // cannot be resolved, the reference in the input string is used unchanged. To
640  // avoid variable expansion, you can escape this syntax with `$$`; for
641  // example: <code>$$(<var>VARIABLE_NAME</var>)</code> This field corresponds
642  // to the `args` field of the Kubernetes Containers [v1 core
643  // API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#container-v1-core).
644  repeated string args = 3 [(google.api.field_behavior) = IMMUTABLE];
645
646  // Immutable. List of environment variables to set in the container. After the
647  // container starts running, code running in the container can read these
648  // environment variables.
649  //
650  // Additionally, the
651  // [command][google.cloud.aiplatform.v1.ModelContainerSpec.command] and
652  // [args][google.cloud.aiplatform.v1.ModelContainerSpec.args] fields can
653  // reference these variables. Later entries in this list can also reference
654  // earlier entries. For example, the following example sets the variable
655  // `VAR_2` to have the value `foo bar`:
656  //
657  // ```json
658  // [
659  //   {
660  //     "name": "VAR_1",
661  //     "value": "foo"
662  //   },
663  //   {
664  //     "name": "VAR_2",
665  //     "value": "$(VAR_1) bar"
666  //   }
667  // ]
668  // ```
669  //
670  // If you switch the order of the variables in the example, then the expansion
671  // does not occur.
672  //
673  // This field corresponds to the `env` field of the Kubernetes Containers
674  // [v1 core
675  // API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#container-v1-core).
676  repeated EnvVar env = 4 [(google.api.field_behavior) = IMMUTABLE];
677
678  // Immutable. List of ports to expose from the container. Vertex AI sends any
679  // prediction requests that it receives to the first port on this list. Vertex
680  // AI also sends
681  // [liveness and health
682  // checks](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#liveness)
683  // to this port.
684  //
685  // If you do not specify this field, it defaults to following value:
686  //
687  // ```json
688  // [
689  //   {
690  //     "containerPort": 8080
691  //   }
692  // ]
693  // ```
694  //
695  // Vertex AI does not use ports other than the first one listed. This field
696  // corresponds to the `ports` field of the Kubernetes Containers
697  // [v1 core
698  // API](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#container-v1-core).
699  repeated Port ports = 5 [(google.api.field_behavior) = IMMUTABLE];
700
701  // Immutable. HTTP path on the container to send prediction requests to.
702  // Vertex AI forwards requests sent using
703  // [projects.locations.endpoints.predict][google.cloud.aiplatform.v1.PredictionService.Predict]
704  // to this path on the container's IP address and port. Vertex AI then returns
705  // the container's response in the API response.
706  //
707  // For example, if you set this field to `/foo`, then when Vertex AI
708  // receives a prediction request, it forwards the request body in a POST
709  // request to the `/foo` path on the port of your container specified by the
710  // first value of this `ModelContainerSpec`'s
711  // [ports][google.cloud.aiplatform.v1.ModelContainerSpec.ports] field.
712  //
713  // If you don't specify this field, it defaults to the following value when
714  // you [deploy this Model to an
715  // Endpoint][google.cloud.aiplatform.v1.EndpointService.DeployModel]:
716  // <code>/v1/endpoints/<var>ENDPOINT</var>/deployedModels/<var>DEPLOYED_MODEL</var>:predict</code>
717  // The placeholders in this value are replaced as follows:
718  //
719  // * <var>ENDPOINT</var>: The last segment (following `endpoints/`)of the
720  //   Endpoint.name][] field of the Endpoint where this Model has been
721  //   deployed. (Vertex AI makes this value available to your container code
722  //   as the [`AIP_ENDPOINT_ID` environment
723  //  variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).)
724  //
725  // * <var>DEPLOYED_MODEL</var>:
726  // [DeployedModel.id][google.cloud.aiplatform.v1.DeployedModel.id] of the
727  // `DeployedModel`.
728  //   (Vertex AI makes this value available to your container code
729  //   as the [`AIP_DEPLOYED_MODEL_ID` environment
730  //   variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).)
731  string predict_route = 6 [(google.api.field_behavior) = IMMUTABLE];
732
733  // Immutable. HTTP path on the container to send health checks to. Vertex AI
734  // intermittently sends GET requests to this path on the container's IP
735  // address and port to check that the container is healthy. Read more about
736  // [health
737  // checks](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#health).
738  //
739  // For example, if you set this field to `/bar`, then Vertex AI
740  // intermittently sends a GET request to the `/bar` path on the port of your
741  // container specified by the first value of this `ModelContainerSpec`'s
742  // [ports][google.cloud.aiplatform.v1.ModelContainerSpec.ports] field.
743  //
744  // If you don't specify this field, it defaults to the following value when
745  // you [deploy this Model to an
746  // Endpoint][google.cloud.aiplatform.v1.EndpointService.DeployModel]:
747  // <code>/v1/endpoints/<var>ENDPOINT</var>/deployedModels/<var>DEPLOYED_MODEL</var>:predict</code>
748  // The placeholders in this value are replaced as follows:
749  //
750  // * <var>ENDPOINT</var>: The last segment (following `endpoints/`)of the
751  //   Endpoint.name][] field of the Endpoint where this Model has been
752  //   deployed. (Vertex AI makes this value available to your container code
753  //   as the [`AIP_ENDPOINT_ID` environment
754  //   variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).)
755  //
756  // * <var>DEPLOYED_MODEL</var>:
757  // [DeployedModel.id][google.cloud.aiplatform.v1.DeployedModel.id] of the
758  // `DeployedModel`.
759  //   (Vertex AI makes this value available to your container code as the
760  //   [`AIP_DEPLOYED_MODEL_ID` environment
761  //   variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).)
762  string health_route = 7 [(google.api.field_behavior) = IMMUTABLE];
763
764  // Immutable. List of ports to expose from the container. Vertex AI sends gRPC
765  // prediction requests that it receives to the first port on this list. Vertex
766  // AI also sends liveness and health checks to this port.
767  //
768  // If you do not specify this field, gRPC requests to the container will be
769  // disabled.
770  //
771  // Vertex AI does not use ports other than the first one listed. This field
772  // corresponds to the `ports` field of the Kubernetes Containers v1 core API.
773  repeated Port grpc_ports = 9 [(google.api.field_behavior) = IMMUTABLE];
774
775  // Immutable. Deployment timeout.
776  // Limit for deployment timeout is 2 hours.
777  google.protobuf.Duration deployment_timeout = 10
778      [(google.api.field_behavior) = IMMUTABLE];
779
780  // Immutable. The amount of the VM memory to reserve as the shared memory for
781  // the model in megabytes.
782  int64 shared_memory_size_mb = 11 [(google.api.field_behavior) = IMMUTABLE];
783
784  // Immutable. Specification for Kubernetes startup probe.
785  Probe startup_probe = 12 [(google.api.field_behavior) = IMMUTABLE];
786
787  // Immutable. Specification for Kubernetes readiness probe.
788  Probe health_probe = 13 [(google.api.field_behavior) = IMMUTABLE];
789}
790
791// Represents a network port in a container.
792message Port {
793  // The number of the port to expose on the pod's IP address.
794  // Must be a valid port number, between 1 and 65535 inclusive.
795  int32 container_port = 3;
796}
797
798// Detail description of the source information of the model.
799message ModelSourceInfo {
800  // Source of the model.
801  // Different from `objective` field, this `ModelSourceType` enum
802  // indicates the source from which the model was accessed or obtained,
803  // whereas the `objective` indicates the overall aim or function of this
804  // model.
805  enum ModelSourceType {
806    // Should not be used.
807    MODEL_SOURCE_TYPE_UNSPECIFIED = 0;
808
809    // The Model is uploaded by automl training pipeline.
810    AUTOML = 1;
811
812    // The Model is uploaded by user or custom training pipeline.
813    CUSTOM = 2;
814
815    // The Model is registered and sync'ed from BigQuery ML.
816    BQML = 3;
817
818    // The Model is saved or tuned from Model Garden.
819    MODEL_GARDEN = 4;
820
821    // The Model is saved or tuned from Genie.
822    GENIE = 5;
823
824    // The Model is uploaded by text embedding finetuning pipeline.
825    CUSTOM_TEXT_EMBEDDING = 6;
826
827    // The Model is saved or tuned from Marketplace.
828    MARKETPLACE = 7;
829  }
830
831  // Type of the model source.
832  ModelSourceType source_type = 1;
833
834  // If this Model is copy of another Model. If true then
835  // [source_type][google.cloud.aiplatform.v1.ModelSourceInfo.source_type]
836  // pertains to the original.
837  bool copy = 2;
838}
839
840// Probe describes a health check to be performed against a container to
841// determine whether it is alive or ready to receive traffic.
842message Probe {
843  // ExecAction specifies a command to execute.
844  message ExecAction {
845    // Command is the command line to execute inside the container, the working
846    // directory for the command is root ('/') in the container's filesystem.
847    // The command is simply exec'd, it is not run inside a shell, so
848    // traditional shell instructions ('|', etc) won't work. To use a shell, you
849    // need to explicitly call out to that shell. Exit status of 0 is treated as
850    // live/healthy and non-zero is unhealthy.
851    repeated string command = 1;
852  }
853
854  oneof probe_type {
855    // Exec specifies the action to take.
856    ExecAction exec = 1;
857  }
858
859  // How often (in seconds) to perform the probe. Default to 10 seconds.
860  // Minimum value is 1. Must be less than timeout_seconds.
861  //
862  // Maps to Kubernetes probe argument 'periodSeconds'.
863  int32 period_seconds = 2;
864
865  // Number of seconds after which the probe times out. Defaults to 1 second.
866  // Minimum value is 1. Must be greater or equal to period_seconds.
867  //
868  // Maps to Kubernetes probe argument 'timeoutSeconds'.
869  int32 timeout_seconds = 3;
870}
871