Skip to main content

Pandion

Retrieval pipelines you can inspect, step by step.

Pandion parses your documents, cleans and chunks them, embeds and stores them, then searches, reranks and answers questions. Every step is a strategy you can swap, and every step tells you what it did. Each result is cached under a hash of its settings, so the same files with the same settings are never processed twice.

Pandion is named after the osprey, which spots a fish under the water and dives to retrieve it. It is the engine of RAG Playground, a web app that shows every step of a pipeline on a PDF.

Install

Pandion needs Python 3.13.

pip install "pandion[pdfium,lancedb,local]"

The base install is small. Parsers, stores and models are extras, and a step whose extra is missing tells you which one to install:

Extra What it brings Needed by
pdfium pypdfium2 the fast pdfium parser
docling Docling and its OCR engine the docling parser, for layout, tables and scans
lancedb LanceDB and pyarrow the index, and the dense, bm25 and hybrid_rrf search
local sentence-transformers and torch the local embedders, and the mmr and cross_encoder rerankers
anthropic the Anthropic SDK llm_rewrite, llm_rerank and chat with Claude
openai the OpenAI SDK the same steps with OpenAI, OpenRouter or a compatible server

pandion install pipeline.yaml installs the extras a pipeline file needs.

Quick start

from pandion import Pipeline

p = Pipeline(
    path="./my-index",
    parse="pdfium",
    chunk={"use": "recursive_character", "chunk_size": 400, "chunk_overlap": 40},
    embed="bge-small-en-v1.5",
    store="lancedb",
    search="hybrid_rrf",
    answer="search",
)
p.index.run("report.pdf")
print(p.ask("What does the report recommend?").text)

The embedder downloads once, on first use. After that, a second p.index.run on the same file finds every step already stored and reuses it.

What you can do

  • Run one step on its own, with no pipeline and no cache: pandion.parse(pdf, use="pdfium"), pandion.clean(...), pandion.chunk(...).
  • Write a pipeline three ways: as a YAML file (Pipeline.from_file("pipeline.yaml")), as a dict per step, or with classes such as from pandion.parse import Docling. The three give the same pipeline and the same cache.
  • Build and update an index: p.index.run(files) indexes them, and p.index.sync(folder) adds, changes and removes files to match a folder.
  • Search: p.retrieve(question) runs the rewrite, search and rerank steps and returns each step's result as well as the hits.
  • Ask: p.ask(question) returns the pieces found, or an answer from a chat model that cites them.
  • Evaluate and compare: pandion.evaluate(p, "questions.json") scores a pipeline on a question set and says where each miss was lost, and pandion.compare runs one stage with several settings and names the best.
  • Questions written for you: pandion.evaluation.write_questions(doc, model=...), or pandion questions report.pdf --model ..., has a chat model write a checked question set.
  • Start from a template: pandion.compose_template("tables", "precision") joins an index template (how a kind of document is indexed) and a query template (how a kind of question is searched and answered) into a pipeline, and pandion.list_templates() lists them. See Templates.
  • Write your own strategy for any stage, register it with @register from pandion.extend, and use it by name, from code, from plugins: in a pipeline file, or with --plugins on the command line. The worked example writes one for every stage.

Start a project

pandion init my-project asks which index and query template to use, then writes a folder you can run straight away: pipeline.yaml, run.py, requirements.txt, a README and an empty docs/ for your documents. In code, pandion.new_project(folder, pipeline) writes the same folder for any pipeline. See Start a project.

Use Pandion from the command line

pandion validate pipeline.yaml, pandion index pipeline.yaml report.pdf, pandion ask pipeline.yaml "...": the same pipeline, from the command line. See the pandion command.

Learn more

  • The guide: every step, setting and error.
  • Examples: index, sync, search, ask, the three ways to write a pipeline, and your own strategy for every stage.
  • RAG Playground: try the same pipelines in the browser.

License

MIT. See LICENSE.

Metadata

Release files for pandion 0.4.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 pandion 0.4.0
File Size Uploaded Provenance
pandion-0.4.0.tar.gz 394.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pandion 0.4.0
File Interpreter ABI Platform
pandion-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 657.1 kB

Release files / pandion-0.4.0.tar.gz

Download URL pandion-0.4.0.tar.gz
Size 394.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ebd31127d7ffd421ee4a985def7007a1551ca3e9b65ab4d724c5cee50f9453da
BLAKE2b-256 checksum
How to use checksums
6541a7a37bf17dea30d388bcb0899c2657a1c92b0895ead9696b6b4563da8fd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Release files / pandion-0.4.0-py3-none-any.whl

Download URL pandion-0.4.0-py3-none-any.whl
Size 263.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96946640ccfadd91b445e54a0d8ddbb0d92364eeee37e29e5d878a7b0e9ef121
BLAKE2b-256 checksum
How to use checksums
9d0d3bfb9195e5c3f35f69159989d4f57b8d94b55251637bacde58ed357991b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Security for pandion 0.4.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pandion-0.4.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 Oct 16, 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.

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