You can also check this cookbook in Colab here
In this cookbook, we’ll explore Mistral OCR—a state-of-the-art Optical Character Recognition API that understands complex document layouts and extracts text, tables, images, and equations with unprecedented accuracy. We’ll show you how to:
⭐ Star us on GitHub, join our Discord, or follow us on X
Throughout history, advancements in information abstraction and retrieval have driven human progress—from hieroglyphs to digitization. Today, over 90% of organizational data lives in documents, often locked in complex layouts and multiple languages. Mistral OCR ushers in the next leap in document understanding: a multimodal API that comprehends every element—text, images, tables, equations—and outputs ordered, structured Markdown with embedded media references.
State-of-the-art complex document understanding
Natively multilingual & multimodal
Doc-as-prompt, structured output
Top-tier benchmarks & speed
Scalable & flexible deployment
mistral-ocr-latest
on Mistral’s developer suite, cloud partners, and on-premises self-hosting for sensitive data.Ready to unlock your documents? Let’s dive into the extraction guide.
First, install the CAMEL package with all its dependencies.
Step 1: Set up your Mistral API key
If you don’t have a Mistral API key, you can obtain one by following these steps:
Create an account:
Go to Mistral Console and sign up for an organization account.
Get your API key:
Once logged in, navigate to Organization → API Keys, generate a new key, copy it, and store it securely.
Step 2: Upload your PDF or image file for OCR
In a Colab or Jupyter environment, you can upload any PDF file directly:
Step 3: Import and initialize the Mistral OCR loader
Once the task completes, retrieve its output using the returned task.id
.
The output of Mistral OCR is a structured object:
Here we choose Mistral model for our demo. If you’d like to explore different models or tools to suit your needs, feel free to visit the CAMEL documentation page, where you’ll find guides and tutorials.
If you don’t have a Mistral API key, you can obtain one by following these steps:
Visit the Mistral Console (https://console.mistral.ai/)
In the left panel, click on API keys under API section
Choose your plan
For more details, you can also check the Mistral documentation: https://docs.mistral.ai/getting-started/quickstart/
For advanced usage of RAG capabilities with large files, please refer to our RAG cookbook.
In conclusion, integrating Mistral OCR within CAMEL-AI revolutionizes the process of document data extraction and preparation, enhancing your capabilities for AI-driven applications. With Mistral OCR’s robust features—state-of-the-art complex document understanding, natively multilingual & multimodal parsing, and doc-as-prompt structured Markdown output—you can seamlessly process complex PDFs and images into machine-readable formats optimized for LLMs, directly feeding into CAMEL-AI’s multi-agent workflows. This integration not only simplifies data preparation but also empowers intelligent and accurate analytics at scale. With these tools at your disposal, you’re equipped to transform raw document data into actionable insights, unlocking new possibilities in automation and AI-powered decision-making.
That’s everything: Got questions about 🐫 CAMEL-AI? Join us on Discord! Whether you want to share feedback, explore the latest in multi-agent systems, get support, or connect with others on exciting projects, we’d love to have you in the community! 🤝
Check out some of our other work:
🐫 Creating Your First CAMEL Agent free Colab
Graph RAG Cookbook free Colab
🧑⚖️ Create A Hackathon Judge Committee with Workforce free Colab
🔥 3 ways to ingest data from websites with Firecrawl & CAMEL free Colab
🦥 Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth free Colab
Thanks from everyone at 🐫 CAMEL-AI
⭐ Star us on GitHub, join our Discord, or follow us on X