OCR Config Object Structure
Overview
The ocr
object allows you to configure Optical Character Recognition (OCR) settings for the application, enabling the extraction of text from images. This section provides a detailed breakdown of the ocr
object structure.
There are 4 main fields under ocr
:
mistralModel
apiKey
baseURL
strategy
Notes:
- If using the Mistral OCR API, you don’t need to edit your
librechat.yaml
file.- You only need the following environment variables to get started:
OCR_API_KEY
andOCR_BASEURL
.
- You only need the following environment variables to get started:
- OCR functionality allows the application to extract text from images, which can then be processed by AI models.
- The default strategy is
mistral_ocr
, which uses Mistral’s OCR capabilities. - You can also configure a custom OCR service by setting the strategy to
custom_ocr
. - If using the default Mistral OCR, you may optionally specify a specific Mistral model to use.
- Environment variable parsing is supported for
apiKey
,baseURL
, andmistralModel
parameters. - A
user_provided
strategy option is planned for future releases but is not yet implemented.
Example
ocr
ocr:
mistralModel: "mistral-ocr-latest"
apiKey: "your-mistral-api-key"
strategy: "mistral_ocr"
Example with custom OCR:
ocr with custom OCR
ocr:
apiKey: "your-custom-ocr-api-key"
baseURL: "https://your-custom-ocr-service.com/api"
strategy: "custom_ocr"
mistralModel
Key | Type | Description | Example |
---|---|---|---|
mistralModel | String | The Mistral model to use for OCR processing. | Optional. Specifies which Mistral model should be used when the strategy is set to mistral_ocr. |
ocr / mistralModel
ocr:
mistralModel: "mistral-ocr-latest"
apiKey
Key | Type | Description | Example |
---|---|---|---|
apiKey | String | The API key for the OCR service. | Optional. Defaults to the environment variable OCR_API_KEY if not specified. |
ocr / apiKey
ocr:
apiKey: "your-ocr-api-key"
baseURL
Key | Type | Description | Example |
---|---|---|---|
baseURL | String | The base URL for the OCR service API. | Optional. Defaults to the environment variable OCR_BASEURL if not specified. |
ocr / baseURL
ocr:
baseURL: "https://your-ocr-service.com/api"
strategy
Key | Type | Description | Example |
---|---|---|---|
strategy | String | The OCR strategy to use. | Determines which OCR service to use. Options are "mistral_ocr" or "custom_ocr". Defaults to "mistral_ocr". |
ocr / strategy
ocr:
strategy: "custom_ocr"
Available Strategies:
mistral_ocr
: Uses Mistral’s OCR capabilities.custom_ocr
: Uses a custom OCR service specified by the baseURL.