Skip to content

codewithyasho/AGENTIC_RAG_PIPELINE

Repository files navigation

🤖 Agentic RAG Assistant (Text + Voice + Internet)

A full Agentic RAG system built with LangChain, FAISS, Streamlit, and voice support, capable of:

  • 📄 Answering from private documents (RAG)
  • 🌐 Accessing the live internet (web search)
  • 🧠 Making intelligent decisions using an AI agent
  • 🎤 Supporting voice-to-voice and text-to-text interaction

This is not a basic RAG — it's an Agentic RAG pipeline.


✨ Key Features

🤖 Agentic RAG

LLM decides when to use:

  • Private documents (FAISS)
  • Live web search
  • Tools (calculator, APIs)
  • Direct reasoning

🌐 Live Internet Access

  • Overcomes outdated knowledge problem
  • Uses Google Serper for real-time search

📚 Private Knowledge Base

  • FAISS vector store
  • HuggingFace embeddings
  • Document-grounded answers

🎤 Voice Support

  • Speech-to-text (Whisper via Groq)
  • Text-to-speech (Edge TTS)
  • Real-time voice conversations

🖥️ Streamlit UI

  • Clean chat interface
  • Text & voice mode toggle
  • Chat history display

🧠 High-Level Architecture

User (Text / Voice)
        ↓
Speech-to-Text (if voice)
        ↓
AI Agent (Decision Maker)
        ↓
┌───────────────────────────────────┐
│ Tools                              │
│  • document_search (RAG / FAISS)   │
│  • web_search (Internet)           │
│  • calculator / APIs               │
└───────────────────────────────────┘
        ↓
Final Answer
        ↓
Text-to-Speech (if voice)
        ↓
User

📁 Project Structure

AGENTIC_RAG/
│
├── app.py                    # Streamlit app (UI + Voice)
│
├── agent/
│   ├── __init__.py
│   ├── agent.py              # Agent (brain)
│   ├── test_agent.py         # CLI test
│   └── tools/
│       ├── __init__.py
│       ├── rag_tool.py       # RAG as a tool
│       ├── web_tool.py       # Web search tool
│       └── misc_tools.py     # Calculator etc.
│
├── src/
│   ├── embedding.py          # HuggingFace embeddings
│   ├── vectorstore.py        # FAISS loader
│   └── chain.py              # RAG chain creation
│
├── faiss_index/              # Vector database
├── .env                      # API keys
├── requirements.txt
└── README.md

⚙️ Setup Instructions

1️⃣ Python Version (IMPORTANT)

Use Python 3.11
❌ Python 3.14 is NOT supported by LangChain yet.

python --version
# Python 3.11.x

2️⃣ Create Virtual Environment

python -m venv .venv
.venv\Scripts\activate   # Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Environment Variables

Create a .env file:

GROQ_API_KEY=your_groq_key
SERPER_API_KEY=your_google_serper_key
WEATHER_API_KEY=optional
CURRENCY_API_KEY=optional

▶️ Running the Application

🔹 Test Agent (CLI)

python -m agent.test_agent

Example queries:

  • "What does my document say about transformers?"
  • "Who won yesterday's match?"
  • "(12 + 8) * 3"

🔹 Run Streamlit App (UI + Voice)

streamlit run app.py

🧪 How the Agent Decides

User Query Tool Used
"What does my PDF say about X?" 📄 RAG
"Latest news about AI" 🌐 Web Search
"25 * (4 + 6)" 🧮 Calculator
"Explain PCA" 🧠 Direct LLM

The agent does NOT blindly run RAG.


🎤 Voice Pipeline

Voice Input
 → Speech-to-Text (Whisper)
 → Agentic RAG
 → Text Answer
 → Text-to-Speech (Edge TTS)
 → Audio Output

Voice is just an interface, not logic.


🚀 Why This Project Is Special

Real Agentic RAG, not hardcoded logic
Solves outdated knowledge problem
Clean separation of concerns
Production-style architecture
Portfolio & interview ready


🛣️ Future Enhancements

  • 🔖 Source citations (RAG vs Web)
  • 🧠 Memory summarization
  • ⚡ Streaming responses + partial TTS
  • 🔐 Rate limiting & security
  • 🌍 Multi-language voice support

🧑‍💻 Author

Yashodeep
Computer Science Student | Data Scientist | AI Engineer
Built with ❤️ and a lot of debugging 😄


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages