Adaptive RAG

Corrective Retrieval-Augmented Generation  ·  Agentic AI  ·  LangGraph

Adaptive RAG Pipeline
Adaptive RAG LangGraph Flow

Project Info

  • Domain: GenAI / Agentic AI / RAG
  • Stack: Python, LangGraph, Claude API, ChromaDB, Tavily, FastAPI, Streamlit
  • GitHub: View Repository

The Problem

Standard RAG pipelines blindly pass whatever they retrieve to the LLM. When knowledge bases are stale, incomplete, or queries are out-of-distribution, models either hallucinate confidently or give non-answers — with no mechanism to detect the failure.

What I Built

  • Designed a self-correcting retrieval loop using LangGraph StateGraph: an LLM judge (Claude Haiku) scores each retrieved document 0.0–1.0 in parallel, and routes to live Tavily web search when average relevance falls below 0.6
  • Implemented the CRAG decompose-and-recompose technique — strips noise from mixed-source context by filtering to only query-relevant sentences before final generation with Claude Sonnet
  • Exposed the full pipeline via a FastAPI REST API and an interactive Streamlit dashboard with live pipeline visualization and source attribution

Impact

Eliminates confident hallucinations by generating answers only from verified, high-relevance context — with automatic live fallback and full source attribution on every response.