Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

fix: mark Document.Entity.type as REQUIRED in all versions #317

Merged
merged 4 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ async def process_document(

from google.cloud import documentai_v1

def sample_process_document():
async def sample_process_document():
# Create a client
client = documentai_v1.DocumentProcessorServiceClient()
client = documentai_v1.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
inline_document = documentai_v1.Document()
Expand All @@ -252,7 +252,7 @@ def sample_process_document():
)

# Make the request
response = client.process_document(request=request)
response = await client.process_document(request=request)

# Handle the response
print(response)
Expand Down Expand Up @@ -348,9 +348,9 @@ async def batch_process_documents(

from google.cloud import documentai_v1

def sample_batch_process_documents():
async def sample_batch_process_documents():
# Create a client
client = documentai_v1.DocumentProcessorServiceClient()
client = documentai_v1.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1.BatchProcessRequest(
Expand All @@ -362,7 +362,7 @@ def sample_batch_process_documents():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -469,9 +469,9 @@ async def review_document(

from google.cloud import documentai_v1

def sample_review_document():
async def sample_review_document():
# Create a client
client = documentai_v1.DocumentProcessorServiceClient()
client = documentai_v1.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
inline_document = documentai_v1.Document()
Expand All @@ -487,7 +487,7 @@ def sample_review_document():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/documentai_v1/types/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ class Entity(proto.Message):
into the
[Document.text][google.cloud.documentai.v1.Document.text].
type_ (str):
Entity type from a schema e.g. ``Address``.
Required. Entity type from a schema e.g. ``Address``.
mention_text (str):
Optional. Text value in the document e.g.
``1600 Amphitheatre Pkwy``. If the entity is not present in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ async def batch_process_documents(

from google.cloud import documentai_v1beta2

def sample_batch_process_documents():
async def sample_batch_process_documents():
# Create a client
client = documentai_v1beta2.DocumentUnderstandingServiceClient()
client = documentai_v1beta2.DocumentUnderstandingServiceAsyncClient()

# Initialize request argument(s)
requests = documentai_v1beta2.ProcessDocumentRequest()
Expand All @@ -250,7 +250,7 @@ def sample_batch_process_documents():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -355,9 +355,9 @@ async def process_document(

from google.cloud import documentai_v1beta2

def sample_process_document():
async def sample_process_document():
# Create a client
client = documentai_v1beta2.DocumentUnderstandingServiceClient()
client = documentai_v1beta2.DocumentUnderstandingServiceAsyncClient()

# Initialize request argument(s)
input_config = documentai_v1beta2.InputConfig()
Expand All @@ -369,7 +369,7 @@ def sample_process_document():
)

# Make the request
response = client.process_document(request=request)
response = await client.process_document(request=request)

# Handle the response
print(response)
Expand Down
12 changes: 1 addition & 11 deletions google/cloud/documentai_v1beta2/types/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ class Entity(proto.Message):
Provenance of the entity. Text anchor indexing into the
[Document.text][google.cloud.documentai.v1beta2.Document.text].
type_ (str):
Entity type from a schema e.g. ``Address``.
Required. Entity type from a schema e.g. ``Address``.
mention_text (str):
Text value in the document e.g. ``1600 Amphitheatre Pkwy``.
mention_id (str):
Expand All @@ -788,11 +788,6 @@ class Entity(proto.Message):
id (str):
Optional. Canonical id. This will be a unique
value in the entity list for this document.
bounding_poly_for_demo_frontend (google.cloud.documentai_v1beta2.types.BoundingPoly):
Optional. Temporary field to store the
bounding poly for short-term POCs. Used by the
frontend only. Do not use before you talk to
ybo@ and lukasr@.
"""

text_anchor = proto.Field(
Expand Down Expand Up @@ -825,11 +820,6 @@ class Entity(proto.Message):
proto.STRING,
number=7,
)
bounding_poly_for_demo_frontend = proto.Field(
proto.MESSAGE,
number=8,
message=geometry.BoundingPoly,
)

class EntityRelation(proto.Message):
r"""Relationship between
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ async def process_document(

from google.cloud import documentai_v1beta3

def sample_process_document():
async def sample_process_document():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
inline_document = documentai_v1beta3.Document()
Expand All @@ -264,7 +264,7 @@ def sample_process_document():
)

# Make the request
response = client.process_document(request=request)
response = await client.process_document(request=request)

# Handle the response
print(response)
Expand Down Expand Up @@ -360,9 +360,9 @@ async def batch_process_documents(

from google.cloud import documentai_v1beta3

def sample_batch_process_documents():
async def sample_batch_process_documents():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.BatchProcessRequest(
Expand All @@ -374,7 +374,7 @@ def sample_batch_process_documents():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -482,17 +482,17 @@ async def fetch_processor_types(

from google.cloud import documentai_v1beta3

def sample_fetch_processor_types():
async def sample_fetch_processor_types():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.FetchProcessorTypesRequest(
parent="parent_value",
)

# Make the request
response = client.fetch_processor_types(request=request)
response = await client.fetch_processor_types(request=request)

# Handle the response
print(response)
Expand Down Expand Up @@ -578,9 +578,9 @@ async def list_processors(

from google.cloud import documentai_v1beta3

def sample_list_processors():
async def sample_list_processors():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.ListProcessorsRequest(
Expand All @@ -591,7 +591,7 @@ def sample_list_processors():
page_result = client.list_processors(request=request)

# Handle the response
for response in page_result:
async for response in page_result:
print(response)

Args:
Expand Down Expand Up @@ -690,17 +690,17 @@ async def create_processor(

from google.cloud import documentai_v1beta3

def sample_create_processor():
async def sample_create_processor():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.CreateProcessorRequest(
parent="parent_value",
)

# Make the request
response = client.create_processor(request=request)
response = await client.create_processor(request=request)

# Handle the response
print(response)
Expand Down Expand Up @@ -803,9 +803,9 @@ async def delete_processor(

from google.cloud import documentai_v1beta3

def sample_delete_processor():
async def sample_delete_processor():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.DeleteProcessorRequest(
Expand All @@ -817,7 +817,7 @@ def sample_delete_processor():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -922,9 +922,9 @@ async def enable_processor(

from google.cloud import documentai_v1beta3

def sample_enable_processor():
async def sample_enable_processor():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.EnableProcessorRequest(
Expand All @@ -936,7 +936,7 @@ def sample_enable_processor():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -1010,9 +1010,9 @@ async def disable_processor(

from google.cloud import documentai_v1beta3

def sample_disable_processor():
async def sample_disable_processor():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
request = documentai_v1beta3.DisableProcessorRequest(
Expand All @@ -1024,7 +1024,7 @@ def sample_disable_processor():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down Expand Up @@ -1100,9 +1100,9 @@ async def review_document(

from google.cloud import documentai_v1beta3

def sample_review_document():
async def sample_review_document():
# Create a client
client = documentai_v1beta3.DocumentProcessorServiceClient()
client = documentai_v1beta3.DocumentProcessorServiceAsyncClient()

# Initialize request argument(s)
inline_document = documentai_v1beta3.Document()
Expand All @@ -1118,7 +1118,7 @@ def sample_review_document():

print("Waiting for operation to complete...")

response = operation.result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/documentai_v1beta3/types/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ class Entity(proto.Message):
into the
[Document.text][google.cloud.documentai.v1beta3.Document.text].
type_ (str):
Entity type from a schema e.g. ``Address``.
Required. Entity type from a schema e.g. ``Address``.
mention_text (str):
Optional. Text value in the document e.g.
``1600 Amphitheatre Pkwy``. If the entity is not present in
Expand Down
Loading