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.v1beta1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/cloud/aiplatform/v1beta1/completion_stats.proto"; 22import "google/cloud/aiplatform/v1beta1/encryption_spec.proto"; 23import "google/cloud/aiplatform/v1beta1/explanation.proto"; 24import "google/cloud/aiplatform/v1beta1/io.proto"; 25import "google/cloud/aiplatform/v1beta1/job_state.proto"; 26import "google/cloud/aiplatform/v1beta1/machine_resources.proto"; 27import "google/cloud/aiplatform/v1beta1/manual_batch_tuning_parameters.proto"; 28import "google/cloud/aiplatform/v1beta1/model_deployment_monitoring_job.proto"; 29import "google/cloud/aiplatform/v1beta1/model_monitoring.proto"; 30import "google/cloud/aiplatform/v1beta1/unmanaged_container_model.proto"; 31import "google/protobuf/struct.proto"; 32import "google/protobuf/timestamp.proto"; 33import "google/rpc/status.proto"; 34 35option csharp_namespace = "Google.Cloud.AIPlatform.V1Beta1"; 36option go_package = "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb;aiplatformpb"; 37option java_multiple_files = true; 38option java_outer_classname = "BatchPredictionJobProto"; 39option java_package = "com.google.cloud.aiplatform.v1beta1"; 40option php_namespace = "Google\\Cloud\\AIPlatform\\V1beta1"; 41option ruby_package = "Google::Cloud::AIPlatform::V1beta1"; 42 43// A job that uses a 44// [Model][google.cloud.aiplatform.v1beta1.BatchPredictionJob.model] to produce 45// predictions on multiple [input 46// instances][google.cloud.aiplatform.v1beta1.BatchPredictionJob.input_config]. 47// If predictions for significant portion of the instances fail, the job may 48// finish without attempting predictions for all remaining instances. 49message BatchPredictionJob { 50 option (google.api.resource) = { 51 type: "aiplatform.googleapis.com/BatchPredictionJob" 52 pattern: "projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}" 53 }; 54 55 // Configures the input to 56 // [BatchPredictionJob][google.cloud.aiplatform.v1beta1.BatchPredictionJob]. 57 // See 58 // [Model.supported_input_storage_formats][google.cloud.aiplatform.v1beta1.Model.supported_input_storage_formats] 59 // for Model's supported input formats, and how instances should be expressed 60 // via any of them. 61 message InputConfig { 62 // Required. The source of the input. 63 oneof source { 64 // The Cloud Storage location for the input instances. 65 GcsSource gcs_source = 2; 66 67 // The BigQuery location of the input table. 68 // The schema of the table should be in the format described by the given 69 // context OpenAPI Schema, if one is provided. The table may contain 70 // additional columns that are not described by the schema, and they will 71 // be ignored. 72 BigQuerySource bigquery_source = 3; 73 } 74 75 // Required. The format in which instances are given, must be one of the 76 // [Model's][google.cloud.aiplatform.v1beta1.BatchPredictionJob.model] 77 // [supported_input_storage_formats][google.cloud.aiplatform.v1beta1.Model.supported_input_storage_formats]. 78 string instances_format = 1 [(google.api.field_behavior) = REQUIRED]; 79 } 80 81 // Configuration defining how to transform batch prediction input instances to 82 // the instances that the Model accepts. 83 message InstanceConfig { 84 // The format of the instance that the Model accepts. Vertex AI will 85 // convert compatible 86 // [batch prediction input instance 87 // formats][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InputConfig.instances_format] 88 // to the specified format. 89 // 90 // Supported values are: 91 // 92 // * `object`: Each input is converted to JSON object format. 93 // * For `bigquery`, each row is converted to an object. 94 // * For `jsonl`, each line of the JSONL input must be an object. 95 // * Does not apply to `csv`, `file-list`, `tf-record`, or 96 // `tf-record-gzip`. 97 // 98 // * `array`: Each input is converted to JSON array format. 99 // * For `bigquery`, each row is converted to an array. The order 100 // of columns is determined by the BigQuery column order, unless 101 // [included_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.included_fields] 102 // is populated. 103 // [included_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.included_fields] 104 // must be populated for specifying field orders. 105 // * For `jsonl`, if each line of the JSONL input is an object, 106 // [included_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.included_fields] 107 // must be populated for specifying field orders. 108 // * Does not apply to `csv`, `file-list`, `tf-record`, or 109 // `tf-record-gzip`. 110 // 111 // If not specified, Vertex AI converts the batch prediction input as 112 // follows: 113 // 114 // * For `bigquery` and `csv`, the behavior is the same as `array`. The 115 // order of columns is the same as defined in the file or table, unless 116 // [included_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.included_fields] 117 // is populated. 118 // * For `jsonl`, the prediction instance format is determined by 119 // each line of the input. 120 // * For `tf-record`/`tf-record-gzip`, each record will be converted to 121 // an object in the format of `{"b64": <value>}`, where `<value>` is 122 // the Base64-encoded string of the content of the record. 123 // * For `file-list`, each file in the list will be converted to an 124 // object in the format of `{"b64": <value>}`, where `<value>` is 125 // the Base64-encoded string of the content of the file. 126 string instance_type = 1; 127 128 // The name of the field that is considered as a key. 129 // 130 // The values identified by the key field is not included in the transformed 131 // instances that is sent to the Model. This is similar to 132 // specifying this name of the field in 133 // [excluded_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.excluded_fields]. 134 // In addition, the batch prediction output will not include the instances. 135 // Instead the output will only include the value of the key field, in a 136 // field named `key` in the output: 137 // 138 // * For `jsonl` output format, the output will have a `key` field 139 // instead of the `instance` field. 140 // * For `csv`/`bigquery` output format, the output will have have a `key` 141 // column instead of the instance feature columns. 142 // 143 // The input must be JSONL with objects at each line, CSV, BigQuery 144 // or TfRecord. 145 string key_field = 2; 146 147 // Fields that will be included in the prediction instance that is 148 // sent to the Model. 149 // 150 // If 151 // [instance_type][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.instance_type] 152 // is `array`, the order of field names in included_fields also determines 153 // the order of the values in the array. 154 // 155 // When included_fields is populated, 156 // [excluded_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.excluded_fields] 157 // must be empty. 158 // 159 // The input must be JSONL with objects at each line, BigQuery 160 // or TfRecord. 161 repeated string included_fields = 3; 162 163 // Fields that will be excluded in the prediction instance that is 164 // sent to the Model. 165 // 166 // Excluded will be attached to the batch prediction output if 167 // [key_field][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.key_field] 168 // is not specified. 169 // 170 // When excluded_fields is populated, 171 // [included_fields][google.cloud.aiplatform.v1beta1.BatchPredictionJob.InstanceConfig.included_fields] 172 // must be empty. 173 // 174 // The input must be JSONL with objects at each line, BigQuery 175 // or TfRecord. 176 repeated string excluded_fields = 4; 177 } 178 179 // Configures the output of 180 // [BatchPredictionJob][google.cloud.aiplatform.v1beta1.BatchPredictionJob]. 181 // See 182 // [Model.supported_output_storage_formats][google.cloud.aiplatform.v1beta1.Model.supported_output_storage_formats] 183 // for supported output formats, and how predictions are expressed via any of 184 // them. 185 message OutputConfig { 186 // Required. The destination of the output. 187 oneof destination { 188 // The Cloud Storage location of the directory where the output is 189 // to be written to. In the given directory a new directory is created. 190 // Its name is `prediction-<model-display-name>-<job-create-time>`, 191 // where timestamp is in YYYY-MM-DDThh:mm:ss.sssZ ISO-8601 format. 192 // Inside of it files `predictions_0001.<extension>`, 193 // `predictions_0002.<extension>`, ..., `predictions_N.<extension>` 194 // are created where `<extension>` depends on chosen 195 // [predictions_format][google.cloud.aiplatform.v1beta1.BatchPredictionJob.OutputConfig.predictions_format], 196 // and N may equal 0001 and depends on the total number of successfully 197 // predicted instances. If the Model has both 198 // [instance][google.cloud.aiplatform.v1beta1.PredictSchemata.instance_schema_uri] 199 // and 200 // [prediction][google.cloud.aiplatform.v1beta1.PredictSchemata.parameters_schema_uri] 201 // schemata defined then each such file contains predictions as per the 202 // [predictions_format][google.cloud.aiplatform.v1beta1.BatchPredictionJob.OutputConfig.predictions_format]. 203 // If prediction for any instance failed (partially or completely), then 204 // an additional `errors_0001.<extension>`, `errors_0002.<extension>`,..., 205 // `errors_N.<extension>` files are created (N depends on total number 206 // of failed predictions). These files contain the failed instances, 207 // as per their schema, followed by an additional `error` field which as 208 // value has [google.rpc.Status][google.rpc.Status] 209 // containing only `code` and `message` fields. 210 GcsDestination gcs_destination = 2; 211 212 // The BigQuery project or dataset location where the output is to be 213 // written to. If project is provided, a new dataset is created with name 214 // `prediction_<model-display-name>_<job-create-time>` 215 // where <model-display-name> is made 216 // BigQuery-dataset-name compatible (for example, most special characters 217 // become underscores), and timestamp is in 218 // YYYY_MM_DDThh_mm_ss_sssZ "based on ISO-8601" format. In the dataset 219 // two tables will be created, `predictions`, and `errors`. 220 // If the Model has both 221 // [instance][google.cloud.aiplatform.v1beta1.PredictSchemata.instance_schema_uri] 222 // and 223 // [prediction][google.cloud.aiplatform.v1beta1.PredictSchemata.parameters_schema_uri] 224 // schemata defined then the tables have columns as follows: The 225 // `predictions` table contains instances for which the prediction 226 // succeeded, it has columns as per a concatenation of the Model's 227 // instance and prediction schemata. The `errors` table contains rows for 228 // which the prediction has failed, it has instance columns, as per the 229 // instance schema, followed by a single "errors" column, which as values 230 // has [google.rpc.Status][google.rpc.Status] 231 // represented as a STRUCT, and containing only `code` and `message`. 232 BigQueryDestination bigquery_destination = 3; 233 } 234 235 // Required. The format in which Vertex AI gives the predictions, must be 236 // one of the 237 // [Model's][google.cloud.aiplatform.v1beta1.BatchPredictionJob.model] 238 // [supported_output_storage_formats][google.cloud.aiplatform.v1beta1.Model.supported_output_storage_formats]. 239 string predictions_format = 1 [(google.api.field_behavior) = REQUIRED]; 240 } 241 242 // Further describes this job's output. 243 // Supplements 244 // [output_config][google.cloud.aiplatform.v1beta1.BatchPredictionJob.output_config]. 245 message OutputInfo { 246 // The output location into which prediction output is written. 247 oneof output_location { 248 // Output only. The full path of the Cloud Storage directory created, into 249 // which the prediction output is written. 250 string gcs_output_directory = 1 251 [(google.api.field_behavior) = OUTPUT_ONLY]; 252 253 // Output only. The path of the BigQuery dataset created, in 254 // `bq://projectId.bqDatasetId` 255 // format, into which the prediction output is written. 256 string bigquery_output_dataset = 2 257 [(google.api.field_behavior) = OUTPUT_ONLY]; 258 } 259 260 // Output only. The name of the BigQuery table created, in 261 // `predictions_<timestamp>` 262 // format, into which the prediction output is written. 263 // Can be used by UI to generate the BigQuery output path, for example. 264 string bigquery_output_table = 4 265 [(google.api.field_behavior) = OUTPUT_ONLY]; 266 } 267 268 // Output only. Resource name of the BatchPredictionJob. 269 string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 270 271 // Required. The user-defined name of this BatchPredictionJob. 272 string display_name = 2 [(google.api.field_behavior) = REQUIRED]; 273 274 // The name of the Model resource that produces the predictions via this job, 275 // must share the same ancestor Location. 276 // Starting this job has no impact on any existing deployments of the Model 277 // and their resources. 278 // Exactly one of model and unmanaged_container_model must be set. 279 // 280 // The model resource name may contain version id or version alias to specify 281 // the version. 282 // Example: `projects/{project}/locations/{location}/models/{model}@2` 283 // or 284 // `projects/{project}/locations/{location}/models/{model}@golden` 285 // if no version is specified, the default version will be deployed. 286 // 287 // The model resource could also be a publisher model. 288 // Example: `publishers/{publisher}/models/{model}` 289 // or 290 // `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}` 291 string model = 3 [(google.api.resource_reference) = { 292 type: "aiplatform.googleapis.com/Model" 293 }]; 294 295 // Output only. The version ID of the Model that produces the predictions via 296 // this job. 297 string model_version_id = 30 [(google.api.field_behavior) = OUTPUT_ONLY]; 298 299 // Contains model information necessary to perform batch prediction without 300 // requiring uploading to model registry. 301 // Exactly one of model and unmanaged_container_model must be set. 302 UnmanagedContainerModel unmanaged_container_model = 28; 303 304 // Required. Input configuration of the instances on which predictions are 305 // performed. The schema of any single instance may be specified via the 306 // [Model's][google.cloud.aiplatform.v1beta1.BatchPredictionJob.model] 307 // [PredictSchemata's][google.cloud.aiplatform.v1beta1.Model.predict_schemata] 308 // [instance_schema_uri][google.cloud.aiplatform.v1beta1.PredictSchemata.instance_schema_uri]. 309 InputConfig input_config = 4 [(google.api.field_behavior) = REQUIRED]; 310 311 // Configuration for how to convert batch prediction input instances to the 312 // prediction instances that are sent to the Model. 313 InstanceConfig instance_config = 27; 314 315 // The parameters that govern the predictions. The schema of the parameters 316 // may be specified via the 317 // [Model's][google.cloud.aiplatform.v1beta1.BatchPredictionJob.model] 318 // [PredictSchemata's][google.cloud.aiplatform.v1beta1.Model.predict_schemata] 319 // [parameters_schema_uri][google.cloud.aiplatform.v1beta1.PredictSchemata.parameters_schema_uri]. 320 google.protobuf.Value model_parameters = 5; 321 322 // Required. The Configuration specifying where output predictions should 323 // be written. 324 // The schema of any single prediction may be specified as a concatenation 325 // of [Model's][google.cloud.aiplatform.v1beta1.BatchPredictionJob.model] 326 // [PredictSchemata's][google.cloud.aiplatform.v1beta1.Model.predict_schemata] 327 // [instance_schema_uri][google.cloud.aiplatform.v1beta1.PredictSchemata.instance_schema_uri] 328 // and 329 // [prediction_schema_uri][google.cloud.aiplatform.v1beta1.PredictSchemata.prediction_schema_uri]. 330 OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; 331 332 // The config of resources used by the Model during the batch prediction. If 333 // the Model 334 // [supports][google.cloud.aiplatform.v1beta1.Model.supported_deployment_resources_types] 335 // DEDICATED_RESOURCES this config may be provided (and the job will use these 336 // resources), if the Model doesn't support AUTOMATIC_RESOURCES, this config 337 // must be provided. 338 BatchDedicatedResources dedicated_resources = 7; 339 340 // The service account that the DeployedModel's container runs as. If not 341 // specified, a system generated one will be used, which 342 // has minimal permissions and the custom container, if used, may not have 343 // enough permission to access other Google Cloud resources. 344 // 345 // Users deploying the Model must have the `iam.serviceAccounts.actAs` 346 // permission on this service account. 347 string service_account = 29; 348 349 // Immutable. Parameters configuring the batch behavior. Currently only 350 // applicable when 351 // [dedicated_resources][google.cloud.aiplatform.v1beta1.BatchPredictionJob.dedicated_resources] 352 // are used (in other cases Vertex AI does the tuning itself). 353 ManualBatchTuningParameters manual_batch_tuning_parameters = 8 354 [(google.api.field_behavior) = IMMUTABLE]; 355 356 // Generate explanation with the batch prediction results. 357 // 358 // When set to `true`, the batch prediction output changes based on the 359 // `predictions_format` field of the 360 // [BatchPredictionJob.output_config][google.cloud.aiplatform.v1beta1.BatchPredictionJob.output_config] 361 // object: 362 // 363 // * `bigquery`: output includes a column named `explanation`. The value 364 // is a struct that conforms to the 365 // [Explanation][google.cloud.aiplatform.v1beta1.Explanation] object. 366 // * `jsonl`: The JSON objects on each line include an additional entry 367 // keyed `explanation`. The value of the entry is a JSON object that 368 // conforms to the 369 // [Explanation][google.cloud.aiplatform.v1beta1.Explanation] object. 370 // * `csv`: Generating explanations for CSV format is not supported. 371 // 372 // If this field is set to true, either the 373 // [Model.explanation_spec][google.cloud.aiplatform.v1beta1.Model.explanation_spec] 374 // or 375 // [explanation_spec][google.cloud.aiplatform.v1beta1.BatchPredictionJob.explanation_spec] 376 // must be populated. 377 bool generate_explanation = 23; 378 379 // Explanation configuration for this BatchPredictionJob. Can be 380 // specified only if 381 // [generate_explanation][google.cloud.aiplatform.v1beta1.BatchPredictionJob.generate_explanation] 382 // is set to `true`. 383 // 384 // This value overrides the value of 385 // [Model.explanation_spec][google.cloud.aiplatform.v1beta1.Model.explanation_spec]. 386 // All fields of 387 // [explanation_spec][google.cloud.aiplatform.v1beta1.BatchPredictionJob.explanation_spec] 388 // are optional in the request. If a field of the 389 // [explanation_spec][google.cloud.aiplatform.v1beta1.BatchPredictionJob.explanation_spec] 390 // object is not populated, the corresponding field of the 391 // [Model.explanation_spec][google.cloud.aiplatform.v1beta1.Model.explanation_spec] 392 // object is inherited. 393 ExplanationSpec explanation_spec = 25; 394 395 // Output only. Information further describing the output of this job. 396 OutputInfo output_info = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; 397 398 // Output only. The detailed state of the job. 399 JobState state = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; 400 401 // Output only. Only populated when the job's state is JOB_STATE_FAILED or 402 // JOB_STATE_CANCELLED. 403 google.rpc.Status error = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; 404 405 // Output only. Partial failures encountered. 406 // For example, single files that can't be read. 407 // This field never exceeds 20 entries. 408 // Status details fields contain standard Google Cloud error details. 409 repeated google.rpc.Status partial_failures = 12 410 [(google.api.field_behavior) = OUTPUT_ONLY]; 411 412 // Output only. Information about resources that had been consumed by this 413 // job. Provided in real time at best effort basis, as well as a final value 414 // once the job completes. 415 // 416 // Note: This field currently may be not populated for batch predictions that 417 // use AutoML Models. 418 ResourcesConsumed resources_consumed = 13 419 [(google.api.field_behavior) = OUTPUT_ONLY]; 420 421 // Output only. Statistics on completed and failed prediction instances. 422 CompletionStats completion_stats = 14 423 [(google.api.field_behavior) = OUTPUT_ONLY]; 424 425 // Output only. Time when the BatchPredictionJob was created. 426 google.protobuf.Timestamp create_time = 15 427 [(google.api.field_behavior) = OUTPUT_ONLY]; 428 429 // Output only. Time when the BatchPredictionJob for the first time entered 430 // the `JOB_STATE_RUNNING` state. 431 google.protobuf.Timestamp start_time = 16 432 [(google.api.field_behavior) = OUTPUT_ONLY]; 433 434 // Output only. Time when the BatchPredictionJob entered any of the following 435 // states: `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`. 436 google.protobuf.Timestamp end_time = 17 437 [(google.api.field_behavior) = OUTPUT_ONLY]; 438 439 // Output only. Time when the BatchPredictionJob was most recently updated. 440 google.protobuf.Timestamp update_time = 18 441 [(google.api.field_behavior) = OUTPUT_ONLY]; 442 443 // The labels with user-defined metadata to organize BatchPredictionJobs. 444 // 445 // Label keys and values can be no longer than 64 characters 446 // (Unicode codepoints), can only contain lowercase letters, numeric 447 // characters, underscores and dashes. International characters are allowed. 448 // 449 // See https://goo.gl/xmQnxf for more information and examples of labels. 450 map<string, string> labels = 19; 451 452 // Customer-managed encryption key options for a BatchPredictionJob. If this 453 // is set, then all resources created by the BatchPredictionJob will be 454 // encrypted with the provided encryption key. 455 EncryptionSpec encryption_spec = 24; 456 457 // Model monitoring config will be used for analysis model behaviors, based on 458 // the input and output to the batch prediction job, as well as the provided 459 // training dataset. 460 ModelMonitoringConfig model_monitoring_config = 26; 461 462 // Get batch prediction job monitoring statistics. 463 repeated ModelMonitoringStatsAnomalies model_monitoring_stats_anomalies = 31; 464 465 // Output only. The running status of the model monitoring pipeline. 466 google.rpc.Status model_monitoring_status = 32 467 [(google.api.field_behavior) = OUTPUT_ONLY]; 468 469 // For custom-trained Models and AutoML Tabular Models, the container of the 470 // DeployedModel instances will send `stderr` and `stdout` streams to 471 // Cloud Logging by default. Please note that the logs incur cost, 472 // which are subject to [Cloud Logging 473 // pricing](https://cloud.google.com/logging/pricing). 474 // 475 // User can disable container logging by setting this flag to true. 476 bool disable_container_logging = 34; 477} 478