Skip to content

Commit

Permalink
feat: [documentai] add StyleInfo to document.proto (#9551)
Browse files Browse the repository at this point in the history
* feat: add StyleInfo to document.proto
feat: add REPLACE enum to OperationType in document.proto
feat: add PropertyMetadata and EntityTypeMetadata to document_schema.proto
feat: add IMPORTING enum to State in processor.proto
chore: updated comments

PiperOrigin-RevId: 540932243

Source-Link: googleapis/googleapis@120a89c

Source-Link: googleapis/googleapis-gen@82a61cd
Copy-Tag: eyJwIjoiamF2YS1kb2N1bWVudC1haS8uT3dsQm90LnlhbWwiLCJoIjoiODJhNjFjZDg5YjQ4OTlhYzk0Yzg3NzkxOTE2Yjc3YmYyYWI3M2QxNiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add StyleInfo to document.proto
feat: add IMPORTING enum to State in processor.proto
chore: updated comments

PiperOrigin-RevId: 540937637

Source-Link: googleapis/googleapis@b2b3723

Source-Link: googleapis/googleapis-gen@9f620d1
Copy-Tag: eyJwIjoiamF2YS1kb2N1bWVudC1haS8uT3dsQm90LnlhbWwiLCJoIjoiOWY2MjBkMTljZTlhM2FhZjUwMTM2Yzk5ODVkNjA1MTA2ZjcyYmFlYiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jun 20, 2023
1 parent f399914 commit c873d10
Show file tree
Hide file tree
Showing 260 changed files with 30,727 additions and 3,766 deletions.
2 changes: 1 addition & 1 deletion java-document-ai/README.md
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.16.0</version>
<version>26.17.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Expand Up @@ -45,7 +45,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service to call Cloud DocumentAI to process documents according to the
* Service Description: Service to call Document AI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
* language, computer vision, and translation to extract structured information from unstructured or
* semi-structured documents.
Expand Down Expand Up @@ -525,8 +525,9 @@ public final UnaryCallable<BatchProcessRequest, Operation> batchProcessDocuments

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
* paginated.
* Fetches processor types. Note that we don't use
* [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
* here, because it isn't paginated.
*
* <p>Sample code:
*
Expand All @@ -544,9 +545,8 @@ public final UnaryCallable<BatchProcessRequest, Operation> batchProcessDocuments
* }
* }</pre>
*
* @param parent Required. The project of processor type to list. The available processor types
* may depend on the allow-listing on projects. Format:
* `projects/{project}/locations/{location}`
* @param parent Required. The location of processor types to list. Format:
* `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent) {
Expand All @@ -559,8 +559,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
* paginated.
* Fetches processor types. Note that we don't use
* [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
* here, because it isn't paginated.
*
* <p>Sample code:
*
Expand All @@ -578,9 +579,8 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(LocationName parent
* }
* }</pre>
*
* @param parent Required. The project of processor type to list. The available processor types
* may depend on the allow-listing on projects. Format:
* `projects/{project}/locations/{location}`
* @param parent Required. The location of processor types to list. Format:
* `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final FetchProcessorTypesResponse fetchProcessorTypes(String parent) {
Expand All @@ -591,8 +591,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(String parent) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
* paginated.
* Fetches processor types. Note that we don't use
* [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
* here, because it isn't paginated.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -622,8 +623,9 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(FetchProcessorTypes

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Fetches processor types. Note that we do not use ListProcessorTypes here because it is not
* paginated.
* Fetches processor types. Note that we don't use
* [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
* here, because it isn't paginated.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -673,9 +675,8 @@ public final FetchProcessorTypesResponse fetchProcessorTypes(FetchProcessorTypes
* }
* }</pre>
*
* @param parent Required. The location of processor type to list. The available processor types
* may depend on the allow-listing on projects. Format:
* `projects/{project}/locations/{location}`
* @param parent Required. The location of processor types to list. Format:
* `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListProcessorTypesPagedResponse listProcessorTypes(LocationName parent) {
Expand Down Expand Up @@ -708,9 +709,8 @@ public final ListProcessorTypesPagedResponse listProcessorTypes(LocationName par
* }
* }</pre>
*
* @param parent Required. The location of processor type to list. The available processor types
* may depend on the allow-listing on projects. Format:
* `projects/{project}/locations/{location}`
* @param parent Required. The location of processor types to list. Format:
* `projects/{project}/locations/{location}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListProcessorTypesPagedResponse listProcessorTypes(String parent) {
Expand Down Expand Up @@ -1232,7 +1232,7 @@ public final UnaryCallable<GetProcessorRequest, Processor> getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
* cloud_documentai_core.TrainProcessorVersionMetadata.
* [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1269,7 +1269,7 @@ public final UnaryCallable<GetProcessorRequest, Processor> getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
* cloud_documentai_core.TrainProcessorVersionMetadata.
* [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1306,7 +1306,7 @@ public final UnaryCallable<GetProcessorRequest, Processor> getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
* cloud_documentai_core.TrainProcessorVersionMetadata.
* [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1342,7 +1342,7 @@ public final UnaryCallable<GetProcessorRequest, Processor> getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
* cloud_documentai_core.TrainProcessorVersionMetadata.
* [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* <p>Sample code:
*
Expand Down Expand Up @@ -1382,7 +1382,7 @@ public final UnaryCallable<GetProcessorRequest, Processor> getProcessorCallable(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Trains a new processor version. Operation metadata is returned as
* cloud_documentai_core.TrainProcessorVersionMetadata.
* [TrainProcessorVersionMetadata][google.cloud.documentai.v1.TrainProcessorVersionMetadata].
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2223,8 +2223,8 @@ public final OperationFuture<Empty, DeleteProcessorVersionMetadata> deleteProces

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a processor from the type processor that the user chose. The processor will be at
* "ENABLED" state by default after its creation.
* Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
* provided. The processor will be at `ENABLED` state by default after its creation.
*
* <p>Sample code:
*
Expand All @@ -2244,8 +2244,11 @@ public final OperationFuture<Empty, DeleteProcessorVersionMetadata> deleteProces
*
* @param parent Required. The parent (project and location) under which to create the processor.
* Format: `projects/{project}/locations/{location}`
* @param processor Required. The processor to be created, requires [processor_type] and
* [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.
* @param processor Required. The processor to be created, requires
* [Processor.type][google.cloud.documentai.v1.Processor.type] and [Processor.display_name]][]
* to be set. Also, the
* [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] field must be
* set if the processor is under CMEK.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Processor createProcessor(LocationName parent, Processor processor) {
Expand All @@ -2259,8 +2262,8 @@ public final Processor createProcessor(LocationName parent, Processor processor)

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a processor from the type processor that the user chose. The processor will be at
* "ENABLED" state by default after its creation.
* Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
* provided. The processor will be at `ENABLED` state by default after its creation.
*
* <p>Sample code:
*
Expand All @@ -2280,8 +2283,11 @@ public final Processor createProcessor(LocationName parent, Processor processor)
*
* @param parent Required. The parent (project and location) under which to create the processor.
* Format: `projects/{project}/locations/{location}`
* @param processor Required. The processor to be created, requires [processor_type] and
* [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.
* @param processor Required. The processor to be created, requires
* [Processor.type][google.cloud.documentai.v1.Processor.type] and [Processor.display_name]][]
* to be set. Also, the
* [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name] field must be
* set if the processor is under CMEK.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Processor createProcessor(String parent, Processor processor) {
Expand All @@ -2292,8 +2298,8 @@ public final Processor createProcessor(String parent, Processor processor) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a processor from the type processor that the user chose. The processor will be at
* "ENABLED" state by default after its creation.
* Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
* provided. The processor will be at `ENABLED` state by default after its creation.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2323,8 +2329,8 @@ public final Processor createProcessor(CreateProcessorRequest request) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a processor from the type processor that the user chose. The processor will be at
* "ENABLED" state by default after its creation.
* Creates a processor from the [ProcessorType][google.cloud.documentai.v1.ProcessorType]
* provided. The processor will be at `ENABLED` state by default after its creation.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -2825,8 +2831,9 @@ public final UnaryCallable<DisableProcessorRequest, Operation> disableProcessorC
* }
* }</pre>
*
* @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
* will be reviewed with.
* @param humanReviewConfig Required. The resource name of the
* [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the document will be
* reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<ReviewDocumentResponse, ReviewDocumentOperationMetadata>
Expand Down Expand Up @@ -2860,8 +2867,9 @@ public final UnaryCallable<DisableProcessorRequest, Operation> disableProcessorC
* }
* }</pre>
*
* @param humanReviewConfig Required. The resource name of the HumanReviewConfig that the document
* will be reviewed with.
* @param humanReviewConfig Required. The resource name of the
* [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the document will be
* reviewed with.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<ReviewDocumentResponse, ReviewDocumentOperationMetadata>
Expand Down
Expand Up @@ -21,7 +21,7 @@
*
* <p>======================= DocumentProcessorServiceClient =======================
*
* <p>Service Description: Service to call Cloud DocumentAI to process documents according to the
* <p>Service Description: Service to call Document AI to process documents according to the
* processor's definition. Processors are built using state-of-the-art Google AI such as natural
* language, computer vision, and translation to extract structured information from unstructured or
* semi-structured documents.
Expand Down
Expand Up @@ -1023,6 +1023,11 @@ public static class Builder
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put(
"retry_policy_1_codes",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
Expand All @@ -1032,6 +1037,17 @@ public static class Builder
static {
ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(300000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build();
definitions.put("retry_policy_0_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
Expand All @@ -1042,7 +1058,7 @@ public static class Builder
.setMaxRpcTimeout(Duration.ofMillis(120000L))
.setTotalTimeout(Duration.ofMillis(120000L))
.build();
definitions.put("retry_policy_0_params", settings);
definitions.put("retry_policy_1_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
Expand Down Expand Up @@ -1229,8 +1245,8 @@ private static Builder initDefaults(Builder builder) {

builder
.batchProcessDocumentsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.fetchProcessorTypesSettings()
Expand Down Expand Up @@ -1314,8 +1330,8 @@ private static Builder initDefaults(Builder builder) {

builder
.reviewDocumentSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.evaluateProcessorVersionSettings()
Expand Down Expand Up @@ -1347,8 +1363,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.<BatchProcessRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(BatchProcessResponse.class))
Expand Down Expand Up @@ -1573,8 +1589,8 @@ private static Builder initDefaults(Builder builder) {
.setInitialCallSettings(
UnaryCallSettings
.<ReviewDocumentRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(ReviewDocumentResponse.class))
Expand Down

0 comments on commit c873d10

Please sign in to comment.