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:
|
mode |
TYPE:
|
text_layer_quality |
TYPE:
|
tables |
TYPE:
|
formulas |
TYPE:
|
reading_order
class-attribute
instance-attribute
¶
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:
|