Multimodal Agentic RAG with hierarchical tree indexing โ index PDFs & Markdown into navigable tree structures, persist in Supabase, and query with LLM-powered retrieval.
Project description
๐ง White Walker
Multimodal Agentic RAG โ Index PDFs & Markdown into hierarchical tree structures, persist in Supabase, and query with LLM-powered retrieval.
White Walker transforms documents into navigable tree indexes using LLM-based structural analysis, stores them in Supabase (or locally), and answers questions by intelligently traversing the tree to find relevant sections.
โจ Features
- ๐ฒ Hierarchical Tree Indexing โ Automatically detects document structure (TOC, sections, subsections) and builds a navigable tree
- ๐๏ธ Supabase Persistence โ Trees, raw pages, and metadata stored in PostgreSQL via Supabase
- ๐ค Agentic Retrieval โ LLM navigates the tree to find relevant sections, then synthesizes answers with citations
- ๐ PDF & Markdown Support โ Works with academic papers, technical docs, and any structured document
- โก Rate-Limited API โ Built-in token-bucket rate limiter for NVIDIA NIM API (38 RPM, configurable)
- ๐ Pluggable LLM Backend โ Default: NVIDIA NIM API, easily extensible
๐ฆ Installation
pip install white-walker
๐ Quick Start
1. Set Environment Variables
# .env file
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key
NVIDIA_API_KEY=your-nvidia-nim-api-key
2. Set Up Supabase Tables
Run the SQL in setup_supabase.sql in your Supabase SQL editor to create the required tables (rag_documents, rag_raw_pages, rag_tree_nodes).
3. Index & Query
from white_walker import WhiteWalkerClient
client = WhiteWalkerClient()
# Index a PDF
doc_id = client.index("paper.pdf")
# Query the indexed document
result = client.query(doc_id, "What is the main contribution of this paper?")
print(result["answer"])
print(result["citations"])
print(result["confidence"]) # "high", "medium", or "low"
๐๏ธ Architecture
PDF / Markdown
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ PDF Ingestor โ Extracts text, detects TOC, builds hierarchical tree
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Tree Indexer โ LLM-based section detection, title verification,
โ โ page-number alignment, node summarization
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Supabase Store โ Persists tree nodes, raw pages, document metadata
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Agent Retriever โ LLM navigates tree โ finds relevant nodes โ
โ โ fetches page content โ synthesizes cited answer
โโโโโโโโโโโโโโโโโโโ
โ๏ธ Configuration
White Walker uses white_walker/config.yaml for defaults:
| Parameter | Default | Description |
|---|---|---|
model |
moonshotai/kimi-k2.6 |
NVIDIA NIM model for indexing & retrieval |
toc_check_page_num |
20 |
Max pages to scan for table of contents |
max_page_num_each_node |
10 |
Max pages per tree node |
max_token_num_each_node |
20000 |
Max tokens per tree node |
Override at initialization:
client = WhiteWalkerClient(model="meta/llama-3.1-70b-instruct")
๐ Environment Variables
| Variable | Required | Description |
|---|---|---|
NVIDIA_API_KEY |
โ | NVIDIA NIM API key for LLM calls |
SUPABASE_URL |
Optional | Supabase project URL (falls back to local storage) |
SUPABASE_KEY |
Optional | Supabase anon/service key |
๐ Evaluation
White Walker includes a RAGAS-based evaluation pipeline for benchmarking against multimodal agentic RAG datasets. See evaluate_pipeline.py for details.
๐ License
MIT License โ see LICENSE for details.
๐ Acknowledgments
Built on the foundation of VectifyAI/PageIndex, re-architected for local processing, Supabase persistence, and pluggable LLM backends.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file white_walker-0.3.0.tar.gz.
File metadata
- Download URL: white_walker-0.3.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1ab56247d0f067727a22c632952cc76f846d96a8b9311e09ced3e8887c8762b
|
|
| MD5 |
d4f2d1a738a648a6f0b2e99957561339
|
|
| BLAKE2b-256 |
7f91d69b0d4efafb683e6d208f257c25a4d728f77a0a9c96eebea256d316d42e
|
File details
Details for the file white_walker-0.3.0-py3-none-any.whl.
File metadata
- Download URL: white_walker-0.3.0-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71fb922f21f8378a62234f1eae71cc41ac0060930ae0e8d16dfd895dc9751bcf
|
|
| MD5 |
1b5f2ca42505a2c589c7abc83fe02d40
|
|
| BLAKE2b-256 |
4e5fa6764b769a9bc702a5f4515e0b136d11d8a4e731848b632da4e0a41a2d28
|