RAG without vector databases — uses tree-indexed PDF navigation + Gemini 2.0 Flash.
Most RAG systems chunk documents into vector embeddings and run similarity search. This project skips all that.
Instead:
- PDF is uploaded to PageIndex, which builds a tree index (like a smart Table of Contents)
- On each query, Gemini navigates the tree to find the right sections
- Gemini then generates a cited answer from those sections
No embeddings. No vector store. Just two API calls per query.
PDF → PageIndex (tree index) → User Query
↓
Gemini: "Which nodes answer this?"
↓
Fetch those sections
↓
Gemini: Generate cited answer
| What | Tool |
|---|---|
| Document Indexing | PageIndex API |
| Language Model | Gemini 2.0 Flash |
| Interface | Jupyter Notebook |
| Language | Python 3.11+ |
1. Clone
git clone https://github.com/Shivas-A54/Stateless_RAG.git
cd Stateless_RAG2. Install
pip install pageindex python-dotenv google-generativeai ipykernel3. Add API keys
PAGEINDEX_API_KEY="your_key" # → dash.pageindex.ai/api-keys
GEMINI_API_KEY="your_key" # → aistudio.google.com/app/apikey4. Run
jupyter notebook PageIndex.ipynbStateless_RAG/
├── PageIndex.ipynb # Full pipeline
├── RAG.pdf # Sample PDF for testing
├── workflow_diagram.png # Architecture diagram
├── .env.example # API key template
└── pyproject.toml
No vector store is created or maintained locally. The document tree lives in PageIndex (external), and each query runs as a clean, self-contained pipeline. Nothing is written to disk between runs.
- PDF only (other formats untested)
- Requires a PageIndex API account
- Two Gemini calls per query (adds slight latency)
- Very large PDFs may increase token usage
- PageIndex — tree indexing API
- Google Gemini — language model
Built by Shivas-A54