AI-powered Multi-Agent RAG system for intelligent document querying with fact verification
Querywise is a multi-agent Retrieval-Augmented Generation (RAG) system designed to help users query long, complex documents with accurate, fact-verified answers.
Unlike traditional chatbots like ChatGPT or DeepSeek, which may hallucinate responses or struggle with structured data, Querywise retrieves, verifies, and corrects answers before presenting them.
- ✅ Multi-Agent System – A Research Agent generates answers, while a Verification Agent fact-checks responses.
- ✅ Hybrid Retrieval – Combines BM25 and vector search for more relevant content discovery.
- ✅ Multi-Document Handling – Dynamically selects the most relevant document, even with multiple uploads.
- ✅ Scope Detection – Prevents hallucinations by rejecting irrelevant queries.
- ✅ Fact Verification – Ensures responses are grounded in the source material.
- ✅ Web Interface with Gradio – Simple document upload and Q&A experience.
- Users upload documents and ask a question.
- Querywise checks query relevance and determines if the question is within scope.
- If the query is irrelevant, Querywise rejects it instead of hallucinating an answer.
- Docling parses documents into a structured format (Markdown, JSON).
- LangChain & ChromaDB power hybrid retrieval (BM25 + vector embeddings).
- With multiple documents uploaded, Querywise still identifies the most relevant sections.
- The Research Agent generates a candidate answer.
- The Verification Agent cross-checks the response against source documents.
- If verification fails, a self-correction loop is triggered for refinement.
- If verified, the final answer is presented to the user.
- If out of scope, Querywise informs the user instead of fabricating.
| Feature | ChatGPT/DeepSeek ❌ | Querywise ✅ |
|---|---|---|
| Retrieves from uploaded documents | ❌ No | ✅ Yes |
| Handles multiple documents | ❌ No | ✅ Yes |
| Extracts structured data from PDFs | ❌ No | ✅ Yes |
| Prevents hallucinations | ❌ No | ✅ Yes |
| Fact-checks answers | ❌ No | ✅ Yes |
| Detects out-of-scope queries | ❌ No | ✅ Yes |
Querywise is built for enterprise-grade document intelligence, research, and compliance workflows.
# Clone the repository
git clone https://github.com/Kaleemullah-Younas/Querywise.git
cd Querywise
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env # Edit with your API keys
# Run the application
python app.pyCreate a .env file with the following variables:
OPENAI_API_KEY=your_openai_api_key
# Other optional configurations
- Start the application with
python app.py - Open your browser to
http://localhost:7860 - Upload one or more documents (PDF, DOCX, TXT supported)
- Ask questions about your documents
