batch_prediction_job.proto 22 KB

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