(ocr)
OCR API
- process - OCR
OCR
from mistralai import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.ocr.process(model="Focus", document={
"document_url": "https://dutiful-horst.org",
"type": "document_url",
})
# Handle response
print(res)
Parameter | Type | Required | Description |
---|---|---|---|
model |
Nullable[str] | ✔️ | N/A |
document |
models.Document | ✔️ | Document to run OCR on |
id |
Optional[str] | ➖ | N/A |
pages |
List[int] | ➖ | Specific pages user wants to process in various formats: single number, range, or list of both. Starts from 0 |
include_image_base64 |
OptionalNullable[bool] | ➖ | Include image URLs in response |
image_limit |
OptionalNullable[int] | ➖ | Max images to extract |
image_min_size |
OptionalNullable[int] | ➖ | Minimum height and width of image to extract |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.HTTPValidationError | 422 | application/json |
models.SDKError | 4XX, 5XX | */* |