• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.documentai.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/documentai/v1/document.proto";
24import "google/cloud/documentai/v1/document_io.proto";
25import "google/cloud/documentai/v1/document_schema.proto";
26import "google/cloud/documentai/v1/evaluation.proto";
27import "google/cloud/documentai/v1/operation_metadata.proto";
28import "google/cloud/documentai/v1/processor.proto";
29import "google/cloud/documentai/v1/processor_type.proto";
30import "google/longrunning/operations.proto";
31import "google/protobuf/empty.proto";
32import "google/protobuf/field_mask.proto";
33import "google/protobuf/timestamp.proto";
34import "google/rpc/status.proto";
35
36option csharp_namespace = "Google.Cloud.DocumentAI.V1";
37option go_package = "cloud.google.com/go/documentai/apiv1/documentaipb;documentaipb";
38option java_multiple_files = true;
39option java_outer_classname = "DocumentAiProcessorService";
40option java_package = "com.google.cloud.documentai.v1";
41option php_namespace = "Google\\Cloud\\DocumentAI\\V1";
42option ruby_package = "Google::Cloud::DocumentAI::V1";
43option (google.api.resource_definition) = {
44  type: "documentai.googleapis.com/HumanReviewConfig"
45  pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig"
46};
47option (google.api.resource_definition) = {
48  type: "documentai.googleapis.com/Location"
49  pattern: "projects/{project}/locations/{location}"
50};
51
52// Service to call Document AI to process documents according to the
53// processor's definition. Processors are built using state-of-the-art Google
54// AI such as natural language, computer vision, and translation to extract
55// structured information from unstructured or semi-structured documents.
56service DocumentProcessorService {
57  option (google.api.default_host) = "documentai.googleapis.com";
58  option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
59
60  // Processes a single document.
61  rpc ProcessDocument(ProcessRequest) returns (ProcessResponse) {
62    option (google.api.http) = {
63      post: "/v1/{name=projects/*/locations/*/processors/*}:process"
64      body: "*"
65      additional_bindings {
66        post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:process"
67        body: "*"
68      }
69    };
70    option (google.api.method_signature) = "name";
71  }
72
73  // LRO endpoint to batch process many documents. The output is written
74  // to Cloud Storage as JSON in the [Document] format.
75  rpc BatchProcessDocuments(BatchProcessRequest) returns (google.longrunning.Operation) {
76    option (google.api.http) = {
77      post: "/v1/{name=projects/*/locations/*/processors/*}:batchProcess"
78      body: "*"
79      additional_bindings {
80        post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:batchProcess"
81        body: "*"
82      }
83    };
84    option (google.api.method_signature) = "name";
85    option (google.longrunning.operation_info) = {
86      response_type: "BatchProcessResponse"
87      metadata_type: "BatchProcessMetadata"
88    };
89  }
90
91  // Fetches processor types. Note that we don't use [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
92  // here, because it isn't paginated.
93  rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) {
94    option (google.api.http) = {
95      get: "/v1/{parent=projects/*/locations/*}:fetchProcessorTypes"
96    };
97    option (google.api.method_signature) = "parent";
98  }
99
100  // Lists the processor types that exist.
101  rpc ListProcessorTypes(ListProcessorTypesRequest) returns (ListProcessorTypesResponse) {
102    option (google.api.http) = {
103      get: "/v1/{parent=projects/*/locations/*}/processorTypes"
104    };
105    option (google.api.method_signature) = "parent";
106  }
107
108  // Gets a processor type detail.
109  rpc GetProcessorType(GetProcessorTypeRequest) returns (ProcessorType) {
110    option (google.api.http) = {
111      get: "/v1/{name=projects/*/locations/*/processorTypes/*}"
112    };
113    option (google.api.method_signature) = "name";
114  }
115
116  // Lists all processors which belong to this project.
117  rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) {
118    option (google.api.http) = {
119      get: "/v1/{parent=projects/*/locations/*}/processors"
120    };
121    option (google.api.method_signature) = "parent";
122  }
123
124  // Gets a processor detail.
125  rpc GetProcessor(GetProcessorRequest) returns (Processor) {
126    option (google.api.http) = {
127      get: "/v1/{name=projects/*/locations/*/processors/*}"
128    };
129    option (google.api.method_signature) = "name";
130  }
131
132  // Trains a new processor version.
133  // Operation metadata is returned as
134  // [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
135  rpc TrainProcessorVersion(TrainProcessorVersionRequest) returns (google.longrunning.Operation) {
136    option (google.api.http) = {
137      post: "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions:train"
138      body: "*"
139    };
140    option (google.api.method_signature) = "parent,processor_version";
141    option (google.longrunning.operation_info) = {
142      response_type: "TrainProcessorVersionResponse"
143      metadata_type: "TrainProcessorVersionMetadata"
144    };
145  }
146
147  // Gets a processor version detail.
148  rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion) {
149    option (google.api.http) = {
150      get: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}"
151    };
152    option (google.api.method_signature) = "name";
153  }
154
155  // Lists all versions of a processor.
156  rpc ListProcessorVersions(ListProcessorVersionsRequest) returns (ListProcessorVersionsResponse) {
157    option (google.api.http) = {
158      get: "/v1/{parent=projects/*/locations/*/processors/*}/processorVersions"
159    };
160    option (google.api.method_signature) = "parent";
161  }
162
163  // Deletes the processor version, all artifacts under the processor version
164  // will be deleted.
165  rpc DeleteProcessorVersion(DeleteProcessorVersionRequest) returns (google.longrunning.Operation) {
166    option (google.api.http) = {
167      delete: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}"
168    };
169    option (google.api.method_signature) = "name";
170    option (google.longrunning.operation_info) = {
171      response_type: "google.protobuf.Empty"
172      metadata_type: "DeleteProcessorVersionMetadata"
173    };
174  }
175
176  // Deploys the processor version.
177  rpc DeployProcessorVersion(DeployProcessorVersionRequest) returns (google.longrunning.Operation) {
178    option (google.api.http) = {
179      post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:deploy"
180      body: "*"
181    };
182    option (google.api.method_signature) = "name";
183    option (google.longrunning.operation_info) = {
184      response_type: "DeployProcessorVersionResponse"
185      metadata_type: "DeployProcessorVersionMetadata"
186    };
187  }
188
189  // Undeploys the processor version.
190  rpc UndeployProcessorVersion(UndeployProcessorVersionRequest) returns (google.longrunning.Operation) {
191    option (google.api.http) = {
192      post: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*}:undeploy"
193      body: "*"
194    };
195    option (google.api.method_signature) = "name";
196    option (google.longrunning.operation_info) = {
197      response_type: "UndeployProcessorVersionResponse"
198      metadata_type: "UndeployProcessorVersionMetadata"
199    };
200  }
201
202  // Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType] provided.
203  // The processor will be at `ENABLED` state by default after its creation.
204  rpc CreateProcessor(CreateProcessorRequest) returns (Processor) {
205    option (google.api.http) = {
206      post: "/v1/{parent=projects/*/locations/*}/processors"
207      body: "processor"
208    };
209    option (google.api.method_signature) = "parent,processor";
210  }
211
212  // Deletes the processor, unloads all deployed model artifacts if it was
213  // enabled and then deletes all artifacts associated with this processor.
214  rpc DeleteProcessor(DeleteProcessorRequest) returns (google.longrunning.Operation) {
215    option (google.api.http) = {
216      delete: "/v1/{name=projects/*/locations/*/processors/*}"
217    };
218    option (google.api.method_signature) = "name";
219    option (google.longrunning.operation_info) = {
220      response_type: "google.protobuf.Empty"
221      metadata_type: "DeleteProcessorMetadata"
222    };
223  }
224
225  // Enables a processor
226  rpc EnableProcessor(EnableProcessorRequest) returns (google.longrunning.Operation) {
227    option (google.api.http) = {
228      post: "/v1/{name=projects/*/locations/*/processors/*}:enable"
229      body: "*"
230    };
231    option (google.longrunning.operation_info) = {
232      response_type: "EnableProcessorResponse"
233      metadata_type: "EnableProcessorMetadata"
234    };
235  }
236
237  // Disables a processor
238  rpc DisableProcessor(DisableProcessorRequest) returns (google.longrunning.Operation) {
239    option (google.api.http) = {
240      post: "/v1/{name=projects/*/locations/*/processors/*}:disable"
241      body: "*"
242    };
243    option (google.longrunning.operation_info) = {
244      response_type: "DisableProcessorResponse"
245      metadata_type: "DisableProcessorMetadata"
246    };
247  }
248
249  // Set the default (active) version of a [Processor][google.cloud.documentai.v1.Processor] that will be used in
250  // [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] and
251  // [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
252  rpc SetDefaultProcessorVersion(SetDefaultProcessorVersionRequest) returns (google.longrunning.Operation) {
253    option (google.api.http) = {
254      post: "/v1/{processor=projects/*/locations/*/processors/*}:setDefaultProcessorVersion"
255      body: "*"
256    };
257    option (google.longrunning.operation_info) = {
258      response_type: "SetDefaultProcessorVersionResponse"
259      metadata_type: "SetDefaultProcessorVersionMetadata"
260    };
261  }
262
263  // Send a document for Human Review. The input document should be processed by
264  // the specified processor.
265  rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) {
266    option (google.api.http) = {
267      post: "/v1/{human_review_config=projects/*/locations/*/processors/*/humanReviewConfig}:reviewDocument"
268      body: "*"
269    };
270    option (google.api.method_signature) = "human_review_config";
271    option (google.longrunning.operation_info) = {
272      response_type: "ReviewDocumentResponse"
273      metadata_type: "ReviewDocumentOperationMetadata"
274    };
275  }
276
277  // Evaluates a ProcessorVersion against annotated documents, producing an
278  // Evaluation.
279  rpc EvaluateProcessorVersion(EvaluateProcessorVersionRequest) returns (google.longrunning.Operation) {
280    option (google.api.http) = {
281      post: "/v1/{processor_version=projects/*/locations/*/processors/*/processorVersions/*}:evaluateProcessorVersion"
282      body: "*"
283    };
284    option (google.api.method_signature) = "processor_version";
285    option (google.longrunning.operation_info) = {
286      response_type: "EvaluateProcessorVersionResponse"
287      metadata_type: "EvaluateProcessorVersionMetadata"
288    };
289  }
290
291  // Retrieves a specific evaluation.
292  rpc GetEvaluation(GetEvaluationRequest) returns (Evaluation) {
293    option (google.api.http) = {
294      get: "/v1/{name=projects/*/locations/*/processors/*/processorVersions/*/evaluations/*}"
295    };
296    option (google.api.method_signature) = "name";
297  }
298
299  // Retrieves a set of evaluations for a given processor version.
300  rpc ListEvaluations(ListEvaluationsRequest) returns (ListEvaluationsResponse) {
301    option (google.api.http) = {
302      get: "/v1/{parent=projects/*/locations/*/processors/*/processorVersions/*}/evaluations"
303    };
304    option (google.api.method_signature) = "parent";
305  }
306}
307
308// Options for Process API
309message ProcessOptions {
310  // A list of individual page numbers.
311  message IndividualPageSelector {
312    // Optional. Indices of the pages (starting from 1).
313    repeated int32 pages = 1 [(google.api.field_behavior) = OPTIONAL];
314  }
315
316  // A subset of pages to process. If not specified, all pages are processed.
317  // If a page range is set, only the given pages are extracted and processed
318  // from the document. In the output document, [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
319  // refers to the page number in the original document. This configuration
320  // only applies to sync requests.
321  oneof page_range {
322    // Which pages to process (1-indexed).
323    IndividualPageSelector individual_page_selector = 5;
324
325    // Only process certain pages from the start. Process all if the document
326    // has fewer pages.
327    int32 from_start = 6;
328
329    // Only process certain pages from the end, same as above.
330    int32 from_end = 7;
331  }
332
333  // Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
334  // Returns error if set on other processor types.
335  OcrConfig ocr_config = 1;
336
337  // Optional. Override the schema of the [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will return an Invalid
338  // Argument error if this field is set when the underlying
339  // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't support schema override.
340  DocumentSchema schema_override = 8 [(google.api.field_behavior) = OPTIONAL];
341}
342
343// Request message for the
344// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] method.
345message ProcessRequest {
346  // The document payload.
347  oneof source {
348    // An inline document proto.
349    Document inline_document = 4;
350
351    // A raw document content (bytes).
352    RawDocument raw_document = 5;
353
354    // A raw document on Google Cloud Storage.
355    GcsDocument gcs_document = 8;
356  }
357
358  // Required. The resource name of the [Processor][google.cloud.documentai.v1.Processor] or
359  // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
360  // to use for processing. If a [Processor][google.cloud.documentai.v1.Processor] is specified, the server will use
361  // its [default version][google.cloud.documentai.v1.Processor.default_processor_version]. Format:
362  // `projects/{project}/locations/{location}/processors/{processor}`, or
363  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
364  string name = 1 [
365    (google.api.field_behavior) = REQUIRED,
366    (google.api.resource_reference) = {
367      type: "*"
368    }
369  ];
370
371  // Whether human review should be skipped for this request. Default to
372  // `false`.
373  bool skip_human_review = 3;
374
375  // Specifies which fields to include in the [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
376  // output. Only supports top-level document and pages field, so it must be in
377  // the form of `{document_field_name}` or `pages.{page_field_name}`.
378  google.protobuf.FieldMask field_mask = 6;
379
380  // Inference-time options for the process API
381  ProcessOptions process_options = 7;
382
383  // Optional. The labels with user-defined metadata for the request.
384  //
385  // Label keys and values can be no longer than 63 characters
386  // (Unicode codepoints) and can only contain lowercase letters, numeric
387  // characters, underscores, and dashes. International characters are allowed.
388  // Label values are optional. Label keys must start with a letter.
389  map<string, string> labels = 10 [(google.api.field_behavior) = OPTIONAL];
390}
391
392// The status of human review on a processed document.
393message HumanReviewStatus {
394  // The final state of human review on a processed document.
395  enum State {
396    // Human review state is unspecified. Most likely due to an internal error.
397    STATE_UNSPECIFIED = 0;
398
399    // Human review is skipped for the document. This can happen because human
400    // review isn't enabled on the processor or the processing request has
401    // been set to skip this document.
402    SKIPPED = 1;
403
404    // Human review validation is triggered and passed, so no review is needed.
405    VALIDATION_PASSED = 2;
406
407    // Human review validation is triggered and the document is under review.
408    IN_PROGRESS = 3;
409
410    // Some error happened during triggering human review, see the
411    // [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message] for details.
412    ERROR = 4;
413  }
414
415  // The state of human review on the processing request.
416  State state = 1;
417
418  // A message providing more details about the human review state.
419  string state_message = 2;
420
421  // The name of the operation triggered by the processed document. This field
422  // is populated only when the [state][google.cloud.documentai.v1.HumanReviewStatus.state] is `HUMAN_REVIEW_IN_PROGRESS`. It has
423  // the same response type and metadata as the long-running operation returned
424  // by [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
425  string human_review_operation = 3;
426}
427
428// Response message for the
429// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument] method.
430message ProcessResponse {
431  // The document payload, will populate fields based on the processor's
432  // behavior.
433  Document document = 1;
434
435  // The status of human review on the processed document.
436  HumanReviewStatus human_review_status = 3;
437}
438
439// Request message for
440// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
441message BatchProcessRequest {
442  // Required. The resource name of [Processor][google.cloud.documentai.v1.Processor] or
443  // [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
444  // Format: `projects/{project}/locations/{location}/processors/{processor}`,
445  // or
446  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
447  string name = 1 [
448    (google.api.field_behavior) = REQUIRED,
449    (google.api.resource_reference) = {
450      type: "*"
451    }
452  ];
453
454  // The input documents for the
455  // [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
456  // method.
457  BatchDocumentsInputConfig input_documents = 5;
458
459  // The output configuration for the
460  // [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
461  // method.
462  DocumentOutputConfig document_output_config = 6;
463
464  // Whether human review should be skipped for this request. Default to
465  // `false`.
466  bool skip_human_review = 4;
467
468  // Inference-time options for the process API
469  ProcessOptions process_options = 7;
470
471  // Optional. The labels with user-defined metadata for the request.
472  //
473  // Label keys and values can be no longer than 63 characters
474  // (Unicode codepoints) and can only contain lowercase letters, numeric
475  // characters, underscores, and dashes. International characters are allowed.
476  // Label values are optional. Label keys must start with a letter.
477  map<string, string> labels = 9 [(google.api.field_behavior) = OPTIONAL];
478}
479
480// Response message for
481// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
482message BatchProcessResponse {
483
484}
485
486// The long-running operation metadata for
487// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
488message BatchProcessMetadata {
489  // The status of a each individual document in the batch process.
490  message IndividualProcessStatus {
491    // The source of the document, same as the [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source] field in the
492    // request when the batch process started.
493    string input_gcs_source = 1;
494
495    // The status processing the document.
496    google.rpc.Status status = 2;
497
498    // The Cloud Storage output destination (in the request as
499    // [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]) of the processed
500    // document if it was successful, otherwise empty.
501    string output_gcs_destination = 3;
502
503    // The status of human review on the processed document.
504    HumanReviewStatus human_review_status = 5;
505  }
506
507  // Possible states of the batch processing operation.
508  enum State {
509    // The default value. This value is used if the state is omitted.
510    STATE_UNSPECIFIED = 0;
511
512    // Request operation is waiting for scheduling.
513    WAITING = 1;
514
515    // Request is being processed.
516    RUNNING = 2;
517
518    // The batch processing completed successfully.
519    SUCCEEDED = 3;
520
521    // The batch processing was being cancelled.
522    CANCELLING = 4;
523
524    // The batch processing was cancelled.
525    CANCELLED = 5;
526
527    // The batch processing has failed.
528    FAILED = 6;
529  }
530
531  // The state of the current batch processing.
532  State state = 1;
533
534  // A message providing more details about the current state of processing.
535  // For example, the error message if the operation is failed.
536  string state_message = 2;
537
538  // The creation time of the operation.
539  google.protobuf.Timestamp create_time = 3;
540
541  // The last update time of the operation.
542  google.protobuf.Timestamp update_time = 4;
543
544  // The list of response details of each document.
545  repeated IndividualProcessStatus individual_process_statuses = 5;
546}
547
548// Request message for the
549// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes] method.
550// Some processor types may require the project be added to an allowlist.
551message FetchProcessorTypesRequest {
552  // Required. The location of processor types to list.
553  // Format: `projects/{project}/locations/{location}`.
554  string parent = 1 [
555    (google.api.field_behavior) = REQUIRED,
556    (google.api.resource_reference) = {
557      child_type: "documentai.googleapis.com/ProcessorType"
558    }
559  ];
560}
561
562// Response message for the
563// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes] method.
564message FetchProcessorTypesResponse {
565  // The list of processor types.
566  repeated ProcessorType processor_types = 1;
567}
568
569// Request message for the
570// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes] method.
571// Some processor types may require the project be added to an allowlist.
572message ListProcessorTypesRequest {
573  // Required. The location of processor types to list.
574  // Format: `projects/{project}/locations/{location}`.
575  string parent = 1 [
576    (google.api.field_behavior) = REQUIRED,
577    (google.api.resource_reference) = {
578      child_type: "documentai.googleapis.com/ProcessorType"
579    }
580  ];
581
582  // The maximum number of processor types to return.
583  // If unspecified, at most `100` processor types will be returned.
584  // The maximum value is `500`. Values above `500` will be coerced to `500`.
585  int32 page_size = 2;
586
587  // Used to retrieve the next page of results, empty if at the end of the list.
588  string page_token = 3;
589}
590
591// Response message for the
592// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes] method.
593message ListProcessorTypesResponse {
594  // The processor types.
595  repeated ProcessorType processor_types = 1;
596
597  // Points to the next page, otherwise empty.
598  string next_page_token = 2;
599}
600
601// Request message for list all processors belongs to a project.
602message ListProcessorsRequest {
603  // Required. The parent (project and location) which owns this collection of Processors.
604  // Format: `projects/{project}/locations/{location}`
605  string parent = 1 [
606    (google.api.field_behavior) = REQUIRED,
607    (google.api.resource_reference) = {
608      child_type: "documentai.googleapis.com/Processor"
609    }
610  ];
611
612  // The maximum number of processors to return.
613  // If unspecified, at most `50` processors will be returned.
614  // The maximum value is `100`. Values above `100` will be coerced to `100`.
615  int32 page_size = 2;
616
617  // We will return the processors sorted by creation time. The page token
618  // will point to the next processor.
619  string page_token = 3;
620}
621
622// Response message for the
623// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors] method.
624message ListProcessorsResponse {
625  // The list of processors.
626  repeated Processor processors = 1;
627
628  // Points to the next processor, otherwise empty.
629  string next_page_token = 2;
630}
631
632// Request message for the
633// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType] method.
634message GetProcessorTypeRequest {
635  // Required. The processor type resource name.
636  string name = 1 [
637    (google.api.field_behavior) = REQUIRED,
638    (google.api.resource_reference) = {
639      type: "documentai.googleapis.com/ProcessorType"
640    }
641  ];
642}
643
644// Request message for the [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
645// method.
646message GetProcessorRequest {
647  // Required. The processor resource name.
648  string name = 1 [
649    (google.api.field_behavior) = REQUIRED,
650    (google.api.resource_reference) = {
651      type: "documentai.googleapis.com/Processor"
652    }
653  ];
654}
655
656// Request message for the
657// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion] method.
658message GetProcessorVersionRequest {
659  // Required. The processor resource name.
660  string name = 1 [
661    (google.api.field_behavior) = REQUIRED,
662    (google.api.resource_reference) = {
663      type: "documentai.googleapis.com/ProcessorVersion"
664    }
665  ];
666}
667
668// Request message for list all processor versions belongs to a processor.
669message ListProcessorVersionsRequest {
670  // Required. The parent (project, location and processor) to list all versions.
671  // Format: `projects/{project}/locations/{location}/processors/{processor}`
672  string parent = 1 [
673    (google.api.field_behavior) = REQUIRED,
674    (google.api.resource_reference) = {
675      child_type: "documentai.googleapis.com/ProcessorVersion"
676    }
677  ];
678
679  // The maximum number of processor versions to return.
680  // If unspecified, at most `10` processor versions will be returned.
681  // The maximum value is `20`. Values above `20` will be coerced to `20`.
682  int32 page_size = 2;
683
684  // We will return the processor versions sorted by creation time. The page
685  // token will point to the next processor version.
686  string page_token = 3;
687}
688
689// Response message for the
690// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
691// method.
692message ListProcessorVersionsResponse {
693  // The list of processors.
694  repeated ProcessorVersion processor_versions = 1;
695
696  // Points to the next processor, otherwise empty.
697  string next_page_token = 2;
698}
699
700// Request message for the
701// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
702// method.
703message DeleteProcessorVersionRequest {
704  // Required. The processor version resource name to be deleted.
705  string name = 1 [
706    (google.api.field_behavior) = REQUIRED,
707    (google.api.resource_reference) = {
708      type: "documentai.googleapis.com/ProcessorVersion"
709    }
710  ];
711}
712
713// The long-running operation metadata for the
714// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
715// method.
716message DeleteProcessorVersionMetadata {
717  // The basic metadata of the long-running operation.
718  CommonOperationMetadata common_metadata = 1;
719}
720
721// Request message for the
722// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
723// method.
724message DeployProcessorVersionRequest {
725  // Required. The processor version resource name to be deployed.
726  string name = 1 [
727    (google.api.field_behavior) = REQUIRED,
728    (google.api.resource_reference) = {
729      type: "documentai.googleapis.com/ProcessorVersion"
730    }
731  ];
732}
733
734// Response message for the
735// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
736// method.
737message DeployProcessorVersionResponse {
738
739}
740
741// The long-running operation metadata for the
742// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
743// method.
744message DeployProcessorVersionMetadata {
745  // The basic metadata of the long-running operation.
746  CommonOperationMetadata common_metadata = 1;
747}
748
749// Request message for the
750// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
751// method.
752message UndeployProcessorVersionRequest {
753  // Required. The processor version resource name to be undeployed.
754  string name = 1 [
755    (google.api.field_behavior) = REQUIRED,
756    (google.api.resource_reference) = {
757      type: "documentai.googleapis.com/ProcessorVersion"
758    }
759  ];
760}
761
762// Response message for the
763// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
764// method.
765message UndeployProcessorVersionResponse {
766
767}
768
769// The long-running operation metadata for the
770// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
771// method.
772message UndeployProcessorVersionMetadata {
773  // The basic metadata of the long-running operation.
774  CommonOperationMetadata common_metadata = 1;
775}
776
777// Request message for the
778// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor] method. Notice
779// this request is sent to a regionalized backend service. If the
780// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in that region, the creation fails.
781message CreateProcessorRequest {
782  // Required. The parent (project and location) under which to create the processor.
783  // Format: `projects/{project}/locations/{location}`
784  string parent = 1 [
785    (google.api.field_behavior) = REQUIRED,
786    (google.api.resource_reference) = {
787      child_type: "documentai.googleapis.com/Processor"
788    }
789  ];
790
791  // Required. The processor to be created, requires [Processor.type][google.cloud.documentai.v1.Processor.type] and
792  // [Processor.display_name][google.cloud.documentai.v1.Processor.display_name] to be set. Also, the [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
793  // field must be set if the processor is under CMEK.
794  Processor processor = 2 [(google.api.field_behavior) = REQUIRED];
795}
796
797// Request message for the
798// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor] method.
799message DeleteProcessorRequest {
800  // Required. The processor resource name to be deleted.
801  string name = 1 [
802    (google.api.field_behavior) = REQUIRED,
803    (google.api.resource_reference) = {
804      type: "documentai.googleapis.com/Processor"
805    }
806  ];
807}
808
809// The long-running operation metadata for the
810// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor] method.
811message DeleteProcessorMetadata {
812  // The basic metadata of the long-running operation.
813  CommonOperationMetadata common_metadata = 5;
814}
815
816// Request message for the
817// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor] method.
818message EnableProcessorRequest {
819  // Required. The processor resource name to be enabled.
820  string name = 1 [
821    (google.api.field_behavior) = REQUIRED,
822    (google.api.resource_reference) = {
823      type: "documentai.googleapis.com/Processor"
824    }
825  ];
826}
827
828// Response message for the
829// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor] method.
830// Intentionally empty proto for adding fields in future.
831message EnableProcessorResponse {
832
833}
834
835// The long-running operation metadata for the
836// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor] method.
837message EnableProcessorMetadata {
838  // The basic metadata of the long-running operation.
839  CommonOperationMetadata common_metadata = 5;
840}
841
842// Request message for the
843// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor] method.
844message DisableProcessorRequest {
845  // Required. The processor resource name to be disabled.
846  string name = 1 [
847    (google.api.field_behavior) = REQUIRED,
848    (google.api.resource_reference) = {
849      type: "documentai.googleapis.com/Processor"
850    }
851  ];
852}
853
854// Response message for the
855// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor] method.
856// Intentionally empty proto for adding fields in future.
857message DisableProcessorResponse {
858
859}
860
861// The long-running operation metadata for the
862// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor] method.
863message DisableProcessorMetadata {
864  // The basic metadata of the long-running operation.
865  CommonOperationMetadata common_metadata = 5;
866}
867
868// Request message for the
869// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
870// method.
871message SetDefaultProcessorVersionRequest {
872  // Required. The resource name of the [Processor][google.cloud.documentai.v1.Processor] to change default version.
873  string processor = 1 [
874    (google.api.field_behavior) = REQUIRED,
875    (google.api.resource_reference) = {
876      type: "documentai.googleapis.com/Processor"
877    }
878  ];
879
880  // Required. The resource name of child [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as default.
881  // Format:
882  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
883  string default_processor_version = 2 [
884    (google.api.field_behavior) = REQUIRED,
885    (google.api.resource_reference) = {
886      type: "documentai.googleapis.com/ProcessorVersion"
887    }
888  ];
889}
890
891// Response message for the
892// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
893// method.
894message SetDefaultProcessorVersionResponse {
895
896}
897
898// The long-running operation metadata for the
899// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
900// method.
901message SetDefaultProcessorVersionMetadata {
902  // The basic metadata of the long-running operation.
903  CommonOperationMetadata common_metadata = 1;
904}
905
906// Request message for the
907// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
908// method.
909message TrainProcessorVersionRequest {
910  // The input data used to train a new [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
911  message InputData {
912    // The documents used for training the new version.
913    BatchDocumentsInputConfig training_documents = 3;
914
915    // The documents used for testing the trained version.
916    BatchDocumentsInputConfig test_documents = 4;
917  }
918
919  // Options to control the training of the Custom Document Extraction (CDE)
920  // Processor.
921  message CustomDocumentExtractionOptions {
922    // Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
923    // `MODEL_BASED`.
924    enum TrainingMethod {
925      TRAINING_METHOD_UNSPECIFIED = 0;
926
927      MODEL_BASED = 1;
928
929      TEMPLATE_BASED = 2;
930    }
931
932    // Training method to use for CDE training.
933    TrainingMethod training_method = 3;
934  }
935
936  // Options to control foundation model tuning of the processor.
937  message FoundationModelTuningOptions {
938    // Optional. The number of steps to run for model tuning. Valid values are between
939    // 1 and 400. If not provided, recommended steps will be used.
940    int32 train_steps = 2 [(google.api.field_behavior) = OPTIONAL];
941
942    // Optional. The multiplier to apply to the recommended learning rate. Valid values
943    // are between 0.1 and 10. If not provided, recommended learning rate will
944    // be used.
945    float learning_rate_multiplier = 3 [(google.api.field_behavior) = OPTIONAL];
946  }
947
948  oneof processor_flags {
949    // Options to control Custom Document Extraction (CDE) Processor.
950    CustomDocumentExtractionOptions custom_document_extraction_options = 5;
951
952    // Options to control foundation model tuning of a processor.
953    FoundationModelTuningOptions foundation_model_tuning_options = 12;
954  }
955
956  // Required. The parent (project, location and processor) to create the new version for.
957  // Format: `projects/{project}/locations/{location}/processors/{processor}`.
958  string parent = 1 [
959    (google.api.field_behavior) = REQUIRED,
960    (google.api.resource_reference) = {
961      type: "documentai.googleapis.com/Processor"
962    }
963  ];
964
965  // Required. The processor version to be created.
966  ProcessorVersion processor_version = 2 [(google.api.field_behavior) = REQUIRED];
967
968  // Optional. The schema the processor version will be trained with.
969  DocumentSchema document_schema = 10 [(google.api.field_behavior) = OPTIONAL];
970
971  // Optional. The input data used to train the [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
972  InputData input_data = 4 [(google.api.field_behavior) = OPTIONAL];
973
974  // Optional. The processor version to use as a base for training. This processor version
975  // must be a child of `parent`. Format:
976  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
977  string base_processor_version = 8 [(google.api.field_behavior) = OPTIONAL];
978}
979
980// The response for
981// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
982message TrainProcessorVersionResponse {
983  // The resource name of the processor version produced by training.
984  string processor_version = 1;
985}
986
987// The metadata that represents a processor version being created.
988message TrainProcessorVersionMetadata {
989  // The dataset validation information.
990  // This includes any and all errors with documents and the dataset.
991  message DatasetValidation {
992    // The total number of document errors.
993    int32 document_error_count = 3;
994
995    // The total number of dataset errors.
996    int32 dataset_error_count = 4;
997
998    // Error information pertaining to specific documents. A maximum of 10
999    // document errors will be returned.
1000    // Any document with errors will not be used throughout training.
1001    repeated google.rpc.Status document_errors = 1;
1002
1003    // Error information for the dataset as a whole. A maximum of 10 dataset
1004    // errors will be returned.
1005    // A single dataset error is terminal for training.
1006    repeated google.rpc.Status dataset_errors = 2;
1007  }
1008
1009  // The basic metadata of the long-running operation.
1010  CommonOperationMetadata common_metadata = 1;
1011
1012  // The training dataset validation information.
1013  DatasetValidation training_dataset_validation = 2;
1014
1015  // The test dataset validation information.
1016  DatasetValidation test_dataset_validation = 3;
1017}
1018
1019// Request message for the
1020// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument] method.
1021message ReviewDocumentRequest {
1022  // The priority level of the human review task.
1023  enum Priority {
1024    // The default priority level.
1025    DEFAULT = 0;
1026
1027    // The urgent priority level. The labeling manager should allocate labeler
1028    // resource to the urgent task queue to respect this priority level.
1029    URGENT = 1;
1030  }
1031
1032  // The document payload.
1033  oneof source {
1034    // An inline document proto.
1035    Document inline_document = 4;
1036  }
1037
1038  // Required. The resource name of the [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the document will be
1039  // reviewed with.
1040  string human_review_config = 1 [
1041    (google.api.field_behavior) = REQUIRED,
1042    (google.api.resource_reference) = {
1043      type: "documentai.googleapis.com/HumanReviewConfig"
1044    }
1045  ];
1046
1047  // Whether the validation should be performed on the ad-hoc review request.
1048  bool enable_schema_validation = 3;
1049
1050  // The priority of the human review task.
1051  Priority priority = 5;
1052
1053  // The document schema of the human review task.
1054  DocumentSchema document_schema = 6;
1055}
1056
1057// Response message for the
1058// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument] method.
1059message ReviewDocumentResponse {
1060  // Possible states of the review operation.
1061  enum State {
1062    // The default value. This value is used if the state is omitted.
1063    STATE_UNSPECIFIED = 0;
1064
1065    // The review operation is rejected by the reviewer.
1066    REJECTED = 1;
1067
1068    // The review operation is succeeded.
1069    SUCCEEDED = 2;
1070  }
1071
1072  // The Cloud Storage uri for the human reviewed document if the review is
1073  // succeeded.
1074  string gcs_destination = 1;
1075
1076  // The state of the review operation.
1077  State state = 2;
1078
1079  // The reason why the review is rejected by reviewer.
1080  string rejection_reason = 3;
1081}
1082
1083// The long-running operation metadata for the
1084// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument] method.
1085message ReviewDocumentOperationMetadata {
1086  // The basic metadata of the long-running operation.
1087  CommonOperationMetadata common_metadata = 5;
1088
1089  // The Crowd Compute question ID.
1090  string question_id = 6;
1091}
1092
1093// Evaluates the given [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the supplied documents.
1094message EvaluateProcessorVersionRequest {
1095  // Required. The resource name of the [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to evaluate.
1096  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
1097  string processor_version = 1 [
1098    (google.api.field_behavior) = REQUIRED,
1099    (google.api.resource_reference) = {
1100      type: "documentai.googleapis.com/ProcessorVersion"
1101    }
1102  ];
1103
1104  // Optional. The documents used in the evaluation. If unspecified, use the processor's
1105  // dataset as evaluation input.
1106  BatchDocumentsInputConfig evaluation_documents = 3 [(google.api.field_behavior) = OPTIONAL];
1107}
1108
1109// Metadata of the
1110// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
1111// method.
1112message EvaluateProcessorVersionMetadata {
1113  // The basic metadata of the long-running operation.
1114  CommonOperationMetadata common_metadata = 1;
1115}
1116
1117// Response of the
1118// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
1119// method.
1120message EvaluateProcessorVersionResponse {
1121  // The resource name of the created evaluation.
1122  string evaluation = 2;
1123}
1124
1125// Retrieves a specific Evaluation.
1126message GetEvaluationRequest {
1127  // Required. The resource name of the [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
1128  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
1129  string name = 1 [
1130    (google.api.field_behavior) = REQUIRED,
1131    (google.api.resource_reference) = {
1132      type: "documentai.googleapis.com/Evaluation"
1133    }
1134  ];
1135}
1136
1137// Retrieves a list of evaluations for a given [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
1138message ListEvaluationsRequest {
1139  // Required. The resource name of the [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list evaluations for.
1140  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
1141  string parent = 1 [
1142    (google.api.field_behavior) = REQUIRED,
1143    (google.api.resource_reference) = {
1144      type: "documentai.googleapis.com/ProcessorVersion"
1145    }
1146  ];
1147
1148  // The standard list page size.
1149  // If unspecified, at most `5` evaluations are returned.
1150  // The maximum value is `100`. Values above `100` are coerced to `100`.
1151  int32 page_size = 2;
1152
1153  // A page token, received from a previous `ListEvaluations` call.
1154  // Provide this to retrieve the subsequent page.
1155  string page_token = 3;
1156}
1157
1158// The response from `ListEvaluations`.
1159message ListEvaluationsResponse {
1160  // The evaluations requested.
1161  repeated Evaluation evaluations = 1;
1162
1163  // A token, which can be sent as `page_token` to retrieve the next page.
1164  // If this field is omitted, there are no subsequent pages.
1165  string next_page_token = 2;
1166}
1167