Skip to main content

Python SDK for PageIndex

Project description

PageIndex Banner

VectifyAI%2FPageIndex | Trendshift

PageIndex: Vectorless, Reasoning-based RAG

Reasoning-based RAG  ◦  No Vector DB  ◦  No Chunking  ◦  Human-like Retrieval

🌐 Homepage  •   🖥️ Chat Platform  •   🔌 MCP & API  •   📖 Docs  •   💬 Discord  •   ✉️ Contact 

📢 Updates

  • 🔥 Agentic Vectorless RAG — A simple agentic, vectorless RAG example with self-hosted PageIndex, using OpenAI Agents SDK.
  • PageIndex Chat — Human-like document analysis agent platform for professional long documents. Also available via MCP or API.
  • PageIndex Framework — Deep dive into PageIndex: an agentic, in-context tree index that enables LLMs to perform reasoning-based, human-like retrieval over long documents.

📑 Introduction to PageIndex

Are you frustrated with vector database retrieval accuracy for long professional documents? Traditional vector-based RAG relies on semantic similarity rather than true relevance. But similarity ≠ relevance — what we truly need in retrieval is relevance, and that requires reasoning. When working with professional documents that demand domain expertise and multi-step reasoning, similarity search often falls short.

Inspired by AlphaGo, we propose PageIndex — a vectorless, reasoning-based RAG system that builds a hierarchical tree index from long documents and uses LLMs to reason over that index for agentic, context-aware retrieval. It simulates how human experts navigate and extract knowledge from complex documents through tree search, enabling LLMs to think and reason their way to the most relevant document sections. PageIndex performs retrieval in two steps:

  1. Generate a “Table-of-Contents” tree structure index of documents
  2. Perform reasoning-based retrieval through tree search

🎯 Core Features

Compared to traditional vector-based RAG, PageIndex features:

  • No Vector DB: Uses document structure and LLM reasoning for retrieval, instead of vector similarity search.
  • No Chunking: Documents are organized into natural sections, not artificial chunks.
  • Human-like Retrieval: Simulates how human experts navigate and extract knowledge from complex documents.
  • Better Explainability and Traceability: Retrieval is based on reasoning — traceable and interpretable, with page and section references. No more opaque, approximate vector search (“vibe retrieval”).

PageIndex powers a reasoning-based RAG system that achieved state-of-the-art 98.7% accuracy on FinanceBench, demonstrating superior performance over vector-based RAG solutions in professional document analysis. See our blog post for details.

📍 Explore PageIndex

To learn more, please see a detailed introduction to the PageIndex framework. Check out this GitHub repo for open-source code, and the cookbooks, tutorials, and blog for additional usage guides and examples.

The PageIndex service is available as a ChatGPT-style chat platform, or can be integrated via MCP or API.

🛠️ Deployment Options

  • Self-host — run locally with this open-source repo.
  • Cloud Service — try instantly with our Chat Platform, or integrate via MCP or API.
  • Enterprise — private or on-prem deployment. Contact us or book a demo for more details.

🧪 Quick Hands-on

  • 🔥 Agentic Vectorless RAG (latest) — a simple but complete agentic vectorless RAG example with self-hosted PageIndex, using OpenAI Agents SDK.
  • Try the Vectorless RAG notebook — a minimal, hands-on example of reasoning-based RAG using PageIndex.
  • Check out Vision-based Vectorless RAG — no OCR; a minimal, vision-based & reasoning-native RAG pipeline that works directly over page images.
View on GitHub: Agentic Vectorless RAG
Open in Colab: Vectorless RAG    Open in Colab: Vision RAG

🌲 PageIndex Tree Structure

PageIndex can transform lengthy PDF documents into a semantic tree structure, similar to a "table of contents" but optimized for use with Large Language Models (LLMs). It's ideal for: financial reports, regulatory filings, academic textbooks, legal or technical manuals, and any document that exceeds LLM context limits.

Below is an example PageIndex tree structure. Also see more example documents and generated tree structures.

...
{
  "title": "Financial Stability",
  "node_id": "0006",
  "start_index": 21,
  "end_index": 22,
  "summary": "The Federal Reserve ...",
  "nodes": [
    {
      "title": "Monitoring Financial Vulnerabilities",
      "node_id": "0007",
      "start_index": 22,
      "end_index": 28,
      "summary": "The Federal Reserve's monitoring ..."
    },
    {
      "title": "Domestic and International Cooperation and Coordination",
      "node_id": "0008",
      "start_index": 28,
      "end_index": 31,
      "summary": "In 2023, the Federal Reserve collaborated ..."
    }
  ]
}
...

You can generate the PageIndex tree structure with this open-source repo, or use our API.


⚙️ Package Usage

You can follow these steps to generate a PageIndex tree from a PDF document.

1. Install dependencies

pip3 install --upgrade -r requirements.txt

