Ocr Result
Schema for OCR output results in Gen AI applications.
This module defines the structured output of an OCR operation, carrying both the raw extracted text and optional enriched fields populated by specialized OCR engines.
OcrResult
Bases: BaseModel
Structured result of an OCR operation.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
str
|
Full concatenated text extracted from the document. This value is mirrored in TextResult.result for API consistency. |
lines |
list[str]
|
Engine-native line units when available (e.g. from specialized OCR backends). LM-based implementations typically leave this empty. Defaults to an empty list. |
confidence |
float | None
|
Overall confidence score of the extraction, expressed as a value between 0.0 and 1.0. Only populated by specialized OCR engines; LM-based implementations leave this as None. Defaults to None. |
page_count |
int
|
Number of pages processed. Populated by engines that support multi-page documents (e.g., Azure Document Intelligence). Defaults to 1. |