PageIndex: An Open-Source PDF Indexing System for More Accurate, Logic-Based Retrieval
What is PageIndex?
PageIndex is an open-source PDF document indexing system designed to improve retrieval accuracy for long professional documents and the reasoning capabilities of LLMs. It replaces traditional vector RAG semantic similarity search by transforming PDF documents into a hierarchical tree structure, enabling more precise and logical retrieval.
PageIndex's core features include transforming documents into a tree structure similar to an intelligent table of contents, providing precise page location, avoiding arbitrary chunking, and adapting to extra-long documents, easily handling content of hundreds or even thousands of pages.
It works by converting PDF documents into a semantic tree structure, combined with query analysis, document selection, node selection, and content generation, ultimately providing accurate answers. Unlike systems that rely on vector databases or traditional chunking methods, PageIndex is completely free and open-source. It is particularly well-suited for handling financial reports, regulatory documents, academic textbooks, legal or technical manuals, and any document that exceeds LLM context limits.

PageIndex Core Features
Document Processing: Capable of processing long documents, especially professional documents, by building a search tree structure in preparation for reasoning-based Retrieval-Augmented Generation (RAG).
Table of Contents Extraction and Processing
Can extract table of contents content from documents, handling different cases where page numbers may or may not be present.
Transforms the table of contents, converting it into a specific JSON format for convenient subsequent processing.
Page Number Handling: Adds physical indexes to table of contents entries, handles missing or incorrect page numbers, and fixes incorrect entries through multiple attempts.
Node Processing: Recursively processes large nodes, splitting them into smaller nodes to meet token count and page count limits.
Validation and Fixing: Validates the accuracy of the table of contents, calculates accuracy rates, and fixes inaccurate results.
PageIndex Features
Hierarchical Tree Structure: Enables LLMs to logically traverse documents, like an intelligent, LLM-optimized table of contents.
Precise Page References: Each node contains its summary and the physical index of its start/end pages, enabling precise retrieval.
No Arbitrary Chunking: Does not use arbitrary chunking; nodes follow the document's natural structure.
Support for Large-Scale Documents: Designed to easily handle documents of hundreds or even thousands of pages.
PageIndex Use Cases
Finance
Financial Report Analysis: Quickly locate key financial data and metrics.
Regulatory Document Interpretation: Precisely find regulatory clauses to ensure compliance.
Legal
Legal Document Retrieval: Efficiently find legal clauses and cases.
Contract Review: Quickly locate key clauses in contracts.
Academic Research
Academic Paper Retrieval: Quickly find research findings and theoretical support.
Textbook Learning: Conveniently locate specific chapters and knowledge points.
Technical Documentation
Technical Manuals: Quickly find operation steps and technical parameters.
Project Documentation: Efficiently retrieve key information from projects.
Enterprise Internal
Internal Reports: Quickly locate key content in long reports.
Knowledge Base Management: Improve knowledge sharing and retrieval efficiency.
Healthcare
Medical Literature Retrieval: Quickly find research findings and treatment methods.
Clinical Guidelines: Precisely locate clinical operation guidelines.
Education
Online Course Materials: Quickly find key course content.
Exam Review Materials: Efficiently locate review points.
Government Agencies
Policy Document Interpretation: Quickly find policy clauses.
Public Information Retrieval: Improve public service efficiency.
How to Use PageIndex
1. Install Dependencies
pip3 install -r requirements.txt
2. Set the Openai API Key
Create a .env file in the root directory and add your API key:
CHATGPT_API_KEY=your_openai_key_here
3. Run PageIndex on a PDF
python3 run_pageindex.py --pdf_path /path/to/your/document.pdf
You can also customize the processing through additional optional parameters, for example:
--model OpenAI 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: no) --if-add-doc-description Add doc description (yes/no, default: yes)
Github: https://github.com/VectifyAI/PageIndex
Project Website: https://vectify.ai/pageindex
Script Planner Assistant▸
AI Apps
AI News 