Skip to content

kathir-IL80085/DocuMind

Repository files navigation

DocuMind

An open source document intelligence API. Upload any PDF and ask questions — DocuMind finds the most relevant information, reranks it for accuracy, and returns a cited answer with source page numbers.

Real world use cases

  • Law firm uploads contracts → asks "what are the termination clauses?"
  • Student uploads textbook → asks "explain Newton's third law"
  • Company uploads HR policy → employees ask questions about leave rules

Architecture

PDF → pdfplumber (load + chunk) → HuggingFace embeddings → Qdrant vector store → Cohere reranking → Groq LLaMA 3.3 → answer + citations

Tech Stack

  • Python, FastAPI
  • LangChain — LLM application framework
  • Qdrant — vector database (local, no Docker needed)
  • HuggingFace — free local embeddings (all-MiniLM-L6-v2)
  • Cohere Rerank — improves retrieval accuracy
  • Groq API — free, fast LLM inference (LLaMA 3.3 70B)

Why this stack

  • Qdrant over ChromaDB => production-grade, better performance
  • Cohere reranking => separates basic RAG from accurate RAG
  • HuggingFace embeddings => free, no API cost, runs locally

API Endpoints

  • GET /health — health check
  • POST /upload — upload a PDF and process it
  • POST /query — ask a question, get answer + sources

How to Run

  1. Clone the repo
  2. Create virtual environment: python -m venv venv
  3. Activate: venv\Scripts\activate
  4. Install: pip install -r requirements.txt
  5. Copy .env.example to .env and add your API keys
  6. Run: uvicorn api:app
  7. Open http://127.0.0.1:8000/docs to test

API Keys Required (all free)

  • GROQ_API_KEY — console.groq.com
  • GOOGLE_API_KEY — aistudio.google.com
  • COHERE_API_KEY — dashboard.cohere.com

Known Limitations

  • Scanned/image PDFs not supported (no OCR)
  • Table extraction is basic (complex tables may lose structure)
  • No hybrid search (vector + keyword) — planned improvement
  • Single user only - concurrent access requires Qdrant server mode

About

Production-aware RAG pipeline using LangChain, Qdrant, Cohere reranking, HuggingFace embeddings and FastAPI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages