Skip to content

Latest commit

Β 

History

History
178 lines (131 loc) Β· 5.31 KB

File metadata and controls

178 lines (131 loc) Β· 5.31 KB

Agentic-RAG Chatbot

An advanced agentic Retrieval-Augmented Generation (RAG) chatbot system with modular backend and frontend architecture.
This system integrates vector storage, session tracking, UI components, and multi-stage agent orchestration to generate intelligent, context-aware responses from external dataset sources.


πŸ“ Project Structure

agentic-chatbot/ β”‚ β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ main.py # FastAPI backend entry point β”‚ β”œβ”€β”€ agent.py # Agent orchestration, tools, retrieval and reasoning logic β”‚ β”œβ”€β”€ config.py # Backend configuration, environment variables, paths β”‚ β”œβ”€β”€ vectorstore.py # Vector DB handling: embeddings, retrieval, storage β”‚ β”œβ”€β”€ pycache/ # Compiled python cache files β”‚ └── ... # Additional backend utilities (if added later) β”‚ β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ app.py # Frontend UI application launcher β”‚ β”œβ”€β”€ backend_api.py # Functions to communicate with backend FastAPI API β”‚ β”œβ”€β”€ config.py # Frontend settings, constants, URLs β”‚ β”œβ”€β”€ session_manager.py # Conversation/session state handling β”‚ β”œβ”€β”€ ui_components.py # UI layout, rendering and interaction components β”‚ β”œβ”€β”€ requirements.txt # Dependencies for frontend environment β”‚ └── pycache/ # Cached python files β”‚ β”œβ”€β”€ .env # Environment variables (keys, config) β”œβ”€β”€ .gitignore # Files/folders ignored by Git β”œβ”€β”€ .python-version # Python version lockfile β”œβ”€β”€ pyproject.toml # Project metadata and configurations β”œβ”€β”€ requirements.txt # Global requirements (if used) └── README.md # Documentation

yaml Copy code


🧠 Project Overview

This project implements an intelligent, multi-agent RAG chatbot system where:

  • The backend handles embeddings, storage, retrieval, and reasoning.
  • The frontend provides an interactive UI with session-awareness and streamlined communication.
  • A structured agent pipeline enhances accuracy, reliability, and contextual depth.

Key capabilities:

  • Document ingestion and vector storage
  • Retrieval-Augmented Generation (RAG)
  • Multi-agent orchestration (retrieve β†’ evaluate β†’ generate)
  • Persistent sessions and context flow
  • Clean frontend-backend separation

βš™οΈ Backend Description

The backend uses FastAPI to expose endpoints for querying, extraction, and agent-driven reasoning.

Backend components:

File Description
main.py Defines API routes, runs FastAPI server, orchestrates request handling.
agent.py Core agent logic: retrieval, reasoning, chain-of-actions, tool usage.
vectorstore.py Handles embeddings, similarity search, persistent Chroma/other vector DB logic.
config.py Stores backend constants, environment variables, paths, model references.

πŸ–₯️ Frontend Description

The frontend provides a Python-based UI layer (Streamlit or custom UI via app.py).

Frontend components:

File Description
app.py Entry point to run the frontend UI interface.
backend_api.py Wrapper for backend API calls (query, ingest, retrieval).
session_manager.py Stores and updates user sessions, chat history, context flow.
ui_components.py Contains UI building blocks, rendering logic, interaction elements.
config.py Frontend-specific configuration (API URL, constants).
requirements.txt Dependencies required to run frontend.

πŸ”§ Installation & Setup

βœ… Clone the repository

git clone https://github.com/your-username/agentic-chatbot.git
cd agentic-chatbot
βœ… Backend Setup
bash
Copy code
cd backend
python -m venv venv
source venv/bin/activate       # For Linux/Mac
venv\Scripts\activate          # For Windows

pip install -r ../requirements.txt
Start backend:

bash
Copy code
uvicorn main:app --reload --port 8000
βœ… Frontend Setup
bash
Copy code
cd frontend
python -m venv venv
source venv/bin/activate       # Linux/Mac
venv\Scripts\activate          # Windows

pip install -r requirements.txt
Launch the frontend UI:

bash
Copy code
python app.py
🧩 How the System Works
pgsql
Copy code
User Input β†’ Frontend UI β†’ backend_api.py β†’ FastAPI Backend
                         ↓
                Backend Agent (agent.py)
                         ↓
                Vectorstore Retrieval
                         ↓
                LLM Response Generation
                         ↓
                 Back to Frontend UI
Steps summary:

User types a query.

Frontend sends query to backend using backend_api.

Backend agent calls vectorstore for relevant chunks.

Agent synthesizes retrieved context.

Final answer generated and sent back.

UI displays formatted output.

✨ Features
βœ… Retrieval-Augmented Generation

βœ… Multi-agent reasoning pipeline

βœ… Persistent vector database

βœ… Session-aware conversations

βœ… Modular architecture

βœ… Extensible design for adding new tools/agents

πŸš€ Future Enhancements
Docker deployment (backend + frontend)

UI improvements

Adding multiple data ingestion formats

Authentication and user management

Streaming responses

πŸ‘¨β€πŸ’» Author
Krishiv Arora
GitHub: https://github.com/Krishiv1611