Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ repos:
types_or: [python, pyi]
- id: mypy
name: mypy
entry: mypy
entry: mypy src tests
language: system
pass_filenames: false
types: [python]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ To add support for filetypes other than PDF, use the `pandoc` extra:
pip install raglite[pandoc]
```

To add support for high-quality document processing with [Mistral OCR](https://docs.mistral.ai/capabilities/document/), use the `mistral-ocr` extra:
To add support for high-quality document processing with [Mistral OCR](https://docs.mistral.ai/capabilities/document/), install `mistralai`:

```sh
pip install raglite[mistral-ocr]
pip install mistralai
```

To add support for evaluation, use the `ragas` extra:
Expand Down Expand Up @@ -160,7 +160,7 @@ my_config = RAGLiteConfig(
> ✍️ To insert documents other than PDF, install the `pandoc` extra with `pip install raglite[pandoc]`.

> [!TIP]
> 🔎 For higher-quality document processing with automatic image descriptions, install the `mistral-ocr` extra with `pip install raglite[mistral-ocr]` and configure it as follows:
> 🔎 For higher-quality document processing with automatic image descriptions, install `mistralai` and configure it as follows:
> ```python
> from raglite import RAGLiteConfig, MistralOCRConfig
>
Expand Down Expand Up @@ -490,7 +490,7 @@ The following development environments are supported:

- This project follows the [Conventional Commits](https://www.conventionalcommits.org/) standard to automate [Semantic Versioning](https://semver.org/) and [Keep A Changelog](https://keepachangelog.com/) with [Commitizen](https://github.com/commitizen-tools/commitizen).
- Run `poe` from within the development environment to print a list of [Poe the Poet](https://github.com/nat-n/poethepoet) tasks available to run on this project.
- Run `uv add {package}` from within the development environment to install a run time dependency and add it to `pyproject.toml` and `uv.lock`. Add `--dev` to install a development dependency.
- Run `uv add {package}` from within the development environment to install a run time dependency and add it to `pyproject.toml`. Add `--dev` to install a development dependency.
- Run `uv sync --upgrade` from within the development environment to upgrade all dependencies to the latest versions allowed by `pyproject.toml`. Add `--only-dev` to upgrade the development dependencies only.
- Run `cz bump` to bump the package's version, update the `CHANGELOG.md`, and create a git tag. Then push the changes and the git tag with `git push origin main --tags`.

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
authors = [
{ name = "Laurent Sorber", email = "laurent@superlinear.eu" },
]
requires-python = ">=3.10,<4.0"
requires-python = ">=3.10,<3.14"
dependencies = [
# Configuration:
"platformdirs (>=4.0.0)",
Expand Down Expand Up @@ -81,8 +81,8 @@ chainlit = ["chainlit (>=2.0.0)"]
# Large Language Models:
llama-cpp-python = ["llama-cpp-python (>=0.3.9)"]
Comment thread
StijnGoossens marked this conversation as resolved.
# Markdown conversion:
mistral-ocr = ["mistralai (>=1.10.1)"]
pandoc = ["pypandoc-binary (>=1.13)"]
mistral-ocr = []
# Evaluation:
ragas = ["pandas (>=2.1.1)", "ragas (>=0.3.3)"]
# Benchmarking:
Expand Down
12 changes: 3 additions & 9 deletions src/raglite/_mistral_ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ def _get_mistral_client(processor_config: MistralOCRConfig) -> Any:
try:
from mistralai import Mistral
except ImportError as e:
error_msg = (
"To use MistralOCR, please install the `mistral-ocr` extra: "
"`pip install raglite[mistral-ocr]` or `uv add raglite[mistral-ocr]`."
)
error_msg = "To use MistralOCR, please install or upgrade `mistralai`."
raise ImportError(error_msg) from e
Comment thread
StijnGoossens marked this conversation as resolved.

api_key = _get_api_key(processor_config)
Expand All @@ -88,10 +85,7 @@ def _get_response_format_converter() -> Any:
try:
from mistralai.extra import response_format_from_pydantic_model
except ImportError as e:
error_msg = (
"To use MistralOCR, please install the `mistral-ocr` extra: "
"`uv add raglite[mistral-ocr]` or `pip install raglite[mistral-ocr]`."
)
error_msg = "To use MistralOCR, please install or upgrade `mistralai`."
raise ImportError(error_msg) from e
return response_format_from_pydantic_model

Expand Down Expand Up @@ -183,7 +177,7 @@ def mistral_ocr_to_markdown(doc_path: Path, *, processor_config: MistralOCRConfi
Raises
------
ImportError
If the mistralai package is not installed.
If the mistralai package is not installed or is incompatible.
ValueError
If MISTRAL_API_KEY is not set and MistralOCRConfig.api_key is None.
MistralOCRError
Expand Down
Loading