Multi-Agent RAG Chatbot

Multi-Agent RAG Chatbot

Project Overview

The Multi-Agent RAG Chatbot is a sophisticated Retrieval-Augmented Generation system that uses multiple specialized agents to ensure high-quality, factual responses. This advanced system combines local knowledge retrieval with web search capabilities and implements a robust evaluation pipeline to detect and correct hallucinations, setting a new standard for trustworthy AI-powered question answering.

Key Features

  • Multi-Agent Architecture: Each component of the RAG pipeline is handled by a specialized agent with distinct responsibilities
  • Local Knowledge Base: Efficient retrieval from your own document collections using vector similarity search
  • Web Search Fallback: Automatically searches the web when local knowledge is insufficient
  • Multi-Stage Quality Evaluation: Multiple evaluation agents ensure high-quality responses at each step
  • Hallucination Detection: Dedicated agent identifies and corrects factual inaccuracies by cross-referencing source documents
  • RESTful API Interface: FastAPI-based interface for easy integration with other applications
  • Interactive Web Interface: Streamlit-powered chat interface for real-time conversations

Technical Architecture

Specialized Agents

The system implements seven specialized agents, each optimized for specific tasks:

  • Dialogue Manager Agent: Analyzes user queries and determines information needs
  • Retriever Agent: Performs vector similarity search using ChromaDB and mxbai-embed-large embeddings
  • Retrieval Evaluator Agent: Assesses quality and relevance of retrieved documents
  • Answer Generator Agent: Creates initial responses based on retrieved context
  • Answer Evaluator Agent: Evaluates answer completeness and logical consistency
  • Hallucination Checker Agent: Identifies unsupported claims and factual inaccuracies
  • Final Answer Agent: Refines responses based on all evaluation feedback

Technology Stack

  • LLM: DeepSeek-R1 for high-quality reasoning and text generation
  • Embeddings: mxbai-embed-large for semantic vector search
  • Vector Database: ChromaDB for persistent document storage and retrieval
  • LLM Framework: LangChain with Ollama integration for local model serving
  • Web Search: DuckDuckGo Search API for external knowledge retrieval
  • API Framework: FastAPI for RESTful web services
  • Frontend: Streamlit for interactive chat interface
  • Python Libraries: sentence-transformers, pydantic, uvicorn

System Workflow

Query Analysis

Dialogue Manager analyzes user queries to understand information needs and detect potential ambiguities.

Knowledge Retrieval

Retriever Agent searches vector database while Retrieval Evaluator assesses document quality and relevance.

Web Search Integration

When local knowledge is insufficient, the system automatically performs web searches for additional context.

Multi-Layer Validation

Answer generation, quality evaluation, and hallucination detection work together to ensure accurate responses.

Performance & Innovation

This project demonstrates advanced capabilities in:

  • Agentic AI Systems: Coordinating multiple specialized AI agents for complex tasks
  • RAG Optimization: Implementing multi-stage evaluation to improve retrieval and generation quality
  • Hallucination Mitigation: Novel approach to detecting and correcting AI-generated inaccuracies
  • Scalable Architecture: Modular design allows for easy maintenance and feature additions
  • Local LLM Integration: Efficient use of Ollama for privacy-preserving, local AI inference

Application Screenshots

RAG Chatbot Interface

Multi-agent evaluation pipeline showing quality assessment and response refinement

Use Cases & Applications

  • Enterprise knowledge management and documentation systems
  • Research assistance with source verification requirements
  • Customer support systems requiring high accuracy
  • Educational platforms with factual content verification
  • Technical documentation and troubleshooting assistants