Skip to content

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...

Notifications You must be signed in to change notification settings

Kaleemullah-Younas/Querywise

Repository files navigation

QUERYWISE

Python Gradio LangChain LangGraph Docling ChromaDB

AI-powered Multi-Agent RAG system for intelligent document querying with fact verification


Overview

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.

Key Features

  • 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.

How Querywise Works

System Architecture

Architecture Diagram

1️⃣ Query Processing & Scope Analysis

  • 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.

2️⃣ Multi-Agent Research & Retrieval

  • 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.

3️⃣ Answer Generation & Verification

  • 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.

4️⃣ Response Finalization

  • If verified, the final answer is presented to the user.
  • If out of scope, Querywise informs the user instead of fabricating.

Why QUERYWISE Instead of ChatGPT or DeepSeek?

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.


Installation

Quick Start

# 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.py

Environment Configuration

Create a .env file with the following variables:

OPENAI_API_KEY=your_openai_api_key
# Other optional configurations

Usage

  1. Start the application with python app.py
  2. Open your browser to http://localhost:7860
  3. Upload one or more documents (PDF, DOCX, TXT supported)
  4. Ask questions about your documents

About

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...

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published