Skip to content

Commit 19906f9

Browse files
Google APIscopybara-github
authored andcommitted
feat: update document.proto, add the processor management methods.
PiperOrigin-RevId: 379607978
1 parent 5308b86 commit 19906f9

6 files changed

Lines changed: 389 additions & 6 deletions

File tree

google/cloud/documentai/v1beta3/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ proto_library(
2525
"document_io.proto",
2626
"document_processor_service.proto",
2727
"geometry.proto",
28+
"processor.proto",
29+
"processor_type.proto",
2830
"operation_metadata.proto",
2931
],
3032
deps = [

google/cloud/documentai/v1beta3/document.proto

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ message Document {
324324
// - "unfilled_checkbox"
325325
// - "filled_checkbox"
326326
string value_type = 5;
327+
328+
// The history of this annotation.
329+
Provenance provenance = 8;
327330
}
328331

329332
// Detected language for a structural component.
@@ -385,6 +388,9 @@ message Document {
385388

386389
// A list of visually detected form fields on the page.
387390
repeated FormField form_fields = 11;
391+
392+
// The history of this page.
393+
Provenance provenance = 16;
388394
}
389395

390396
// A phrase in the text that is a known entity type, such as a person, an
@@ -536,6 +542,8 @@ message Document {
536542

537543
// Required. Index into the [Document.pages][google.cloud.documentai.v1beta3.Document.pages] element, for example using
538544
// [Document.pages][page_refs.page] to locate the related page element.
545+
// This field is skipped when its value is the default 0. See
546+
// https://developers.google.com/protocol-buffers/docs/proto3#json.
539547
int64 page = 1 [(google.api.field_behavior) = REQUIRED];
540548

541549
// Optional. The type of the layout element that is being referenced if any.
@@ -568,8 +576,12 @@ message Document {
568576
// The index of the [Document.revisions] identifying the parent revision.
569577
int32 revision = 1;
570578

579+
// The index of the parent revisions corresponding collection of items
580+
// (eg. list of entities, properties within entities, etc.)
581+
int32 index = 3;
582+
571583
// The id of the parent provenance.
572-
int32 id = 2;
584+
int32 id = 2 [deprecated = true];
573585
}
574586

575587
// If a processor or agent does an explicit operation on existing elements.
@@ -602,7 +614,7 @@ message Document {
602614

603615
// The Id of this operation. Needs to be unique within the scope of the
604616
// revision.
605-
int32 id = 2;
617+
int32 id = 2 [deprecated = true];
606618

607619
// References to the original elements that are replaced.
608620
repeated Parent parents = 3;

google/cloud/documentai/v1beta3/document_processor_service.proto

Lines changed: 209 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import "google/api/resource.proto";
2323
import "google/cloud/documentai/v1beta3/document.proto";
2424
import "google/cloud/documentai/v1beta3/document_io.proto";
2525
import "google/cloud/documentai/v1beta3/operation_metadata.proto";
26+
import "google/cloud/documentai/v1beta3/processor.proto";
27+
import "google/cloud/documentai/v1beta3/processor_type.proto";
2628
import "google/longrunning/operations.proto";
2729
import "google/protobuf/field_mask.proto";
2830
import "google/protobuf/timestamp.proto";
@@ -44,10 +46,6 @@ option (google.api.resource_definition) = {
4446
type: "documentai.googleapis.com/Location"
4547
pattern: "projects/{project}/locations/{location}"
4648
};
47-
option (google.api.resource_definition) = {
48-
type: "documentai.googleapis.com/Processor"
49-
pattern: "projects/{project}/locations/{location}/processors/{processor}"
50-
};
5149
option (google.api.resource_definition) = {
5250
type: "documentai.googleapis.com/HumanReviewConfig"
5351
pattern: "projects/{project}/locations/{location}/processors/{processor}/humanReviewConfig"
@@ -84,6 +82,69 @@ service DocumentProcessorService {
8482
};
8583
}
8684

85+
// Fetches processor types.
86+
rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse) {
87+
option (google.api.http) = {
88+
get: "/v1beta3/{parent=projects/*/locations/*}:fetchProcessorTypes"
89+
};
90+
option (google.api.method_signature) = "parent";
91+
}
92+
93+
// Lists all processors which belong to this project.
94+
rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse) {
95+
option (google.api.http) = {
96+
get: "/v1beta3/{parent=projects/*/locations/*}/processors"
97+
};
98+
option (google.api.method_signature) = "parent";
99+
}
100+
101+
// Creates a processor from the type processor that the user chose.
102+
// The processor will be at "ENABLED" state by default after its creation.
103+
rpc CreateProcessor(CreateProcessorRequest) returns (Processor) {
104+
option (google.api.http) = {
105+
post: "/v1beta3/{parent=projects/*/locations/*}/processors"
106+
body: "processor"
107+
};
108+
option (google.api.method_signature) = "parent,processor";
109+
}
110+
111+
// Deletes the processor, unloads all deployed model artifacts if it was
112+
// enabled and then deletes all artifacts associated with this processor.
113+
rpc DeleteProcessor(DeleteProcessorRequest) returns (google.longrunning.Operation) {
114+
option (google.api.http) = {
115+
delete: "/v1beta3/{name=projects/*/locations/*/processors/*}"
116+
};
117+
option (google.api.method_signature) = "name";
118+
option (google.longrunning.operation_info) = {
119+
response_type: "google.protobuf.Empty"
120+
metadata_type: "DeleteProcessorMetadata"
121+
};
122+
}
123+
124+
// Enables a processor
125+
rpc EnableProcessor(EnableProcessorRequest) returns (google.longrunning.Operation) {
126+
option (google.api.http) = {
127+
post: "/v1beta3/{name=projects/*/locations/*/processors/*}:enable"
128+
body: "*"
129+
};
130+
option (google.longrunning.operation_info) = {
131+
response_type: "EnableProcessorResponse"
132+
metadata_type: "EnableProcessorMetadata"
133+
};
134+
}
135+
136+
// Disables a processor
137+
rpc DisableProcessor(DisableProcessorRequest) returns (google.longrunning.Operation) {
138+
option (google.api.http) = {
139+
post: "/v1beta3/{name=projects/*/locations/*/processors/*}:disable"
140+
body: "*"
141+
};
142+
option (google.longrunning.operation_info) = {
143+
response_type: "DisableProcessorResponse"
144+
metadata_type: "DisableProcessorMetadata"
145+
};
146+
}
147+
87148
// Send a document for Human Review. The input document should be processed by
88149
// the specified processor.
89150
rpc ReviewDocument(ReviewDocumentRequest) returns (google.longrunning.Operation) {
@@ -299,8 +360,146 @@ message BatchProcessMetadata {
299360
repeated IndividualProcessStatus individual_process_statuses = 5;
300361
}
301362

363+
// Request message for fetch processor types.
364+
message FetchProcessorTypesRequest {
365+
// Required. The project of processor type to list.
366+
// Format: projects/{project}/locations/{location}
367+
string parent = 1 [
368+
(google.api.field_behavior) = REQUIRED,
369+
(google.api.resource_reference) = {
370+
child_type: "documentai.googleapis.com/ProcessorType"
371+
}
372+
];
373+
}
374+
375+
// Response message for fetch processor types.
376+
message FetchProcessorTypesResponse {
377+
// The list of processor types.
378+
repeated ProcessorType processor_types = 1;
379+
}
380+
381+
// Request message for list all processors belongs to a project.
382+
message ListProcessorsRequest {
383+
// Required. The parent (project and location) which owns this collection of Processors.
384+
// Format: projects/{project}/locations/{location}
385+
string parent = 1 [
386+
(google.api.field_behavior) = REQUIRED,
387+
(google.api.resource_reference) = {
388+
child_type: "documentai.googleapis.com/Processor"
389+
}
390+
];
391+
392+
// The maximum number of processors to return.
393+
// If unspecified, at most 50 processors will be returned.
394+
// The maximum value is 100; values above 100 will be coerced to 100.
395+
int32 page_size = 2;
396+
397+
// We will return the processors sorted by creation time. The page token
398+
// will point to the next processor.
399+
string page_token = 3;
400+
}
401+
402+
// Response message for list processors.
403+
message ListProcessorsResponse {
404+
// The list of processors.
405+
repeated Processor processors = 1;
406+
407+
// Points to the next processor, otherwise empty.
408+
string next_page_token = 2;
409+
}
410+
411+
// Request message for create a processor. Notice this request is sent to
412+
// a regionalized backend service, and if the processor type is not available
413+
// on that region, the creation will fail.
414+
message CreateProcessorRequest {
415+
// Required. The parent (project and location) under which to create the processor.
416+
// Format: projects/{project}/locations/{location}
417+
string parent = 1 [
418+
(google.api.field_behavior) = REQUIRED,
419+
(google.api.resource_reference) = {
420+
child_type: "documentai.googleapis.com/Processor"
421+
}
422+
];
423+
424+
// Required. The processor to be created, requires [processor_type] and [display_name]
425+
// to be set. Also, the processor is under CMEK if CMEK fields are set.
426+
Processor processor = 2 [(google.api.field_behavior) = REQUIRED];
427+
}
428+
429+
// Request message for the delete processor method.
430+
message DeleteProcessorRequest {
431+
// Required. The processor resource name to be deleted.
432+
string name = 1 [
433+
(google.api.field_behavior) = REQUIRED,
434+
(google.api.resource_reference) = {
435+
type: "documentai.googleapis.com/Processor"
436+
}
437+
];
438+
}
439+
440+
// The long running operation metadata for delete processor method.
441+
message DeleteProcessorMetadata {
442+
// The basic metadata of the long running operation.
443+
CommonOperationMetadata common_metadata = 5;
444+
}
445+
446+
// Request message for the enable processor method.
447+
message EnableProcessorRequest {
448+
// Required. The processor resource name to be enabled.
449+
string name = 1 [
450+
(google.api.field_behavior) = REQUIRED,
451+
(google.api.resource_reference) = {
452+
type: "documentai.googleapis.com/Processor"
453+
}
454+
];
455+
}
456+
457+
// Response message for the enable processor method.
458+
message EnableProcessorResponse {
459+
460+
}
461+
462+
// The long running operation metadata for enable processor method.
463+
message EnableProcessorMetadata {
464+
// The basic metadata of the long running operation.
465+
CommonOperationMetadata common_metadata = 5;
466+
}
467+
468+
// Request message for the disable processor method.
469+
message DisableProcessorRequest {
470+
// Required. The processor resource name to be disabled.
471+
string name = 1 [
472+
(google.api.field_behavior) = REQUIRED,
473+
(google.api.resource_reference) = {
474+
type: "documentai.googleapis.com/Processor"
475+
}
476+
];
477+
}
478+
479+
// Response message for the disable processor method.
480+
message DisableProcessorResponse {
481+
482+
}
483+
484+
// The long running operation metadata for disable processor method.
485+
message DisableProcessorMetadata {
486+
// The basic metadata of the long running operation.
487+
CommonOperationMetadata common_metadata = 5;
488+
}
489+
302490
// Request message for review document method.
491+
// Next Id: 6.
303492
message ReviewDocumentRequest {
493+
// The priority level of the human review task.
494+
enum Priority {
495+
// The default priority level.
496+
DEFAULT = 0;
497+
498+
// The urgent priority level. The labeling manager should allocate labeler
499+
// resource to the urgent task queue to respect this priority level.
500+
URGENT = 1;
501+
}
502+
304503
// The document payload.
305504
oneof source {
306505
// An inline document proto.
@@ -318,6 +517,12 @@ message ReviewDocumentRequest {
318517

319518
// The document that needs human review.
320519
Document document = 2 [deprecated = true];
520+
521+
// Whether the validation should be performed on the ad-hoc review request.
522+
bool enable_schema_validation = 3;
523+
524+
// The priority of the human review task.
525+
Priority priority = 5;
321526
}
322527

323528
// Response message for review document method.

google/cloud/documentai/v1beta3/documentai_v1beta3.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ apis:
99
types:
1010
- name: google.cloud.documentai.v1beta3.BatchProcessMetadata
1111
- name: google.cloud.documentai.v1beta3.BatchProcessResponse
12+
- name: google.cloud.documentai.v1beta3.DeleteProcessorMetadata
13+
- name: google.cloud.documentai.v1beta3.DisableProcessorMetadata
14+
- name: google.cloud.documentai.v1beta3.DisableProcessorResponse
15+
- name: google.cloud.documentai.v1beta3.EnableProcessorMetadata
16+
- name: google.cloud.documentai.v1beta3.EnableProcessorResponse
1217
- name: google.cloud.documentai.v1beta3.ReviewDocumentOperationMetadata
1318
- name: google.cloud.documentai.v1beta3.ReviewDocumentResponse
1419

0 commit comments

Comments
 (0)