2. Set your LLM API key

Create a .env file in the root directory with your LLM API key, with multi-LLM support via LiteLLM:

OPENAI_API_KEY=your_openai_key_here

3. Generate PageIndex structure for your PDF

python3 run_pageindex.py --pdf_path /path/to/your/document.pdf
Optional parameters
You can customize the processing with additional optional arguments:
--model                 LLM model to use (default: gpt-4o-2024-11-20)
--toc-check-pages       Pages to check for table of contents (default: 20)
--max-pages-per-node    Max pages per node (default: 10)
--max-tokens-per-node   Max tokens per node (default: 20000)
--if-add-node-id        Add node ID (yes/no, default: yes)
--if-add-node-summary   Add node summary (yes/no, default: yes)
--if-add-doc-description Add doc description (yes/no, default: yes)
Markdown support
We also provide markdown support for PageIndex. You can use the `--md_path` flag to generate a tree structure for a markdown file.
python3 run_pageindex.py --md_path /path/to/your/document.md

Note: in this mode, we use "#" to determine node headings and their levels. For example, "##" is level 2, "###" is level 3, etc. Make sure your markdown file is formatted correctly. If your Markdown file was converted from a PDF or HTML, we don't recommend using this mode, since most existing conversion tools cannot preserve the original hierarchy. Instead, use our PageIndex OCR, which is designed to preserve the original hierarchy, to convert the PDF to a markdown file and then use this mode.

Agentic Vectorless RAG: An Example

For a simple, end-to-end agentic vectorless RAG example using PageIndex with OpenAI Agents SDK, see examples/agentic_vectorless_rag_demo.py.

# Install optional dependency
pip3 install openai-agents

# Run the demo
python3 examples/agentic_vectorless_rag_demo.py

📈 Case Study: PageIndex Leads Finance QA Benchmark

Mafin 2.5 is a reasoning-based RAG system for financial document analysis, powered by PageIndex. It achieved a state-of-the-art 98.7% accuracy on the FinanceBench benchmark, significantly outperforming traditional vector-based RAG systems.

PageIndex's hierarchical indexing and reasoning-driven retrieval enable precise navigation and extraction of relevant context from complex financial reports, such as SEC filings and earnings disclosures.

Explore the full benchmark results and our blog post for detailed comparisons and performance metrics.


🧭 Resources

  • 📝 Blog: technical articles, research insights, and product updates.
  • 🔧 Developer: MCP setup, API docs, and integration guides.
  • 🧪 Cookbooks: hands-on, runnable examples and advanced use cases.
  • 📖 Tutorials: practical guides and strategies, including Document Search and Tree Search.

⭐ Support Us

Leave us a star 🌟 if you like our project. Thank you!

Please cite this work as:

Mingtian Zhang, Yu Tang and PageIndex Team,
"PageIndex: Next-Generation Vectorless, Reasoning-based RAG",
PageIndex Blog, Sep 2025.
Or use the BibTeX citation.
@article{zhang2025pageindex,
  author = {Mingtian Zhang and Yu Tang and PageIndex Team},
  title = {PageIndex: Next-Generation Vectorless, Reasoning-based RAG},
  journal = {PageIndex Blog},
  year = {2025},
  month = {September},
  note = {https://pageindex.ai/blog/pageindex-intro},
}

Connect with Us

TwitterLinkedInDiscordContact Us


© 2026 Vectify AI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pageindex-0.3.0.dev0.tar.gz (61.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pageindex-0.3.0.dev0-py3-none-any.whl (66.9 kB view details)

Uploaded Python 3

File details

Details for the file pageindex-0.3.0.dev0.tar.gz.

File metadata

  • Download URL: pageindex-0.3.0.dev0.tar.gz
  • Upload date:
  • Size: 61.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.9 Darwin/25.5.0

File hashes

Hashes for pageindex-0.3.0.dev0.tar.gz
Algorithm Hash digest
SHA256 fdaed350bbb5398803ab401b00619c81b380d35c72b9d968d2937387aa1a9b59
MD5 277c3dc70566d8352b4b5ded4c405728
BLAKE2b-256 8307992228c02d491ef43ef467a1d4577a773468e41911a869a5e7efa4223793

See more details on using hashes here.

File details

Details for the file pageindex-0.3.0.dev0-py3-none-any.whl.

File metadata

  • Download URL: pageindex-0.3.0.dev0-py3-none-any.whl
  • Upload date:
  • Size: 66.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.9 Darwin/25.5.0

File hashes

Hashes for pageindex-0.3.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cfd3606d763557312a527bc4cdb5849e78a9a52853a4202bfb00136fcbff957
MD5 459bb2294acd23c4466245ea03f1ebfd
BLAKE2b-256 ae9262d493090762f5cad08d4662ce9cdce7168b8078e3752725732646aafa71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page