Response models¶
All response objects are immutable pydantic v2 models with
extra="allow" — additive server changes survive a SDK version skew by
landing on .model_extra instead of failing parse.
OcrResponse¶
Returned by recognize_image() and recognize_pixels().
OcrResponse
¶
Bases: _Frozen
Single-image OCR result returned by recognize_image / recognize_pixels.
| ATTRIBUTE | DESCRIPTION |
|---|---|
results |
Token-level text items in detection order. Always populated.
TYPE:
|
layout |
Region boxes (titles, paragraphs, tables, figures, …).
Populated only when the call was made with
TYPE:
|
reading_order |
Indices into
TYPE:
|
blocks |
Paragraph-level groupings with their own reading order.
Populated only when
TYPE:
|
text |
Cached property — the full text joined in reading order
(blocks > reading_order > raw
TYPE:
|
tables |
Computed view of
TYPE:
|
formulas |
Computed view of
TYPE:
|
reading_order
class-attribute
instance-attribute
¶
PdfResponse¶
Returned by recognize_pdf().
PdfResponse
¶
Bases: _Frozen
Multi-page PDF OCR result returned by recognize_pdf.
| ATTRIBUTE | DESCRIPTION |
|---|---|
pages |
One
TYPE:
|
text |
Cached property — full document text joined across pages with blank-line separators.
TYPE:
|
tables |
Flattened view of
TYPE:
|
formulas |
Flattened view of
TYPE:
|
PdfPage
¶
Bases: _Frozen
| ATTRIBUTE | DESCRIPTION |
|---|---|
page |
TYPE:
|
page_index |
TYPE:
|
dpi |
TYPE:
|
width |
TYPE:
|
height |
TYPE:
|
results |
TYPE:
|
layout |
TYPE:
|
reading_order |
TYPE:
|
blocks |
TYPE:
|
tables |
TYPE:
|
formulas |
TYPE:
|
mode |
TYPE:
|
text_layer_quality |
TYPE:
|
orientation_deg |
TYPE:
|
image_b64 |
TYPE:
|
image_content_type |
TYPE:
|
text_degraded |
TYPE:
|
table_degraded |
TYPE:
|
formula_degraded |
TYPE:
|
text_warning |
TYPE:
|
table_warning |
TYPE:
|
formula_warning |
TYPE:
|
image_bytes |
Decoded page image when the request used
TYPE:
|
PdfMode
¶
Bases: StrEnum
| ATTRIBUTE | DESCRIPTION |
|---|---|
ocr |
|
auto |
|
auto_verified |
|
geometric |
|
BatchResponse¶
Returned by recognize_batch(). Per-slot failures are surfaced via
iter_results() — use it to walk results without manually zipping
batch_results and errors.
BatchResponse
¶
Bases: _Frozen
Multi-image OCR result returned by recognize_batch.
batch_results and errors are parallel lists of equal length:
slot i is either a valid OcrResponse with
errors[i] is None, or a failure where errors[i] carries the
server's error message and batch_results[i] is an empty placeholder
OcrResponse(results=[]). Per-slot failures never raise — they land
in errors so one bad input cannot fail the whole batch.
Prefer iter_results for a
tagged-union iteration instead of zipping the two lists manually.
| ATTRIBUTE | DESCRIPTION |
|---|---|
batch_results |
One
TYPE:
|
errors |
Parallel
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
iter_results |
Pair |
iter_results
¶
iter_results() -> list[BatchResult]
Pair batch_results and errors into a tagged-union list.
Pythonic iteration; saves users from zipping two parallel lists.
BatchSuccess
¶
BatchFailure
¶
HealthStatus¶
HealthStatus
¶
Bases: _Frozen
| ATTRIBUTE | DESCRIPTION |
|---|---|
ok |
TYPE:
|
status_code |
TYPE:
|
body |
TYPE:
|
body_json |
TYPE:
|
Capabilities¶
Capabilities
¶
Bases: _Frozen
GET /capabilities — what the running server actually loaded.
Check features.tables / features.formulas before sending
tables=True / formulas=True: those are strict opt-ins and return
400 TABLE_BACKEND_DISABLED / FORMULA_BACKEND_DISABLED when the
backend was not configured at server startup.
| ATTRIBUTE | DESCRIPTION |
|---|---|
build |
TYPE:
|
features |
TYPE:
|
pdf |
TYPE:
|
limits |
TYPE:
|
endpoints |
TYPE:
|
features
class-attribute
instance-attribute
¶
features: CapabilityFeatures = Field(default_factory=CapabilityFeatures)
limits
class-attribute
instance-attribute
¶
limits: CapabilityLimits = Field(default_factory=CapabilityLimits)
CapabilityFeatures
¶
Bases: _Frozen
| ATTRIBUTE | DESCRIPTION |
|---|---|
layout |
TYPE:
|
tables |
TYPE:
|
formulas |
TYPE:
|
autorotate |
TYPE:
|
CapabilityPdf
¶
Bases: _Frozen
| ATTRIBUTE | DESCRIPTION |
|---|---|
modes |
TYPE:
|
default_dpi |
TYPE:
|
max_pages |
TYPE:
|
CapabilityLimits
¶
Bases: _Frozen
| ATTRIBUTE | DESCRIPTION |
|---|---|
max_body_mb |
TYPE:
|
max_image_dim |
TYPE:
|
max_batch_images |
TYPE:
|
Server-side Markdown¶
MarkdownPagesResponse
¶
Bases: _Frozen
| ATTRIBUTE | DESCRIPTION |
|---|---|
pages |
TYPE:
|
markdown |
All pages joined in order, separated by blank lines.
TYPE:
|
MarkdownPage
¶
Bases: _Frozen
One page of a server-side PDF → Markdown conversion (as_pages=True).
| ATTRIBUTE | DESCRIPTION |
|---|---|
page_index |
TYPE:
|
markdown |
TYPE:
|
text_degraded |
TYPE:
|
table_degraded |
TYPE:
|
formula_degraded |
TYPE:
|
Streaming¶
StreamEvent
¶
Bases: _Frozen
One NDJSON line from POST /ocr/stream.
event is one of "meta", "page", "page_error", "error",
"end". Page events arrive as each page completes — out of order by
design; use page.page_index to reorder client-side if needed.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event |
TYPE:
|
kind |
TYPE:
|
pages |
TYPE:
|
dpi |
TYPE:
|
mode |
TYPE:
|
page_index |
TYPE:
|
code |
TYPE:
|
failed |
TYPE:
|
page |
The parsed page for
TYPE:
|