From 9fd16ad8837e31c3b06475b195c70c45f6979f6c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 12:57:50 -0400 Subject: [PATCH] feat: [google-cloud-documentai] Make Layout Parser generally available in V1 (#12762) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 638924855 Source-Link: https://github.com/googleapis/googleapis/commit/0cea7170404bec3d994f43db4fa292f5034cbe9a Source-Link: https://github.com/googleapis/googleapis-gen/commit/ba9bd19a6787b6be1750b18157b30467a8ce6730 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRvY3VtZW50YWkvLk93bEJvdC55YW1sIiwiaCI6ImJhOWJkMTlhNjc4N2I2YmUxNzUwYjE4MTU3YjMwNDY3YThjZTY3MzAifQ== --------- Co-authored-by: Owl Bot --- .../types/document_processor_service.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_processor_service.py b/packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_processor_service.py index 4946d4528c0f..2d3886dfb4d4 100644 --- a/packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_processor_service.py +++ b/packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_processor_service.py @@ -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]. @@ -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. @@ -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,