Skip to content

Commit 6d0eeb7

Browse files
feat: [google-cloud-documentai] Added config options for derived fields and signature detection. Some annotation changes changes to mark fields explicitly output only (no changes in semantics just readability) (#14244)
- [ ] Regenerate this pull request now. docs: A comment for field `document_schema` in message `.google.cloud.documentai.v1.ProcessorVersion` is changed to describe as output only. docs: A comment for field `create_time` in message `.google.cloud.documentai.v1.ProcessorVersion` is changed to describe as output only. docs: A comment for field `latest_evaluation` in message `.google.cloud.documentai.v1.ProcessorVersion` is changed to describe as output only. docs: A comment for field `kms_key_name` in message `.google.cloud.documentai.v1.ProcessorVersion` is changed to describe as output only. docs: A comment for field `kms_key_version_name` in message `.google.cloud.documentai.v1.ProcessorVersion` is changed to describe as output only. docs: A comment for field `deprecation_info` in message `.google.cloud.documentai.v1.ProcessorVersion` is changed to describe as output only. docs: A comment for field `create_time` in message `.google.cloud.documentai.v1.Processor` is changed to describe as output only. PiperOrigin-RevId: 795630471 Source-Link: googleapis/googleapis@6429996 Source-Link: googleapis/googleapis-gen@b727e27 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRvY3VtZW50YWkvLk93bEJvdC55YW1sIiwiaCI6ImI3MjdlMjcxYzU1Yjk4NTkyN2EwYWM5NjQyZDljNTIwMzc2ZTBjZmYifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent cb29b46 commit 6d0eeb7

File tree

3 files changed

+75
-11
lines changed

3 files changed

+75
-11
lines changed

packages/google-cloud-documentai/google/cloud/documentai_v1/types/document.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,30 @@ class Entity(proto.Message):
12241224
redacted (bool):
12251225
Optional. Whether the entity will be redacted
12261226
for de-identification purposes.
1227+
method (google.cloud.documentai_v1.types.Document.Entity.Method):
1228+
Optional. Specifies how the entity's value is
1229+
obtained.
12271230
"""
12281231

1232+
class Method(proto.Enum):
1233+
r"""Specifies how the entity's value is obtained.
1234+
1235+
Values:
1236+
METHOD_UNSPECIFIED (0):
1237+
When the method is not specified, it should be treated as
1238+
``EXTRACT``.
1239+
EXTRACT (1):
1240+
The entity's value is directly extracted
1241+
as-is from the document text.
1242+
DERIVE (2):
1243+
The entity's value is derived through
1244+
inference and is not necessarily an exact text
1245+
extraction from the document.
1246+
"""
1247+
METHOD_UNSPECIFIED = 0
1248+
EXTRACT = 1
1249+
DERIVE = 2
1250+
12291251
class NormalizedValue(proto.Message):
12301252
r"""Parsed and normalized entity value.
12311253
@@ -1272,6 +1294,9 @@ class NormalizedValue(proto.Message):
12721294
float_value (float):
12731295
Float value.
12741296
1297+
This field is a member of `oneof`_ ``structured_value``.
1298+
signature_value (bool):
1299+
12751300
This field is a member of `oneof`_ ``structured_value``.
12761301
text (str):
12771302
Optional. An optional field to store a normalized string.
@@ -1330,6 +1355,11 @@ class NormalizedValue(proto.Message):
13301355
number=8,
13311356
oneof="structured_value",
13321357
)
1358+
signature_value: bool = proto.Field(
1359+
proto.BOOL,
1360+
number=10,
1361+
oneof="structured_value",
1362+
)
13331363
text: str = proto.Field(
13341364
proto.STRING,
13351365
number=1,
@@ -1384,6 +1414,11 @@ class NormalizedValue(proto.Message):
13841414
proto.BOOL,
13851415
number=12,
13861416
)
1417+
method: "Document.Entity.Method" = proto.Field(
1418+
proto.ENUM,
1419+
number=15,
1420+
enum="Document.Entity.Method",
1421+
)
13871422

