Skip to content

Files

Latest commit

 

History

History
59 lines (40 loc) · 5.27 KB

README.md

File metadata and controls

59 lines (40 loc) · 5.27 KB

Ocr

(ocr)

Overview

OCR API

Available Operations

process

OCR

Example Usage

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)

Parameters

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.

Response

models.OCRResponse

Errors

Error Type Status Code Content Type
models.HTTPValidationError 422 application/json
models.SDKError 4XX, 5XX */*