Upload any PDF and ask questions. Get precise, context-grounded answers powered by a full RAG pipeline.
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.
- 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
- 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
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.py2. 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.pygit 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 docuqueryVisit http://localhost:7860
MIT pip install -r requirements.txt
Add your `GROQ_API_KEY` to a `.env` file:
