From 0b5894ef99bc98d2076a6b7724c1b6979d77f4e5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 05:26:25 -0500 Subject: [PATCH] feat: Added EvaluationReference to evaluation.proto (#454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Added EvaluationReference to evaluation.proto feat: Added latest_evaluation to processor.proto chore!: Updated TrainProcessorVersion parent to correctly be a Processor, rather than ProcessorVersion BREAKING CHANGE: The TrainProcessorVersion parent was incorrectly annotated. PiperOrigin-RevId: 507577968 Source-Link: https://github.com/googleapis/googleapis/commit/a2cdee8aeb9238bb3c422e1e2acfa03a106cac00 Source-Link: https://github.com/googleapis/googleapis-gen/commit/68cd7fe32bd4387195a27b605b032ca1f5071222 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjhjZDdmZTMyYmQ0Mzg3MTk1YTI3YjYwNWIwMzJjYTFmNTA3MTIyMiJ9 * 🦉 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 --- .../cloud/documentai_v1beta3/__init__.py | 3 +- .../documentai_v1beta3/types/__init__.py | 3 +- .../documentai_v1beta3/types/document.py | 31 ++++++++++----- .../documentai_v1beta3/types/evaluation.py | 39 +++++++++++++++++++ .../documentai_v1beta3/types/processor.py | 9 +++++ ...t_metadata_google.cloud.documentai.v1.json | 2 +- ...adata_google.cloud.documentai.v1beta2.json | 2 +- ...adata_google.cloud.documentai.v1beta3.json | 2 +- 8 files changed, 77 insertions(+), 14 deletions(-) diff --git a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/__init__.py b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/__init__.py index 9613974b6712..7067ada490c3 100644 --- a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/__init__.py +++ b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/__init__.py @@ -86,7 +86,7 @@ UndeployProcessorVersionResponse, ) from .types.document_schema import DocumentSchema -from .types.evaluation import Evaluation +from .types.evaluation import Evaluation, EvaluationReference from .types.geometry import BoundingPoly, NormalizedVertex, Vertex from .types.operation_metadata import CommonOperationMetadata from .types.processor import Processor, ProcessorVersion @@ -123,6 +123,7 @@ "EvaluateProcessorVersionRequest", "EvaluateProcessorVersionResponse", "Evaluation", + "EvaluationReference", "FetchProcessorTypesRequest", "FetchProcessorTypesResponse", "GcsDocument", diff --git a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/__init__.py b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/__init__.py index 620057269971..641aeb56a84c 100644 --- a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/__init__.py +++ b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/__init__.py @@ -77,7 +77,7 @@ UndeployProcessorVersionResponse, ) from .document_schema import DocumentSchema -from .evaluation import Evaluation +from .evaluation import Evaluation, EvaluationReference from .geometry import BoundingPoly, NormalizedVertex, Vertex from .operation_metadata import CommonOperationMetadata from .processor import Processor, ProcessorVersion @@ -145,6 +145,7 @@ "UndeployProcessorVersionResponse", "DocumentSchema", "Evaluation", + "EvaluationReference", "BoundingPoly", "NormalizedVertex", "Vertex", diff --git a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/document.py b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/document.py index aac98f6a177b..0f9860f72bba 100644 --- a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/document.py +++ b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/document.py @@ -1481,20 +1481,30 @@ class OperationType(proto.Enum): Add an element. REMOVE (2): Remove an element identified by ``parent``. + UPDATE (7): + Updates any fields within the given + provenance scope of the message. It 'overwrites' + the fields rather than replacing them. This is + especially relevant when we just want to update + a field value of an entity without also + affecting all the child properties. REPLACE (3): - Replace an element identified by ``parent``. - EVAL_REQUESTED (4): - Request human review for the element identified by + Currently unused. Replace an element identified by ``parent``. + EVAL_REQUESTED (4): + Deprecated. Request human review for the element identified + by ``parent``. EVAL_APPROVED (5): - Element is reviewed and approved at human - review, confidence will be set to 1.0. + Deprecated. Element is reviewed and approved + at human review, confidence will be set to 1.0. EVAL_SKIPPED (6): - Element is skipped in the validation process. + Deprecated. Element is skipped in the + validation process. """ OPERATION_TYPE_UNSPECIFIED = 0 ADD = 1 REMOVE = 2 + UPDATE = 7 REPLACE = 3 EVAL_REQUESTED = 4 EVAL_APPROVED = 5 @@ -1571,8 +1581,9 @@ class Revision(proto.Message): This field is a member of `oneof`_ ``source``. id (str): - Id of the revision. Unique within the - context of the document. + Id of the revision, internally generated by + doc proto storage. Unique within the context of + the document. parent (MutableSequence[int]): The revisions that this revision is based on. This can include one or more parent (when documents are merged.) This @@ -1583,7 +1594,9 @@ class Revision(proto.Message): eg. there are ``provenance.parent.revision`` fields that index into this field. create_time (google.protobuf.timestamp_pb2.Timestamp): - The time that the revision was created. + The time that the revision was created, + internally generated by doc proto storage at the + time of create. human_review (google.cloud.documentai_v1beta3.types.Document.Revision.HumanReview): Human Review information of this revision. """ diff --git a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/evaluation.py b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/evaluation.py index b73c0b70333f..6905adf77c55 100644 --- a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/evaluation.py +++ b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/evaluation.py @@ -21,11 +21,50 @@ __protobuf__ = proto.module( package="google.cloud.documentai.v1beta3", manifest={ + "EvaluationReference", "Evaluation", }, ) +class EvaluationReference(proto.Message): + r"""Gives a short summary of an evaluation, and links to the + evaluation itself. + + Attributes: + operation (str): + The resource name of the Long Running + Operation for the evaluation. + evaluation (str): + The resource name of the evaluation. + aggregate_metrics (google.cloud.documentai_v1beta3.types.Evaluation.Metrics): + An aggregate of the statistics for the + evaluation with fuzzy matching on. + aggregate_metrics_exact (google.cloud.documentai_v1beta3.types.Evaluation.Metrics): + An aggregate of the statistics for the + evaluation with fuzzy matching off. + """ + + operation: str = proto.Field( + proto.STRING, + number=1, + ) + evaluation: str = proto.Field( + proto.STRING, + number=2, + ) + aggregate_metrics: "Evaluation.Metrics" = proto.Field( + proto.MESSAGE, + number=4, + message="Evaluation.Metrics", + ) + aggregate_metrics_exact: "Evaluation.Metrics" = proto.Field( + proto.MESSAGE, + number=5, + message="Evaluation.Metrics", + ) + + class Evaluation(proto.Message): r"""An evaluation of a ProcessorVersion's performance. diff --git a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/processor.py b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/processor.py index 0a4eb1f3a9fd..085ad488e84b 100644 --- a/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/processor.py +++ b/packages/google-cloud-documentai/google/cloud/documentai_v1beta3/types/processor.py @@ -19,6 +19,7 @@ import proto # type: ignore from google.cloud.documentai_v1beta3.types import document_schema as gcd_document_schema +from google.cloud.documentai_v1beta3.types import evaluation __protobuf__ = proto.module( package="google.cloud.documentai.v1beta3", @@ -50,6 +51,9 @@ class ProcessorVersion(proto.Message): The state of the processor version. create_time (google.protobuf.timestamp_pb2.Timestamp): The time the processor version was created. + latest_evaluation (google.cloud.documentai_v1beta3.types.EvaluationReference): + The most recently invoked evaluation for the + processor version. kms_key_name (str): The KMS key name used for encryption. kms_key_version_name (str): @@ -143,6 +147,11 @@ class DeprecationInfo(proto.Message): number=7, message=timestamp_pb2.Timestamp, ) + latest_evaluation: evaluation.EvaluationReference = proto.Field( + proto.MESSAGE, + number=8, + message=evaluation.EvaluationReference, + ) kms_key_name: str = proto.Field( proto.STRING, number=9, diff --git a/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json b/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json index 467d220129a0..0df77e659b71 100644 --- a/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json +++ b/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-documentai", - "version": "2.10.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json b/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json index 0092aeddb120..ef56bd7e3eb3 100644 --- a/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json +++ b/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-documentai", - "version": "2.10.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json b/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json index 1eec527bede2..f02752f11a81 100644 --- a/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json +++ b/packages/google-cloud-documentai/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-documentai", - "version": "2.10.0" + "version": "0.1.0" }, "snippets": [ {