Skip to content

Commit 1f68cd0

Browse files
Google APIscopybara-github
authored andcommitted
feat: Update documentai/v1beta3 protos
PiperOrigin-RevId: 357825340
1 parent 67233f5 commit 1f68cd0

3 files changed

Lines changed: 205 additions & 7 deletions

File tree

google/cloud/documentai/v1beta3/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ proto_library(
2222
name = "documentai_proto",
2323
srcs = [
2424
"document.proto",
25+
"document_io.proto",
2526
"document_processor_service.proto",
2627
"geometry.proto",
2728
],
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright 2020 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+
15+
syntax = "proto3";
16+
17+
package google.cloud.documentai.v1beta3;
18+
19+
import "google/api/annotations.proto";
20+
21+
option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta3";
22+
option go_package = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3;documentai";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "DocumentIoProto";
25+
option java_package = "com.google.cloud.documentai.v1beta3";
26+
option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta3";
27+
option ruby_package = "Google::Cloud::DocumentAI::V1beta3";
28+
29+
// Payload message of raw document content (bytes).
30+
message RawDocument {
31+
// Inline document content.
32+
bytes content = 1;
33+
34+
// An IANA MIME type (RFC6838) indicating the nature and format of the
35+
// [content].
36+
string mime_type = 2;
37+
}
38+
39+
// Specifies a document stored on Cloud Storage.
40+
message GcsDocument {
41+
// The Cloud Storage object uri.
42+
string gcs_uri = 1;
43+
44+
// An IANA MIME type (RFC6838) of the content.
45+
string mime_type = 2;
46+
}
47+
48+
// Specifies a set of documents on Cloud Storage.
49+
message GcsDocuments {
50+
// The list of documents.
51+
repeated GcsDocument documents = 1;
52+
}
53+
54+
// Specifies all documents on Cloud Storage with a common prefix.
55+
message GcsPrefix {
56+
// The URI prefix.
57+
string gcs_uri_prefix = 1;
58+
}
59+
60+
// The common config to specify a set of documents used as input.
61+
message BatchDocumentsInputConfig {
62+
// The source.
63+
oneof source {
64+
// The set of documents that match the specified Cloud Storage [gcs_prefix].
65+
GcsPrefix gcs_prefix = 1;
66+
67+
// The set of documents individually specified on Cloud Storage.
68+
GcsDocuments gcs_documents = 2;
69+
}
70+
}
71+
72+
// Config that controls the output of documents. All documents will be written
73+
// as a JSON file.
74+
message DocumentOutputConfig {
75+
// The configuration used when outputting documents.
76+
message GcsOutputConfig {
77+
// The Cloud Storage uri (a directory) of the output.
78+
string gcs_uri = 1;
79+
}
80+
81+
// The destination of the results.
82+
oneof destination {
83+
// Output config to write the results to Cloud Storage.
84+
GcsOutputConfig gcs_output_config = 1;
85+
}
86+
}

google/cloud/documentai/v1beta3/document_processor_service.proto

Lines changed: 118 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/api/resource.proto";
2323
import "google/cloud/documentai/v1beta3/document.proto";
24+
import "google/cloud/documentai/v1beta3/document_io.proto";
2425
import "google/longrunning/operations.proto";
2526
import "google/protobuf/field_mask.proto";
2627
import "google/protobuf/timestamp.proto";
@@ -99,6 +100,15 @@ service DocumentProcessorService {
99100

100101
// Request message for the process document method.
101102
message ProcessRequest {
103+
// The document payload.
104+
oneof source {
105+
// An inline document proto.
106+
Document inline_document = 4;
107+
108+
// A raw document content (bytes).
109+
RawDocument raw_document = 5;
110+
}
111+
102112
// Required. The processor resource name.
103113
string name = 1 [
104114
(google.api.field_behavior) = REQUIRED,
@@ -108,13 +118,49 @@ message ProcessRequest {
108118
];
109119

110120
// The document payload, the [content] and [mime_type] fields must be set.
111-
Document document = 2;
121+
Document document = 2 [deprecated = true];
112122

113123
// Whether Human Review feature should be skipped for this request. Default to
114124
// false.
115125
bool skip_human_review = 3;
116126
}
117127

128+
// The status of human review on a processed document.
129+
message HumanReviewStatus {
130+
// The final state of human review on a processed document.
131+
enum State {
132+
// Human review state is unspecified. Most likely due to an internal error.
133+
STATE_UNSPECIFIED = 0;
134+
135+
// Human review is skipped for the document. This can happen because human
136+
// review is not enabled on the processor or the processing request has
137+
// been set to skip this document.
138+
SKIPPED = 1;
139+
140+
// Human review validation is triggered and passed, so no review is needed.
141+
VALIDATION_PASSED = 2;
142+
143+
// Human review validation is triggered and the document is under review.
144+
IN_PROGRESS = 3;
145+
146+
// Some error happened during triggering human review, see the
147+
// [state_message] for details.
148+
ERROR = 4;
149+
}
150+
151+
// The state of human review on the processing request.
152+
State state = 1;
153+
154+
// A message providing more details about the human review state.
155+
string state_message = 2;
156+
157+
// The name of the operation triggered by the processed document. This field
158+
// is populated only when the [state] is [HUMAN_REVIEW_IN_PROGRESS]. It has
159+
// the same response type and metadata as the long running operation returned
160+
// by [ReviewDocument] method.
161+
string human_review_operation = 3;
162+
}
163+
118164
// Response message for the process document method.
119165
message ProcessResponse {
120166
// The document payload, will populate fields based on the processor's
@@ -125,13 +171,18 @@ message ProcessResponse {
125171
// review process is not triggered, this field will be empty. It has the same
126172
// response type and metadata as the long running operation returned by
127173
// ReviewDocument method.
128-
string human_review_operation = 2;
174+
string human_review_operation = 2 [deprecated = true];
175+
176+
// The status of human review on the processed document.
177+
HumanReviewStatus human_review_status = 3;
129178
}
130179

131180
// Request message for batch process document method.
132181
message BatchProcessRequest {
133182
// The message for input config in batch process.
134183
message BatchInputConfig {
184+
option deprecated = true;
185+
135186
// The Cloud Storage location as the source of the document.
136187
string gcs_source = 1;
137188

@@ -143,6 +194,8 @@ message BatchProcessRequest {
143194

144195
// The message for output config in batch process.
145196
message BatchOutputConfig {
197+
option deprecated = true;
198+
146199
// The output Cloud Storage directory to put the processed documents.
147200
string gcs_destination = 1;
148201
}
@@ -156,10 +209,20 @@ message BatchProcessRequest {
156209
];
157210

158211
// The input config for each single document in the batch process.
159-
repeated BatchInputConfig input_configs = 2;
212+
repeated BatchInputConfig input_configs = 2 [deprecated = true];
160213

161214
// The overall output config for batch process.
162-
BatchOutputConfig output_config = 3;
215+
BatchOutputConfig output_config = 3 [deprecated = true];
216+
217+
// The input documents for batch process.
218+
BatchDocumentsInputConfig input_documents = 5;
219+
220+
// The overall output config for batch process.
221+
DocumentOutputConfig document_output_config = 6;
222+
223+
// Whether Human Review feature should be skipped for this request. Default to
224+
// false.
225+
bool skip_human_review = 4;
163226
}
164227

165228
// Response message for batch process document method.
@@ -188,7 +251,10 @@ message BatchProcessMetadata {
188251
// human review process is not triggered, this field will be empty. It has
189252
// the same response type and metadata as the long running operation
190253
// returned by ReviewDocument method.
191-
string human_review_operation = 4;
254+
string human_review_operation = 4 [deprecated = true];
255+
256+
// The status of human review on the processed document.
257+
HumanReviewStatus human_review_status = 5;
192258
}
193259

194260
// Possible states of the batch processing operation.
@@ -234,6 +300,12 @@ message BatchProcessMetadata {
234300

235301
// Request message for review document method.
236302
message ReviewDocumentRequest {
303+
// The document payload.
304+
oneof source {
305+
// An inline document proto.
306+
Document inline_document = 4;
307+
}
308+
237309
// Required. The resource name of the HumanReviewConfig that the document will be
238310
// reviewed with.
239311
string human_review_config = 1 [
@@ -244,7 +316,7 @@ message ReviewDocumentRequest {
244316
];
245317

246318
// The document that needs human review.
247-
Document document = 2;
319+
Document document = 2 [deprecated = true];
248320
}
249321

250322
// Response message for review document method.
@@ -288,4 +360,43 @@ message ReviewDocumentOperationMetadata {
288360

289361
// The last update time of the operation.
290362
google.protobuf.Timestamp update_time = 4;
363+
364+
// The basic metadata of the long running operation.
365+
CommonOperationMetadata common_metadata = 5;
366+
}
367+
368+
// The common metadata for long running operations.
369+
message CommonOperationMetadata {
370+
// State of the longrunning operation.
371+
enum State {
372+
// Unspecified state.
373+
STATE_UNSPECIFIED = 0;
374+
375+
// Operation is still running.
376+
RUNNING = 1;
377+
378+
// Operation is being cancelled.
379+
CANCELLING = 2;
380+
381+
// Operation succeeded.
382+
SUCCEEDED = 3;
383+
384+
// Operation failed.
385+
FAILED = 4;
386+
387+
// Operation is cancelled.
388+
CANCELLED = 5;
389+
}
390+
391+
// The state of the operation.
392+
State state = 1;
393+
394+
// A message providing more details about the current state of processing.
395+
string state_message = 2;
396+
397+
// The creation time of the operation.
398+
google.protobuf.Timestamp create_time = 3;
399+
400+
// The last update time of the operation.
401+
google.protobuf.Timestamp update_time = 4;
291402
}

0 commit comments

Comments
 (0)