Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
Target branch: Verify that the pull request targets the dev branch. Not targeting the dev branch may lead to immediate closure of the PR.
Description: Provide a concise description of the changes made in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: If necessary, update relevant documentation Open WebUI Docs like environment variables, the tutorials, or other documentation sources.
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Testing: Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description.
Agentic AI Code:: Confirm this Pull Request is not written by any AI Agent or has at least gone through additional human review and manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
Title Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
BREAKING CHANGE: Significant changes that may affect compatibility
build: Changes that affect the build system or external dependencies
ci: Changes to our continuous integration processes or workflows
chore: Refactor, cleanup, or other non-functional code changes
docs: Documentation update or addition
feat: Introduces a new feature or enhancement to the codebase
fix: Bug fix or error correction
i18n: Internationalization or localization changes
perf: Performance improvement
refactor: Code restructuring for better maintainability, readability, or scalability
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
test: Adding missing tests or correcting existing tests
WIP: Work in progress, a temporary label for incomplete or ongoing work
Changelog Entry
Description
Updated the Mistral OCR loader to allow for defining additional endpoints and models, and to support two different methods (upload/base64) to use with the API.
Previously, defining different endpoints was not possible. However, given that the Mistral OCR API can be used with LiteLLM or in Azure AI Foundry, it was necessary to enhance the Mistral loader to use diverse endpoints and model names.
LiteLLM and Azure AI Foundry do not support document upload with a signed URL; they only permit sending PDFs as base64 encoded strings. The official Mistral OCR API supports both methods. The upload method is faster for larger files. Consequently, I have provided the option in the UI, allowing users to choose between the two methods based on endpoint support.
Added
Environment variables for Mistral OCR configuration:
MISTRAL_OCR_ENDPOINT: Custom endpoint support
MISTRAL_OCR_MODEL: Model name configuration
MISTRAL_OCR_USE_BASE64: Method selection flag
UI fields in Documents.svelte for endpoint, model, and upload method configuration
Changed
backend/open_webui:
config.py and main.py: Added environment variable handling
retrieval/loaders/main.py: Updated Mistral loader constructor with new parameters
retrieval/loaders/mistral.py: Implemented base64 encoding support for API compatibility
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/18872
**Author:** [@paddy313](https://github.com/paddy313)
**Created:** 11/2/2025
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `feature/mistral_ocr`
---
### 📝 Commits (10+)
- [`671bb06`](https://github.com/open-webui/open-webui/commit/671bb061c6eae074fb324cb7d10ceacc76f81c7a) feat: Add Mistral OCR configuration options and update UI for endpoint and model
- [`34372fd`](https://github.com/open-webui/open-webui/commit/34372fd50fb480eb347a3846874890b30fb985a5) feat: Add MISTRAL_OCR_USE_BASE64 configuration option
- [`538d00a`](https://github.com/open-webui/open-webui/commit/538d00aca5c6506d7aab0c57f72a317a60776af3) feat: Add validation option for MistralLoader to control API limits checking
- [`07ccff4`](https://github.com/open-webui/open-webui/commit/07ccff4477a5b3dea7fa789afb9e150adf574d46) fix: Disable debug logging in MistralLoader for cleaner output
- [`8fcf438`](https://github.com/open-webui/open-webui/commit/8fcf438655a9caed985811670bed759ec8001804) refactor: Remove Mistral API limits validation from MistralLoader
- [`cab3dad`](https://github.com/open-webui/open-webui/commit/cab3dadb68570da01e32a399839c6da1fa1fcc6d) feat: Add Mistral OCR configuration options and update UI for endpoint and model
- [`48fd1ad`](https://github.com/open-webui/open-webui/commit/48fd1ad42723e6b38f5ef5e34e2abc55d02c105e) feat: Add MISTRAL_OCR_USE_BASE64 configuration option
- [`1fb6770`](https://github.com/open-webui/open-webui/commit/1fb677092d55e9b2f9ba2445fd20474ef772e611) feat: Add validation option for MistralLoader to control API limits checking
- [`15cf676`](https://github.com/open-webui/open-webui/commit/15cf6762798da0ec3cedff69c03f03844e4f4fef) fix: Disable debug logging in MistralLoader for cleaner output
- [`e6ca93c`](https://github.com/open-webui/open-webui/commit/e6ca93ce9a53ac4e4bde423cbb1dd4464adfe1d9) refactor: Remove Mistral API limits validation from MistralLoader
### 📊 Changes
**7 files changed** (+704 additions, -154 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/config.py` (+18 -0)
📝 `backend/open_webui/main.py` (+6 -0)
📝 `backend/open_webui/retrieval/loaders/main.py` (+8 -1)
📝 `backend/open_webui/retrieval/loaders/mistral.py` (+590 -149)
📝 `backend/open_webui/routers/retrieval.py` (+27 -0)
📝 `backend/open_webui/utils/middleware.py` (+1 -3)
📝 `src/lib/components/admin/Settings/Documents.svelte` (+54 -1)
</details>
### 📄 Description
# Pull Request Checklist
### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request.
**Before submitting, make sure you've checked the following:**
- [x] **Target branch:** Verify that the pull request targets the `dev` branch. Not targeting the `dev` branch may lead to immediate closure of the PR.
- [x] **Description:** Provide a concise description of the changes made in this pull request.
- [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [ ] **Documentation:** If necessary, update relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs) like environment variables, the tutorials, or other documentation sources.
- [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
- [ ] **Testing:** Perform manual tests to verify the implemented fix/feature works as intended AND does not break any other functionality. Take this as an opportunity to make screenshots of the feature/fix and include it in the PR description.
- [x] **Agentic AI Code:**: Confirm this Pull Request is **not written by any AI Agent** or has at least gone through additional human review **and** manual testing. If any AI Agent is the co-author of this PR, it may lead to immediate closure of the PR.
- [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
- [x] **Title Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following:
- **BREAKING CHANGE**: Significant changes that may affect compatibility
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our continuous integration processes or workflows
- **chore**: Refactor, cleanup, or other non-functional code changes
- **docs**: Documentation update or addition
- **feat**: Introduces a new feature or enhancement to the codebase
- **fix**: Bug fix or error correction
- **i18n**: Internationalization or localization changes
- **perf**: Performance improvement
- **refactor**: Code restructuring for better maintainability, readability, or scalability
- **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
- **test**: Adding missing tests or correcting existing tests
- **WIP**: Work in progress, a temporary label for incomplete or ongoing work
# Changelog Entry
### Description
Updated the Mistral OCR loader to allow for defining additional endpoints and models, and to support two different methods (upload/base64) to use with the API.
Previously, defining different endpoints was not possible. However, given that the Mistral OCR API can be used with LiteLLM or in Azure AI Foundry, it was necessary to enhance the Mistral loader to use diverse endpoints and model names.
LiteLLM and Azure AI Foundry do not support document upload with a signed URL; they only permit sending PDFs as base64 encoded strings. The official Mistral OCR API supports both methods. The upload method is faster for larger files. Consequently, I have provided the option in the UI, allowing users to choose between the two methods based on endpoint support.
### Added
- Environment variables for Mistral OCR configuration:
- `MISTRAL_OCR_ENDPOINT`: Custom endpoint support
- `MISTRAL_OCR_MODEL`: Model name configuration
- `MISTRAL_OCR_USE_BASE64`: Method selection flag
- UI fields in Documents.svelte for endpoint, model, and upload method configuration
### Changed
- **backend/open_webui:**
- `config.py` and `main.py`: Added environment variable handling
- `retrieval/loaders/main.py`: Updated Mistral loader constructor with new parameters
- `retrieval/loaders/mistral.py`: Implemented base64 encoding support for API compatibility
- `routers/retrieval.py`: Added configuration variable management
- **Frontend:**
- `Documents.svelte`: Added input fields for endpoint and model selection
### Fixed
- Mistral OCR loader compatibility with LiteLLM and Azure AI Foundry platforms
---
### Additional Information
- Related discussion: #14200
- I am going to open a PR for the documentation.
### Screenshots or Videos
<img width="746" height="376" alt="image" src="https://github.com/user-attachments/assets/1273622d-9407-4794-a95f-56e40d8eadcc" />
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/18872
Author: @paddy313
Created: 11/2/2025
Status: ❌ Closed
Base:
dev← Head:feature/mistral_ocr📝 Commits (10+)
671bb06feat: Add Mistral OCR configuration options and update UI for endpoint and model34372fdfeat: Add MISTRAL_OCR_USE_BASE64 configuration option538d00afeat: Add validation option for MistralLoader to control API limits checking07ccff4fix: Disable debug logging in MistralLoader for cleaner output8fcf438refactor: Remove Mistral API limits validation from MistralLoadercab3dadfeat: Add Mistral OCR configuration options and update UI for endpoint and model48fd1adfeat: Add MISTRAL_OCR_USE_BASE64 configuration option1fb6770feat: Add validation option for MistralLoader to control API limits checking15cf676fix: Disable debug logging in MistralLoader for cleaner outpute6ca93crefactor: Remove Mistral API limits validation from MistralLoader📊 Changes
7 files changed (+704 additions, -154 deletions)
View changed files
📝
backend/open_webui/config.py(+18 -0)📝
backend/open_webui/main.py(+6 -0)📝
backend/open_webui/retrieval/loaders/main.py(+8 -1)📝
backend/open_webui/retrieval/loaders/mistral.py(+590 -149)📝
backend/open_webui/routers/retrieval.py(+27 -0)📝
backend/open_webui/utils/middleware.py(+1 -3)📝
src/lib/components/admin/Settings/Documents.svelte(+54 -1)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch may lead to immediate closure of the PR.Changelog Entry
Description
Updated the Mistral OCR loader to allow for defining additional endpoints and models, and to support two different methods (upload/base64) to use with the API.
Previously, defining different endpoints was not possible. However, given that the Mistral OCR API can be used with LiteLLM or in Azure AI Foundry, it was necessary to enhance the Mistral loader to use diverse endpoints and model names.
LiteLLM and Azure AI Foundry do not support document upload with a signed URL; they only permit sending PDFs as base64 encoded strings. The official Mistral OCR API supports both methods. The upload method is faster for larger files. Consequently, I have provided the option in the UI, allowing users to choose between the two methods based on endpoint support.
Added
MISTRAL_OCR_ENDPOINT: Custom endpoint supportMISTRAL_OCR_MODEL: Model name configurationMISTRAL_OCR_USE_BASE64: Method selection flagChanged
config.pyandmain.py: Added environment variable handlingretrieval/loaders/main.py: Updated Mistral loader constructor with new parametersretrieval/loaders/mistral.py: Implemented base64 encoding support for API compatibilityrouters/retrieval.py: Added configuration variable managementDocuments.svelte: Added input fields for endpoint and model selectionFixed
Additional Information
Screenshots or Videos
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.