← Back to Portfolio
GitHub Project · github.com/arunkumar-dot/rag-document-assistant

Lumen — Local-First Document Q&A API

Local hybrid RAG pipeline with pgvector semantic retrieval, full-text search, and streamed LLM inference via Ollama

TypeScriptHonoNode.jsSupabase (pgvector)OllamaDocker
Context

Built a local-first retrieval-augmented generation (RAG) service that indexes Markdown and PDF documents into Supabase pgvector and streams answers using local Ollama models (llama3, mistral).

Problem

Cloud LLM APIs (OpenAI, Anthropic) incur ongoing per-token costs, add network latency, and cannot be used for sensitive or air-gapped document collections where data privacy is a strict requirement.

Solution

Engineered a hybrid search pipeline that combines dense vector similarity (pgvector HNSW index) with sparse keyword matching (PostgreSQL tsvector). Streamed inference chunks over HTTP using Hono and Ollama's local API.

Outcome

A reproducible local Q&A pipeline that runs without external API dependencies, delivers sub-second first-token latency on Apple Silicon, and keeps all document embeddings and queries strictly on-premises.