Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docmind-rag

Python Chroma BM25 Ollama Streamlit MIT

Verified end-to-end on Windows with local Ollama (llama3.1, num_ctx=8192) — every command below is from a real run.

DocMind is a retrieval-augmented chat over your own documents that treats citations as non-negotiable: every claim carries an inline [n] marker that resolves to a filename and page number. If the documents don't contain the answer, it says so instead of improvising.

Embeddings, search, and generation all run locally (Ollama) — nothing leaves the machine, which is exactly what businesses with contracts, SOPs, and client files need to hear.

Why hybrid search

Pure vector search misses exact identifiers (SKUs, error codes, clause numbers); pure keyword search misses paraphrases. DocMind runs both and fuses rankings with Reciprocal Rank Fusion:

flowchart LR
    D[PDF · MD · TXT] --> C[chunker<br/>paragraph-aware, page-tracked]
    C --> V[(Chroma<br/>nomic-embed-text)]
    C --> K[(BM25<br/>keyword index)]
    Q[question] --> V & K
    V & K --> F[RRF fusion]
    F --> A[grounded answer<br/>inline citations]

    style F stroke:#7ee787,stroke-width:2px
    style A stroke:#d2a8ff,stroke-width:2px
Loading

Quickstart

pip install -r requirements.txt
ollama pull nomic-embed-text     # embeddings
ollama pull llama3.1             # answers (or set GROQ_API_KEY)

# CLI
python cli.py ingest ./docs
python cli.py ask "What is the refund window for annual plans?"

# ...or the chat UI (upload files in the sidebar)
streamlit run app.py
┌ Answer ┐
Annual plans can be refunded within 30 days of purchase [1]; refunds are
returned to the original payment method within 5–7 business days [1][2].

[1] refund-policy.pdf — page 2
[2] billing-faq.md — page 4

Configuration

Variable Default Purpose
EMBED_MODEL nomic-embed-text Ollama embedding model
OLLAMA_MODEL llama3.1 Answer model (default provider)
GROQ_API_KEY Switch answering to Groq free tier

Design notes

  • Page-tracked chunking — chunks carry (source, page) from ingestion all the way into the final citation list; nothing is reconstructed after the fact
  • Refusal over hallucination — the system prompt forbids outside knowledge; "the documents don't cover this" is a valid, expected answer
  • Swappable stores — Chroma persists to .docmind/; the BM25 index is a pickle next to it. Both rebuild from scratch in one command.

Built by Ahmad Bukhari — AI & Automation Architect · agentic systems that run real businesses, not just demos

About

Chat with your documents, 100% locally — hybrid retrieval (Chroma vectors + BM25 keywords, RRF-fused) with page-level inline citations and refusal over hallucination. Ollama/Groq free, Streamlit chat UI + CLI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages