TOOL WIKI · DATA & RETRIEVAL

Docling

Converts document content and structure into representations for application pipelines.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Preserve a policy’s structure in Markdown

A policy assistant needs usable source text or relevant evidence before a generation model can answer a question reliably.

Input
The supplied HTML policy document.
Expected output
policy.md containing its headings and 30-day condition.
  • Success check: policy.md preserves the returns heading and 30-day condition.
  • Try a failure: A parser success without the critical policy condition should fail ingestion acceptance.

Example scope: Actual document conversion; OCR, complex PDFs and tables need their own fixtures.

Official reference · Docling

WHAT IT ISDocument processing toolkit
WHERE IT FITSData & retrieval
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
inputprocessresultcheckoutputSource materialFiles or textDoclingDocument processing toolkitPrepared recordsText, chunks, or vectorsRetrieval storageIndex + metadataQuery pipelineScoped evidence lookupEvaluationInspect source fidelity
  1. Preserve provenance, input format, and access-control metadata.

  2. Processing documents locally or in a controlled ingestion service. Check layout fidelity and the handling of scans and complex tables.

  3. Validate the component-specific output, including failed or empty records.

  4. Store derived data with source version and deletion information.

  5. Use compatible query processing and tenant-scoped filtering.

  6. Check extraction quality, retrieval recall, and answer grounding separately.

    Result or stopping point
Docling

Processing documents locally or in a controlled ingestion service. Check layout fidelity and the handling of scans and complex tables.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Processing documents locally or in a controlled ingestion service.

A design decision to make

  • Check layout fidelity and the handling of scans and complex tables.

Prerequisites and setup

  • Python 3.11+ on a supported platform. PDF/OCR pipelines may require model downloads and system dependencies.
Shell
python3 -m venv .venv
source .venv/bin/activate
pip install docling

Try a small integration

policy.html

HTML · policy.html
<!doctype html><html lang="en"><title>Returns policy</title><main><h1>Returns</h1><p>Returns are accepted within 30 days.</p><h2>Shipping</h2><p>Dispatch follows packing.</p></main></html>

convert.py

Python · convert.py
from pathlib import Path
from docling.document_converter import DocumentConverter

result = DocumentConverter().convert("policy.html")
markdown = result.document.export_to_markdown()
assert "30 days" in markdown
Path("policy.md").write_text(markdown,encoding="utf-8")
print(markdown)

Run and check the result

Shell
python convert.py
  • policy.md preserves the returns heading and 30-day condition.
  • Start with HTML to isolate the conversion API; then compare a PDF/table fixture against its rendered source.

Common failures

  • A successful parse job does not prove table/reading-order accuracy; compare output with the original page.
  • Enforce file-size, duration and memory limits. Treat extracted text as untrusted content rather than instructions.

Production decisions

  • Preserve document ID, version, page/section, access scope and parser/model configuration alongside each chunk or vector.
  • Evaluate extraction and retrieval separately. Test tables, scans, empty documents, duplicates, malformed input and source deletion.

Keep exploring

Retrieval that can ask a better questionA context pipeline for a long-running agent

Explore the same layer

UnstructuredLlamaParseSentence TransformersCohere Rerank

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.