Skip to content

Commit

Permalink
feat!: removed id field from Document message
Browse files Browse the repository at this point in the history
feat: added http configuration and document publishing for v1beta2
feat: added ImportDocuments, GetDocument and BatchDeleteDocuments RPCs for v1beta3

PiperOrigin-RevId: 548236986
  • Loading branch information
Google APIs authored and Copybara-Service committed Jul 14, 2023
1 parent e386b77 commit 237b3c1
Show file tree
Hide file tree
Showing 16 changed files with 1,150 additions and 158 deletions.
13 changes: 5 additions & 8 deletions google/cloud/documentai/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ java_gapic_library(
rest_numeric_enums = True,
service_yaml = "documentai_v1.yaml",
test_deps = [
":documentai_java_grpc",
"//google/cloud/location:location_java_grpc",
":documentai_java_grpc",
],
transport = "grpc+rest",
deps = [
Expand Down Expand Up @@ -190,15 +190,9 @@ load(
"@com_google_googleapis_imports//:imports.bzl",
"py_gapic_assembly_pkg",
"py_gapic_library",
"py_proto_library",
"py_test",
)

py_proto_library(
name = "documentai_py_proto",
deps = [":documentai_proto"],
)

py_gapic_library(
name = "documentai_py_gapic",
srcs = [":documentai_proto"],
Expand Down Expand Up @@ -252,7 +246,9 @@ php_gapic_library(
rest_numeric_enums = True,
service_yaml = "documentai_v1.yaml",
transport = "grpc+rest",
deps = [":documentai_php_proto"],
deps = [
":documentai_php_proto",
],
)

# Open Source Packages
Expand Down Expand Up @@ -362,6 +358,7 @@ load(

csharp_proto_library(
name = "documentai_csharp_proto",
extra_opts = [],
deps = [":documentai_proto"],
)

Expand Down
41 changes: 41 additions & 0 deletions google/cloud/documentai/v1/document_io.proto
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,44 @@ message DocumentOutputConfig {
GcsOutputConfig gcs_output_config = 1;
}
}

// Config for Document OCR.
message OcrConfig {
// Hints for OCR Engine
message Hints {
// List of BCP-47 language codes to use for OCR. In most cases, not
// specifying it yields the best results since it enables automatic language
// detection. For languages based on the Latin alphabet, setting hints is
// not needed. In rare cases, when the language of the text in the
// image is known, setting a hint will help get better results (although it
// will be a significant hindrance if the hint is wrong).
repeated string language_hints = 1;
}

// Hints for the OCR model.
Hints hints = 2;

// Enables special handling for PDFs with existing text information. Results
// in better text extraction quality in such PDF inputs.
bool enable_native_pdf_parsing = 3;

// Enables intelligent document quality scores after OCR. Can help with
// diagnosing why OCR responses are of poor quality for a given input.
// Adds additional latency comparable to regular OCR to the process call.
bool enable_image_quality_scores = 4;

// A list of advanced OCR options to further fine-tune OCR behavior. Current
// valid values are:
//
// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
// an alternative to the current ML-based layout detection algorithm.
// Customers can choose the best suitable layout algorithm based on their
// situation.
repeated string advanced_ocr_options = 5;

// Includes symbol level OCR information if set to true.
bool enable_symbol = 6;

// Turn on font id model and returns font style information.
bool compute_style_info = 8;
}
38 changes: 38 additions & 0 deletions google/cloud/documentai/v1/document_processor_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,13 @@ service DocumentProcessorService {
}
}

// Options for Process API
message ProcessOptions {
// Only applicable to `OCR_PROCESSOR`. Returns error if set on other
// processor types.
OcrConfig ocr_config = 1;
}

// Request message for the
// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
// method.
Expand All @@ -337,6 +344,9 @@ message ProcessRequest {

// A raw document content (bytes).
RawDocument raw_document = 5;

// A raw document on Google Cloud Storage.
GcsDocument gcs_document = 8;
}

// Required. The resource name of the
Expand All @@ -363,6 +373,9 @@ message ProcessRequest {
// output. Only supports top-level document and pages field, so it must be in
// the form of `{document_field_name}` or `pages.{page_field_name}`.
google.protobuf.FieldMask field_mask = 6;

// Inference-time options for the process API
ProcessOptions process_options = 7;
}

// The status of human review on a processed document.
Expand Down Expand Up @@ -443,6 +456,9 @@ message BatchProcessRequest {
// Whether human review should be skipped for this request. Default to
// `false`.
bool skip_human_review = 4;

// Inference-time options for the process API
ProcessOptions process_options = 7;
}

// Response message for
Expand Down Expand Up @@ -895,6 +911,28 @@ message TrainProcessorVersionRequest {
BatchDocumentsInputConfig test_documents = 4;
}

// Options to control the training of the Custom Document Extraction (CDE)
// Processor.
message CustomDocumentExtractionOptions {
// Training Method for CDE. TRAINING_METHOD_UNSPECIFIED will fallback to
// MODEL_BASED.
enum TrainingMethod {
TRAINING_METHOD_UNSPECIFIED = 0;

MODEL_BASED = 1;

TEMPLATE_BASED = 2;
}

// Training method to use for CDE training.
TrainingMethod training_method = 3;
}

oneof processor_flags {
// Options to control Custom Document Extraction (CDE) Processor.
CustomDocumentExtractionOptions custom_document_extraction_options = 5;
}

// Required. The parent (project, location and processor) to create the new
// version for. Format:
// `projects/{project}/locations/{location}/processors/{processor}`.
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/documentai/v1/processor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ message ProcessorVersion {
// The KMS key version with which data is encrypted.
string kms_key_version_name = 10;

// Denotes that this `ProcessorVersion` is managed by Google.
bool google_managed = 11;
// Output only. Denotes that this `ProcessorVersion` is managed by Google.
bool google_managed = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

// If set, information about the eventual deprecation of this version.
DeprecationInfo deprecation_info = 13;
Expand Down
46 changes: 43 additions & 3 deletions google/cloud/documentai/v1beta2/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was automatically generated by BuildFileGenerator
# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
# https://github.com/googleapis/rules_gapic/tree/master/bazel

# Most of the manual changes to this file will be overwritten.
# It's **only** allowed to change the following rule attribute values:
Expand All @@ -21,6 +21,7 @@ load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
proto_library(
name = "documentai_proto",
srcs = [
"barcode.proto",
"document.proto",
"document_understanding.proto",
"geometry.proto",
Expand All @@ -32,6 +33,10 @@ proto_library(
"//google/longrunning:operations_proto",
"//google/rpc:status_proto",
"//google/type:color_proto",
"//google/type:date_proto",
"//google/type:datetime_proto",
"//google/type:money_proto",
"//google/type:postal_address_proto",
"@com_google_protobuf//:timestamp_proto",
],
)
Expand All @@ -41,6 +46,7 @@ proto_library_with_info(
deps = [
":documentai_proto",
"//google/cloud:common_resources_proto",
"//google/cloud/location:location_proto",
],
)

Expand Down Expand Up @@ -70,15 +76,19 @@ java_grpc_library(
java_gapic_library(
name = "documentai_java_gapic",
srcs = [":documentai_proto_with_info"],
gapic_yaml = "documentai_gapic.yaml",
grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
rest_numeric_enums = True,
service_yaml = "documentai_v1beta2.yaml",
test_deps = [
"//google/cloud/location:location_java_grpc",
":documentai_java_grpc",
],
transport = "grpc",
deps = [
":documentai_java_proto",
"//google/api:api_java_proto",
"//google/cloud/location:location_java_proto",
],
)

Expand Down Expand Up @@ -123,6 +133,10 @@ go_proto_library(
"//google/longrunning:longrunning_go_proto",
"//google/rpc:status_go_proto",
"//google/type:color_go_proto",
"//google/type:date_go_proto",
"//google/type:datetime_go_proto",
"//google/type:money_go_proto",
"//google/type:postaladdress_go_proto",
],
)

Expand All @@ -131,12 +145,14 @@ go_gapic_library(
srcs = [":documentai_proto_with_info"],
grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
importpath = "cloud.google.com/go/documentai/apiv1beta2;documentai",
metadata = True,
release_level = "beta",
rest_numeric_enums = True,
service_yaml = "documentai_v1beta2.yaml",
transport = "grpc",
deps = [
":documentai_go_proto",
"//google/cloud/location:location_go_proto",
"//google/longrunning:longrunning_go_proto",
"@com_google_cloud_go_longrunning//:go_default_library",
"@com_google_cloud_go_longrunning//autogen:go_default_library",
Expand All @@ -148,6 +164,7 @@ go_gapic_assembly_pkg(
name = "gapi-cloud-documentai-v1beta2-go",
deps = [
":documentai_go_gapic",
":documentai_go_gapic_srcjar-metadata.srcjar",
":documentai_go_gapic_srcjar-snippets.srcjar",
":documentai_go_gapic_srcjar-test.srcjar",
":documentai_go_proto",
Expand All @@ -171,6 +188,8 @@ py_gapic_library(
rest_numeric_enums = True,
service_yaml = "documentai_v1beta2.yaml",
transport = "grpc",
deps = [
],
)

py_test(
Expand Down Expand Up @@ -210,10 +229,13 @@ php_gapic_library(
name = "documentai_php_gapic",
srcs = [":documentai_proto_with_info"],
grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
migration_mode = "PRE_MIGRATION_SURFACE_ONLY",
rest_numeric_enums = True,
service_yaml = "documentai_v1beta2.yaml",
transport = "grpc+rest",
deps = [":documentai_php_proto"],
deps = [
":documentai_php_proto",
],
)

# Open Source Packages
Expand Down Expand Up @@ -281,6 +303,7 @@ ruby_cloud_gapic_library(
name = "documentai_ruby_gapic",
srcs = [":documentai_proto_with_info"],
extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-documentai-v1beta2"],
grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
rest_numeric_enums = True,
service_yaml = "documentai_v1beta2.yaml",
transport = "grpc",
Expand Down Expand Up @@ -313,6 +336,7 @@ load(

csharp_proto_library(
name = "documentai_csharp_proto",
extra_opts = [],
deps = [":documentai_proto"],
)

Expand Down Expand Up @@ -349,4 +373,20 @@ csharp_gapic_assembly_pkg(
##############################################################################
# C++
##############################################################################
# Put your C++ rules here
load(
"@com_google_googleapis_imports//:imports.bzl",
"cc_grpc_library",
"cc_proto_library",
)

cc_proto_library(
name = "documentai_cc_proto",
deps = [":documentai_proto"],
)

cc_grpc_library(
name = "documentai_cc_grpc",
srcs = [":documentai_proto"],
grpc_only = True,
deps = [":documentai_cc_proto"],
)
69 changes: 69 additions & 0 deletions google/cloud/documentai/v1beta2/barcode.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.documentai.v1beta2;

option csharp_namespace = "Google.Cloud.DocumentAI.V1Beta2";
option go_package = "cloud.google.com/go/documentai/apiv1beta2/documentaipb;documentaipb";
option java_multiple_files = true;
option java_outer_classname = "BarcodeProto";
option java_package = "com.google.cloud.documentai.v1beta2";
option php_namespace = "Google\\Cloud\\DocumentAI\\V1beta2";
option ruby_package = "Google::Cloud::DocumentAI::V1beta2";

// Encodes the detailed information of a barcode.
message Barcode {
// Format of a barcode.
// The supported formats are:
//
// - `CODE_128`: Code 128 type.
// - `CODE_39`: Code 39 type.
// - `CODE_93`: Code 93 type.
// - `CODABAR`: Codabar type.
// - `DATA_MATRIX`: 2D Data Matrix type.
// - `ITF`: ITF type.
// - `EAN_13`: EAN-13 type.
// - `EAN_8`: EAN-8 type.
// - `QR_CODE`: 2D QR code type.
// - `UPC_A`: UPC-A type.
// - `UPC_E`: UPC-E type.
// - `PDF417`: PDF417 type.
// - `AZTEC`: 2D Aztec code type.
// - `DATABAR`: GS1 DataBar code type.
string format = 1;

// Value format describes the format of the value that a barcode
// encodes.
// The supported formats are:
//
// - `CONTACT_INFO`: Contact information.
// - `EMAIL`: Email address.
// - `ISBN`: ISBN identifier.
// - `PHONE`: Phone number.
// - `PRODUCT`: Product.
// - `SMS`: SMS message.
// - `TEXT`: Text string.
// - `URL`: URL address.
// - `WIFI`: Wifi information.
// - `GEO`: Geo-localization.
// - `CALENDAR_EVENT`: Calendar event.
// - `DRIVER_LICENSE`: Driver's license.
string value_format = 2;

// Raw value encoded in the barcode.
// For example: `'MEBKM:TITLE:Google;URL:https://www.google.com;;'`.
string raw_value = 3;
}

0 comments on commit 237b3c1

Please sign in to comment.