xref: /aosp_15_r20/external/googleapis/google/cloud/documentai/v1/processor.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.documentai.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/documentai/v1/document_schema.proto";
22import "google/cloud/documentai/v1/evaluation.proto";
23import "google/protobuf/timestamp.proto";
24
25option csharp_namespace = "Google.Cloud.DocumentAI.V1";
26option go_package = "cloud.google.com/go/documentai/apiv1/documentaipb;documentaipb";
27option java_multiple_files = true;
28option java_outer_classname = "DocumentAiProcessor";
29option java_package = "com.google.cloud.documentai.v1";
30option php_namespace = "Google\\Cloud\\DocumentAI\\V1";
31option ruby_package = "Google::Cloud::DocumentAI::V1";
32
33// A processor version is an implementation of a processor. Each processor
34// can have multiple versions, pretrained by Google internally or uptrained
35// by the customer. A processor can only have one default version at a time.
36// Its document-processing behavior is defined by that version.
37message ProcessorVersion {
38  option (google.api.resource) = {
39    type: "documentai.googleapis.com/ProcessorVersion"
40    pattern: "projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}"
41  };
42
43  // Information about the upcoming deprecation of this processor version.
44  message DeprecationInfo {
45    // The time at which this processor version will be deprecated.
46    google.protobuf.Timestamp deprecation_time = 1;
47
48    // If set, the processor version that will be used as a replacement.
49    string replacement_processor_version = 2 [(google.api.resource_reference) = {
50                                                type: "documentai.googleapis.com/ProcessorVersion"
51                                              }];
52  }
53
54  // The possible states of the processor version.
55  enum State {
56    // The processor version is in an unspecified state.
57    STATE_UNSPECIFIED = 0;
58
59    // The processor version is deployed and can be used for processing.
60    DEPLOYED = 1;
61
62    // The processor version is being deployed.
63    DEPLOYING = 2;
64
65    // The processor version is not deployed and cannot be used for processing.
66    UNDEPLOYED = 3;
67
68    // The processor version is being undeployed.
69    UNDEPLOYING = 4;
70
71    // The processor version is being created.
72    CREATING = 5;
73
74    // The processor version is being deleted.
75    DELETING = 6;
76
77    // The processor version failed and is in an indeterminate state.
78    FAILED = 7;
79
80    // The processor version is being imported.
81    IMPORTING = 8;
82  }
83
84  // The possible model types of the processor version.
85  enum ModelType {
86    // The processor version has unspecified model type.
87    MODEL_TYPE_UNSPECIFIED = 0;
88
89    // The processor version has generative model type.
90    MODEL_TYPE_GENERATIVE = 1;
91
92    // The processor version has custom model type.
93    MODEL_TYPE_CUSTOM = 2;
94  }
95
96  // The resource name of the processor version.
97  // Format:
98  // `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
99  string name = 1;
100
101  // The display name of the processor version.
102  string display_name = 2;
103
104  // The schema of the processor version. Describes the output.
105  DocumentSchema document_schema = 12;
106
107  // The state of the processor version.
108  State state = 6;
109
110  // The time the processor version was created.
111  google.protobuf.Timestamp create_time = 7;
112
113  // The most recently invoked evaluation for the processor version.
114  EvaluationReference latest_evaluation = 8;
115
116  // The KMS key name used for encryption.
117  string kms_key_name = 9;
118
119  // The KMS key version with which data is encrypted.
120  string kms_key_version_name = 10;
121
122  // Output only. Denotes that this `ProcessorVersion` is managed by Google.
123  bool google_managed = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
124
125  // If set, information about the eventual deprecation of this version.
126  DeprecationInfo deprecation_info = 13;
127
128  // Output only. The model type of this processor version.
129  ModelType model_type = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
130}
131
132// Contains the alias and the aliased resource name of processor version.
133message ProcessorVersionAlias {
134  // The alias in the form of `processor_version` resource name.
135  string alias = 1;
136
137  // The resource name of aliased processor version.
138  string processor_version = 2 [(google.api.resource_reference) = {
139                                  type: "documentai.googleapis.com/ProcessorVersion"
140                                }];
141}
142
143// The first-class citizen for Document AI. Each processor defines how to
144// extract structural information from a document.
145message Processor {
146  option (google.api.resource) = {
147    type: "documentai.googleapis.com/Processor"
148    pattern: "projects/{project}/locations/{location}/processors/{processor}"
149  };
150
151  // The possible states of the processor.
152  enum State {
153    // The processor is in an unspecified state.
154    STATE_UNSPECIFIED = 0;
155
156    // The processor is enabled, i.e., has an enabled version which can
157    // currently serve processing requests and all the feature dependencies have
158    // been successfully initialized.
159    ENABLED = 1;
160
161    // The processor is disabled.
162    DISABLED = 2;
163
164    // The processor is being enabled, will become `ENABLED` if successful.
165    ENABLING = 3;
166
167    // The processor is being disabled, will become `DISABLED` if successful.
168    DISABLING = 4;
169
170    // The processor is being created, will become either `ENABLED` (for
171    // successful creation) or `FAILED` (for failed ones).
172    // Once a processor is in this state, it can then be used for document
173    // processing, but the feature dependencies of the processor might not be
174    // fully created yet.
175    CREATING = 5;
176
177    // The processor failed during creation or initialization of feature
178    // dependencies. The user should delete the processor and recreate one as
179    // all the functionalities of the processor are disabled.
180    FAILED = 6;
181
182    // The processor is being deleted, will be removed if successful.
183    DELETING = 7;
184  }
185
186  // Output only. Immutable. The resource name of the processor.
187  // Format: `projects/{project}/locations/{location}/processors/{processor}`
188  string name = 1 [
189    (google.api.field_behavior) = IMMUTABLE,
190    (google.api.field_behavior) = OUTPUT_ONLY
191  ];
192
193  // The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
194  // To get a list of processor types, see
195  // [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
196  string type = 2;
197
198  // The display name of the processor.
199  string display_name = 3;
200
201  // Output only. The state of the processor.
202  State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
203
204  // The default processor version.
205  string default_processor_version = 9 [(google.api.resource_reference) = {
206                                          type: "documentai.googleapis.com/ProcessorVersion"
207                                        }];
208
209  // Output only. The processor version aliases.
210  repeated ProcessorVersionAlias processor_version_aliases = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
211
212  // Output only. Immutable. The http endpoint that can be called to invoke processing.
213  string process_endpoint = 6 [
214    (google.api.field_behavior) = OUTPUT_ONLY,
215    (google.api.field_behavior) = IMMUTABLE
216  ];
217
218  // The time the processor was created.
219  google.protobuf.Timestamp create_time = 7;
220
221  // The [KMS key](https://cloud.google.com/security-key-management) used for
222  // encryption and decryption in CMEK scenarios.
223  string kms_key_name = 8;
224}
225