13881423
class EntityRelation(proto.Message):
13891424
r"""Relationship between

packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_schema.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ class Property(proto.Message):
117117
Occurrence type limits the number of
118118
instances an entity type appears in the
119119
document.
120+
method (google.cloud.documentai_v1.types.DocumentSchema.EntityType.Property.Method):
121+
Specifies how the entity's value is obtained.
120122
"""
121123

122124
class OccurrenceType(proto.Enum):
@@ -154,6 +156,25 @@ class OccurrenceType(proto.Enum):
154156
REQUIRED_ONCE = 3
155157
REQUIRED_MULTIPLE = 4
156158

159+
class Method(proto.Enum):
160+
r"""Specifies how the entity's value is obtained from the
161+
document.
162+
163+
Values:
164+
METHOD_UNSPECIFIED (0):
165+
Unspecified method. It defaults to ``EXTRACT``.
166+
EXTRACT (1):
167+
The entity's value is directly extracted
168+
as-is from the document text.
169+
DERIVE (2):
170+
The entity's value is derived through
171+
inference and is not necessarily an exact text
172+
extraction from the document.
173+
"""
174+
METHOD_UNSPECIFIED = 0
175+
EXTRACT = 1
176+
DERIVE = 2
177+
157178
name: str = proto.Field(
158179
proto.STRING,
159180
number=1,
@@ -173,6 +194,11 @@ class OccurrenceType(proto.Enum):
173194
enum="DocumentSchema.EntityType.Property.OccurrenceType",
174195
)
175196
)
197+
method: "DocumentSchema.EntityType.Property.Method" = proto.Field(
198+
proto.ENUM,
199+
number=8,
200+
enum="DocumentSchema.EntityType.Property.Method",
201+
)
176202

177203
enum_values: "DocumentSchema.EntityType.EnumValues" = proto.Field(
178204
proto.MESSAGE,

packages/google-cloud-documentai/google/cloud/documentai_v1/types/processor.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,29 @@ class ProcessorVersion(proto.Message):
4848
display_name (str):
4949
The display name of the processor version.
5050
document_schema (google.cloud.documentai_v1.types.DocumentSchema):
51-
The schema of the processor version.
52-
Describes the output.
51+
Output only. The schema of the processor
52+
version. Describes the output.
5353
state (google.cloud.documentai_v1.types.ProcessorVersion.State):
5454
Output only. The state of the processor
5555
version.
5656
create_time (google.protobuf.timestamp_pb2.Timestamp):
57-
The time the processor version was created.
57+
Output only. The time the processor version
58+
was created.
5859
latest_evaluation (google.cloud.documentai_v1.types.EvaluationReference):
59-
The most recently invoked evaluation for the
60-
processor version.
60+
Output only. The most recently invoked
61+
evaluation for the processor version.
6162
kms_key_name (str):
62-
The KMS key name used for encryption.
63+
Output only. The KMS key name used for
64+
encryption.
6365
kms_key_version_name (str):
64-
The KMS key version with which data is
65-
encrypted.
66+
Output only. The KMS key version with which
67+
data is encrypted.
6668
google_managed (bool):
6769
Output only. Denotes that this ``ProcessorVersion`` is
6870
managed by Google.
6971
deprecation_info (google.cloud.documentai_v1.types.ProcessorVersion.DeprecationInfo):
70-
If set, information about the eventual
71-
deprecation of this version.
72+
Output only. If set, information about the
73+
eventual deprecation of this version.
7274
model_type (google.cloud.documentai_v1.types.ProcessorVersion.ModelType):
7375
Output only. The model type of this processor
7476
version.
@@ -367,7 +369,8 @@ class Processor(proto.Message):
367369
Output only. Immutable. The http endpoint
368370
that can be called to invoke processing.
369371
create_time (google.protobuf.timestamp_pb2.Timestamp):
370-
The time the processor was created.
372+
Output only. The time the processor was
373+
created.
371374
kms_key_name (str):
372375
The `KMS
373376
key <https://cloud.google.com/security-key-management>`__

0 commit comments

Comments
 (0)