Skip to content

Repository files navigation

DocuQuery — Chat with your PDF

Upload any PDF and ask questions. Get precise, context-grounded answers powered by a full RAG pipeline.

Demo

demo

About

DocuQuery implements a Retrieval-Augmented Generation (RAG) pipeline that enables semantic search over any PDF document. Instead of relying on LLM memorization, it retrieves the most relevant chunks from the document and grounds the answer strictly in the source content — eliminating hallucination.

Tech Stack

  • FastAPI — REST API backend
  • LangChain — RAG pipeline orchestration
  • FAISS — Vector similarity search
  • HuggingFace Embeddings (all-MiniLM-L6-v2) — Text embeddings
  • Groq API (LLaMA 3.3-70b-versatile) — Answer generation
  • Gradio — Frontend UI
  • PyMuPDF — PDF text extraction
  • Docker — Containerized deployment

How It Works

  • PDF is uploaded and text is extracted page by page
  • Text is split into 500-character chunks
  • Each chunk is embedded using sentence transformers and stored in a FAISS index
  • User question is embedded and matched against the index via similarity search
  • Top 3 relevant chunks are passed to the LLM with a strict context-only prompt
  • Answer is returned grounded in the document content

Two Architectures Available

1. Microservice — FastAPI backend + Gradio client (separate processes over HTTP)

Files: fastapi_backend.py + gradio_client_frontend.py

uvicorn fastapi_backend:app --reload
python gradio_client_frontend.py

2. Standalone — Gradio app calling the RAG pipeline directly (single process)

File: gradio_standalone_app.py

Used for Docker and HuggingFace Spaces deployment, since these platforms run a single process per container.

python gradio_standalone_app.py

Run Locally

git clone https://github.com/mohitkrishna21/docuquery.git
cd docuquery

Choose either architecture above to run.

## Run with Docker
```bash
docker build -t docuquery .
docker run -p 7860:7860 --env-file .env -v huggingface_cache:/root/.cache/huggingface docuquery

Visit http://localhost:7860

License

MIT pip install -r requirements.txt

Add your `GROQ_API_KEY` to a `.env` file:

About

rag, fastapi, langchain, faiss, groq, llm, gradio, python, ai-engineering

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages