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.1.0.tar.gz (29.3 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.1.0-py3-none-any.whl (33.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: white_walker-0.1.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

Hashes for white_walker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5025fd1af4d8137471d05522a8792a10f1497aeb5d8177f991b64555090c38ae
MD5 d6c5980a9e90715be56c461cbb6cbda8
BLAKE2b-256 4af0f3d3951887f49562c325515c64eb1a1bf00ec6e97b7779a0c3a2bf98f0f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: white_walker-0.1.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

Hashes for white_walker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6d23a1c229280039086331da29bb765c7c2262ed49cb6a917295f9b1fc16095c
MD5 5e415eecc2459e398f86bbb6d6563363
BLAKE2b-256 e6eccc88904904bf812222c706a3990b17609f00d0a01b756982993d3bf39b38

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