Skip to main content

langchain-readanydoc

A LangChain document loader for ReadAnyDoc, the open-source (Apache-2.0) document parser. It turns PDFs, scans, photos and Office files into Markdown Documents, one per page, each with its page number so an answer can point back to where it came from.

ReadAnyDoc runs on your own machine. Pages are read by a vision model on your own model account (Claude Haiku 5.5 by default), so there is no parsing service to sign up for and your files are not uploaded to one.

Install

pip install langchain-readanydoc
export ANTHROPIC_API_KEY=...        # the default model is Claude Haiku 5.5

It also needs Tesseract for scans: brew install tesseract or apt install tesseract-ocr. The layout and OCR weights (about 200 MB) download on first use, so the first parse takes a few minutes longer. Python 3.12 or 3.13.

Use

from langchain_readanydoc import ReadAnyDocLoader

docs = ReadAnyDocLoader("report.pdf").load()     # one Document per page

docs[0].page_content    # Markdown, tables as HTML
docs[0].metadata        # {"source": "report.pdf", "page": 1}

Into a vector store, the usual way:

from langchain_core.vectorstores import InMemoryVectorStore
from langchain_openai import OpenAIEmbeddings

docs = ReadAnyDocLoader(["q3-report.pdf", "contract.docx", "scan.jpg"]).load()
store = InMemoryVectorStore.from_documents(docs, OpenAIEmbeddings())
store.similarity_search("termination notice period", k=3)[0].metadata   # source and page

Options

Argument What it does
split="page" one Document per page (default)
split="block" one Document per title, paragraph, table and so on; metadata adds block_type, bbox and confidence
split="document" the whole file as one Document
mode="model-only" faster and cheaper, without block positions
pages=[1, 2] only these pages
model=... another vision model: any Claude model, OpenAI models, or an OpenAI-compatible endpoint (openai_compatible:<model>@<base_url>). The numbers below are for Claude Haiku 5.5

Any other keyword goes to readanydoc.parse. lazy_load() works too, and yields pages as each file finishes.

The first Document of a file carries warnings in its metadata when ReadAnyDoc reported any, for example a page the model provider declined to read.

What to expect

Measured on public benchmarks with Claude Haiku 5.5, against Reducto's hosted API on the same pages:

  • olmOCR-bench (1,403 pages): 85.4 against 80.9
  • OmniDocBench text error (1,651 pages, lower is better): 0.050 against 0.095
  • tables (RD-TableBench): 88.84 against 88.85

It is slower: 20-50 seconds a page against about 4, although the pages of one document are read in parallel. Cost is about $0.003-0.005 a page on your own model account. Every score, including the ones it loses, is in BENCHMARKS.md.

Typed extraction with a citation box for every value is not part of the loader. For that, call readanydoc.extract.

Apache-2.0.

Metadata

Release files for langchain-readanydoc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-readanydoc 0.1.0
File Size Uploaded Provenance Actions
langchain_readanydoc-0.1.0.tar.gz 8.1 kB With provenance Details for langchain_readanydoc-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-readanydoc 0.1.0
File Interpreter ABI Platform Actions
langchain_readanydoc-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_readanydoc-0.1.0-py3-none-any.whl

Total release size: 16.6 kB

Release files / langchain_readanydoc-0.1.0.tar.gz

Download URL langchain_readanydoc-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ad61d9a9df6610b74a51b59e9f974a2640f892d3e9ad14d9e13f7f4eabf49b4b
BLAKE2b-256 checksum
How to use checksums
df63f85f23cda1bb4085dea3e6327964f1592aadd194b3db9fd064d8a220e4fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / langchain_readanydoc-0.1.0-py3-none-any.whl

Download URL langchain_readanydoc-0.1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f882be8eb2a517cb027ac0d6d22f7199c041d810b9f1f432234df8dc9b5f915
BLAKE2b-256 checksum
How to use checksums
c751e8930660c90db8ebc2ed038d1fe095ec2e31264df1e5599c3a44c0aaf0a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for langchain-readanydoc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_readanydoc-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page