Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [google-cloud-documentai] Make Layout Parser generally available in V1 #12762

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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 @@ -116,6 +116,9 @@ class ProcessOptions(proto.Message):
Only applicable to ``OCR_PROCESSOR`` and
``FORM_PARSER_PROCESSOR``. Returns error if set on other
processor types.
layout_config (google.cloud.documentai_v1.types.ProcessOptions.LayoutConfig):
Optional. Only applicable to ``LAYOUT_PARSER_PROCESSOR``.
Returns error if set on other processor types.
schema_override (google.cloud.documentai_v1.types.DocumentSchema):
Optional. Override the schema of the
[ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
Expand All @@ -125,6 +128,42 @@ class ProcessOptions(proto.Message):
doesn't support schema override.
"""

class LayoutConfig(proto.Message):
r"""Serving config for layout parser processor.

Attributes:
chunking_config (google.cloud.documentai_v1.types.ProcessOptions.LayoutConfig.ChunkingConfig):
Optional. Config for chunking in layout
parser processor.
"""

class ChunkingConfig(proto.Message):
r"""Serving config for chunking.

Attributes:
chunk_size (int):
Optional. The chunk sizes to use when
splitting documents, in order of level.
include_ancestor_headings (bool):
Optional. Whether or not to include ancestor
headings when splitting.
"""

chunk_size: int = proto.Field(
proto.INT32,
number=1,
)
include_ancestor_headings: bool = proto.Field(
proto.BOOL,
number=2,
)

chunking_config: "ProcessOptions.LayoutConfig.ChunkingConfig" = proto.Field(
proto.MESSAGE,
number=1,
message="ProcessOptions.LayoutConfig.ChunkingConfig",
)

class IndividualPageSelector(proto.Message):
r"""A list of individual page numbers.

Expand Down Expand Up @@ -160,6 +199,11 @@ class IndividualPageSelector(proto.Message):
number=1,
message=document_io.OcrConfig,
)
layout_config: LayoutConfig = proto.Field(
proto.MESSAGE,
number=9,
message=LayoutConfig,
)
schema_override: gcd_document_schema.DocumentSchema = proto.Field(
proto.MESSAGE,
number=8,
Expand Down
Loading