Skip to main content

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

PyPI version Python License: MIT

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

white_walker-0.6.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

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

white_walker-0.6.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file white_walker-0.6.0.tar.gz.

File metadata

  • Download URL: white_walker-0.6.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for white_walker-0.6.0.tar.gz
Algorithm Hash digest
SHA256 172f1730e63b3e38f3f817b5d7c60337bab9ac93fcd3000b7c029c3fde0c1dd8
MD5 2a9da6bc1ed8af06c0d86144a2455d86
BLAKE2b-256 2e48e1f69b75e270367e7c59998c74facb62a29119328580eeb779fb5bbe52d3

See more details on using hashes here.

File details

Details for the file white_walker-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: white_walker-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for white_walker-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04ca7d0cbc205c98db414a2001c8497a021f804e2b2deafffaa88d2f6c759f4b
MD5 2dc2dcff2588a59e7cf66e25c91832db
BLAKE2b-256 48acfe835bf262876e0f7b9bd069bed1b3161948f0314643c195f7fdc1468d2b

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