Prerequisites
- macOS:
brew install ffmpeg - Ubuntu:
sudo apt-get install ffmpeg - Windows: Download from ffmpeg.org
Example
OCR Configuration
cookbook/91_tools/docling_tools/ocr_example.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Convert documents to Markdown, JSON, HTML, and other formats with configurable OCR using the Docling library.
uv pip install -U docling
# Required for the OCR example
uv pip install -U easyocr
# Required for audio/video processing
uv pip install -U openai-whisper
brew install ffmpegsudo apt-get install ffmpegfrom agno.agent import Agent
from agno.tools.docling import DoclingTools
agent = Agent(
tools=[DoclingTools(all=True)],
description="You are an agent that converts documents from all Docling parsers and exports to all supported output formats.",
)
# Convert a PDF to Markdown
agent.print_response(
"Convert to Markdown: cookbook/07_knowledge/testing_resources/cv_1.pdf",
markdown=True,
)
# Convert a PDF to JSON
agent.print_response(
"Convert to JSON and return the full JSON without summarizing: cookbook/07_knowledge/testing_resources/cv_1.pdf",
markdown=True,
)
# Convert inline string content
agent.print_response(
"Use convert_string_content to convert this markdown string to JSON: # Inline Markdown\n\nThis is a parser test.",
markdown=True,
)
from agno.agent import Agent
from agno.tools.docling import DoclingTools
ocr_tools = DoclingTools(
pdf_enable_ocr=True,
pdf_ocr_engine="easyocr",
pdf_ocr_lang=["pt", "en"],
pdf_force_full_page_ocr=True,
pdf_enable_table_structure=True,
pdf_enable_picture_description=False,
pdf_document_timeout=120.0,
)
ocr_agent = Agent(
tools=[ocr_tools],
description="You are an agent that converts PDFs using advanced OCR.",
)
ocr_agent.print_response(
"Convert to Markdown: cookbook/07_knowledge/testing_resources/cv_1.pdf",
markdown=True,
)
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/91_tools/docling_tools
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
python docling_tools.py
Was this page helpful?