Skip to content

git-pranavbabu/AgenticRAG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AgenticRAG: Adaptive & Self-Correcting RAG System

AgenticRAG is a sophisticated Retrieval-Augmented Generation (RAG) system built on LangGraph. It implements the latest "Agentic RAG" patterns, including Adaptive Routing and Corrective Self-Healing, ensuring high-accuracy answers by grading its own work.


🚀 Key Advanced Features

🔄 Adaptive Routing

The system doesn't assume all answers are in the vector store. It uses an LLM-powered router to decide whether a query should be served by the Local Vector Store (domain-specific knowledge) or Web Search (real-time/general info via Tavily).

🔎 Corrective Retrieval (Self-Grading)

Retrieved documents are automatically graded for relevance. If the system finds the retrieved data is insufficient or irrelevant:

  1. It transforms the query to better capture intent.
  2. It re-tries the retrieval or falls back to web search.

🛡️ Hallucination & Answer Grading

Before a response is shown to the user, CodeWeaver performs two critical checks:

  1. Hallucination Check: Is the answer supported only by the retrieved facts?
  2. Utility Check: Does the answer actually resolve the user's original question?

🛠️ Tech Stack

  • Orchestration: LangGraph
  • Vector Store: FAISS
  • Embeddings: HuggingFace (all-MiniLM-L6-v2)
  • LLM: Groq (Llama 3.3 70B)
  • Tools: Tavily Search API

📈 The Agentic Workflow

graph TD
    START --> Router[Router Node]
    Router -->|Local| Retrieve[Retrieve from VectorStore]
    Router -->|General| WebSearch[Web Search]
    Retrieve --> Grade[Grade Documents]
    Grade -->|Relevant| Generate[Generate Answer]
    Grade -->|Irrelevant| Transform[Transform Query]
    Transform --> Retrieve
    WebSearch --> Generate
    Generate --> Hallucination{Hallucination Check}
    Hallucination -->|Failed| Generate
    Hallucination -->|Passed| AnswerCheck{Answer Utility Check}
    AnswerCheck -->|Not Useful| Transform
    AnswerCheck -->|Useful| END
Loading

🚦 Getting Started

1. Requirements

  • Python 3.9+
  • Groq API Key
  • Tavily API Key

2. Installation

pip install -r requirements.txt

3. Ingestion

Create your vector index first:

python ingest.py

4. Usage

python AdaptiveCorrectiveAgenticRag.py

📂 Project Structure

  • AdaptiveCorrectiveAgenticRag.py: The main graph logic.
  • ingest.py: Data ingestion and vector store creation.
  • faiss_index/: Local vector database.
  • requirements.txt: Project dependencies.

Created as part of the LangGraph Learning Series - Tier 1 Showcase.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages