Skip to content
Open
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
@@ -1,4 +1,4 @@
// Copyright 2025 Google LLC
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@ syntax = "proto3";
package google.cloud.documentai.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/documentai/v1/barcode.proto";
import "google/cloud/documentai/v1/geometry.proto";
import "google/protobuf/timestamp.proto";
Expand Down Expand Up @@ -180,9 +181,9 @@ message Document {

// Confidence of the current
// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
// context of the object this layout is for. e.g. confidence can be for a
// single token, a table, a visual element, etc. depending on context.
// Range `[0, 1]`.
// context of the object this layout is for. For example, confidence can
// be for a single token, a table, a visual element, etc. depending on
// context. Range `[0, 1]`.
float confidence = 2;

// The bounding polygon for the
Expand Down Expand Up @@ -340,8 +341,8 @@ message Document {
repeated DetectedLanguage detected_languages = 2;
}

// Detected non-text visual elements e.g. checkbox, signature etc. on the
// page.
// Detected non-text visual elements, for example, checkbox, signature etc.
// on the page.
message VisualElement {
// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
Expand Down Expand Up @@ -400,7 +401,7 @@ message Document {
message FormField {
// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
// e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc.
// For example, `Address`, `Email`, `Grand total`, `Phone number`, etc.
Layout field_name = 1;

// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
Expand Down Expand Up @@ -526,7 +527,7 @@ message Document {
// A list of visually detected tokens on the page.
repeated Token tokens = 8;

// A list of detected non-text visual elements e.g. checkbox,
// A list of detected non-text visual elements, for example, checkbox,
// signature etc. on the page.
repeated VisualElement visual_elements = 9;

Expand Down Expand Up @@ -586,6 +587,8 @@ message Document {
// Float value.
float float_value = 8;

// A signature - a graphical representation of a person's name,
// often used to sign a document.
bool signature_value = 10;
}

Expand Down Expand Up @@ -622,10 +625,11 @@ message Document {
// [Document.text][google.cloud.documentai.v1.Document.text].
TextAnchor text_anchor = 1 [(google.api.field_behavior) = OPTIONAL];

// Required. Entity type from a schema e.g. `Address`.
// Required. Entity type from a schema, for example, `Address`.
string type = 2 [(google.api.field_behavior) = REQUIRED];

// Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`.
// Optional. Text value of the entity, for example, `1600 Amphitheatre
// Pkwy`.
string mention_text = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. Deprecated. Use `id` field instead.
Expand All @@ -643,9 +647,9 @@ message Document {
string id = 7 [(google.api.field_behavior) = OPTIONAL];

// Optional. Normalized entity value. Absent if the extracted value could
// not be converted or the type (e.g. address) is not supported for certain
// parsers. This field is also only populated for certain supported document
// types.
// not be converted or the type (for example, address) is not supported for
// certain parsers. This field is also only populated for certain supported
// document types.
NormalizedValue normalized_value = 9
[(google.api.field_behavior) = OPTIONAL];

Expand Down Expand Up @@ -854,7 +858,7 @@ message Document {
message Revision {
// Human Review information of the document.
message HumanReview {
// Human review state. e.g. `requested`, `succeeded`, `rejected`.
// Human review state. For example, `requested`, `succeeded`, `rejected`.
string state = 1;

// A message providing more details about the current state of processing.
Expand Down Expand Up @@ -912,6 +916,12 @@ message Document {
repeated Provenance provenance = 3 [deprecated = true];
}

// Represents the annotation of a block or a chunk.
message Annotations {
// The description of the content with this annotation.
string description = 1;
}

// Represents the parsed layout of a document as a collection of blocks that
// the document is divided into.
message DocumentLayout {
Expand Down Expand Up @@ -940,6 +950,9 @@ message Document {
// A text block could further have child blocks.
// Repeated blocks support further hierarchies and nested blocks.
repeated DocumentLayoutBlock blocks = 3;

// Annotation of the text block.
Annotations annotations = 4;
}

// Represents a table type block.
Expand All @@ -952,6 +965,9 @@ message Document {

// Table caption/title.
string caption = 3;

// Annotation of the table block.
Annotations annotations = 4;
}

// Represents a row in a table.
Expand Down Expand Up @@ -990,6 +1006,37 @@ message Document {
repeated DocumentLayoutBlock blocks = 1;
}

// Represents an image type block.
message LayoutImageBlock {
// Source of the image.
oneof image_source {
// Optional. Asset id of the inline image. If set, find the image
// content in the blob_assets field.
string blob_asset_id = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. Google Cloud Storage uri of the image.
string gcs_uri = 5 [(google.api.field_behavior) = OPTIONAL];

// Optional. Data uri of the image.
// It is composed of four parts: a prefix (data:), a MIME type
// indicating the type of data, an optional base64 token if
// non-textual, and the data itself:
// data:[<mediatype>][;base64],<data>
string data_uri = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Mime type of the image. An IANA published [media type (MIME type)]
// (https://www.iana.org/assignments/media-types/media-types.xhtml).
string mime_type = 1;

// Text extracted from the image using OCR or alt text describing the
// image.
string image_text = 2;

// Annotation of the image block.
Annotations annotations = 3;
}

oneof block {
// Block consisting of text content.
LayoutTextBlock text_block = 2;
Expand All @@ -999,6 +1046,9 @@ message Document {

// Block consisting of list content/structure.
LayoutListBlock list_block = 4;

// Block consisting of image content.
LayoutImageBlock image_block = 7;
}

// ID of the block.
Expand Down Expand Up @@ -1046,6 +1096,48 @@ message Document {
ChunkPageSpan page_span = 2;
}

// The image chunk field in the chunk.
message ImageChunkField {
// Source of the image.
oneof image_source {
// Optional. Asset id of the inline image. If set, find the image
// content in the blob_assets field.
string blob_asset_id = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. Google Cloud Storage uri of the image.
string gcs_uri = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Data uri of the image.
// It is composed of four parts: a prefix (data:), a MIME type
// indicating the type of data, an optional base64 token if
// non-textual, and the data itself:
// data:[<mediatype>][;base64],<data>
string data_uri = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Annotation of the image chunk field.
Annotations annotations = 4;
}

// The table chunk field in the chunk.
message TableChunkField {
// Annotation of the table chunk field.
Annotations annotations = 1;
}

// The chunk field in the chunk. A chunk field could be one of the various
// types (for example, image, table) supported.
message ChunkField {
// The type of the chunk field.
oneof field_type {
// The image chunk field in the chunk.
ImageChunkField image_chunk_field = 1;

// The table chunk field in the chunk.
TableChunkField table_chunk_field = 2;
}
}

// ID of the chunk.
string chunk_id = 1;

Expand All @@ -1063,12 +1155,31 @@ message Document {

// Page footers associated with the chunk.
repeated ChunkPageFooter page_footers = 6;

// Chunk fields inside this chunk.
repeated ChunkField chunk_fields = 7;
}

// List of chunks.
repeated Chunk chunks = 1;
}

// Represents a blob asset. It's used to store the content of the inline blob
// in this document, for example, image bytes, such that it can be referenced
// by other fields in the document via asset ID.
message BlobAsset {
// Optional. The id of the blob asset.
string asset_id = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. The content of the blob asset, for example, image bytes.
bytes content = 2 [(google.api.field_behavior) = OPTIONAL];

// The mime type of the blob asset.
// An IANA published [media type (MIME
// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
string mime_type = 3;
}

// The output of the validation given the document and the validation rules.
message EntityValidationOutput {
// Validation result for a single validation rule.
Expand Down Expand Up @@ -1186,6 +1297,12 @@ message Document {
// Document chunked based on chunking config.
ChunkedDocument chunked_document = 18;

// Optional. The blob assets in this document. This is used to store the
// content of the inline blobs in this document, for example, image bytes,
// such that it can be referenced by other fields in the document via asset
// id.
repeated BlobAsset blob_assets = 19 [(google.api.field_behavior) = OPTIONAL];

// The entity validation output for the document. This is the validation
// output for `document.entities` field.
EntityValidationOutput entity_validation_output = 21;
Expand All @@ -1198,7 +1315,7 @@ message Document {
// The entity revision ID that `document.entities` field is based on.
// If this field is set and `entities_revisions` is not empty, the entities in
// `document.entities` field are the entities in the entity revision with this
// ID and `document.entity_validation_output` field is the
// id and `document.entity_validation_output` field is the
// `entity_validation_output` field in this entity revision.
string entities_revision_id = 23;
}
Loading
Loading