Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Librarium

A local RAG-based Document Q&A system

Chat with your documents. Runs fully offline. Zero API costs.

Python LangChain Ollama Streamlit


Overview

Librarium is a fully offline document Q&A system built on a RAG (Retrieval-Augmented Generation) pipeline. Upload PDFs, Word docs, text files, or paste any URL — then ask questions in plain English and get accurate, cited answers powered by a local LLM.

No API keys. No cloud dependency. No cost.


Preview


Features

Feature Description
Hybrid Search Combines BM25 keyword search and vector search for better retrieval
Multi-format Support PDF, DOCX, TXT, and web URLs
OCR Extracts text from image-based and scanned PDFs automatically
Conversation Memory Ask follow-up questions — the system remembers context
Citations Every answer shows the exact source file and page number
Query Rewriting Vague questions are automatically rewritten for better retrieval
Auto Summary Generates a document summary on load
URL Support Fetch and index any webpage mid-session
Chat Export Export your Q&A session as a formatted PDF
Eval Dashboard Live grounding score, response time, and retrieval stats per query
Streaming Answers stream word-by-word for a responsive feel
Persistent Storage Vector DB saves to disk and reloads instantly on future runs

Tech Stack

Layer Technology
Orchestration LangChain
LLM Ollama (llama3.2, llama3.2:1b) — runs locally
Embeddings Ollama (nomic-embed-text)
Vector DB ChromaDB
Keyword Search BM25 (rank-bm25)
OCR Tesseract + pdf2image
Web Scraping BeautifulSoup + Requests
UI Streamlit

Setup

Prerequisites

Installation

1. Clone the repository

git clone https://github.com/keya115251/document-qna.git
cd document-qna

2. Create and activate a virtual environment

python -m venv venv
venv\Scripts\activate       # Windows
source venv/bin/activate    # Mac/Linux

3. Install dependencies

pip install -r requirements.txt

4. Pull the Ollama models

ollama pull llama3.2
ollama pull llama3.2:1b
ollama pull nomic-embed-text

5. Update paths in app.py

TESSERACT_PATH = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
POPPLER_PATH   = r"C:\poppler\poppler-26.02.0\Library\bin"

6. Run

streamlit run app.py

Usage

  • Upload a PDF, DOCX, or TXT file via the sidebar
  • Or paste any URL to index a webpage
  • Ask questions in the chat input
  • Type load url <url> in chat to add more sources mid-session
  • Toggle the Eval Dashboard to see retrieval metrics
  • Export your session as a PDF from the sidebar

Roadmap

  • Hybrid search (BM25 + vector)
  • Multi-document support
  • OCR for image-based PDFs
  • Query rewriting
  • Citations with source and page attribution
  • Conversation memory
  • URL support with mid-session loading
  • Auto document summary
  • Chat history export as PDF
  • Streamlit Web UI
  • Evaluation dashboard

Built by Keya Chembuli

About

A local RAG-based Document Q&A system that runs fully offline with no API costs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages