An intelligent, context-aware RAG (Retrieval-Augmented Generation) system built to dynamically handle complex institutional queries for Government Arts College Salem.
This repository is intentionally structured to showcase the evolution of an AI product from prototype to production:
-
mainbranch:
Contains the foundational Generative AI chatbot built with basic scraping and LLM generation. -
advanced-rag-pipelinebranch (Current):
The enterprise-grade upgrade. This branch introduces strict multi-stage routing, vector-based semantic caging, and mathematical hallucination prevention to make the bot production-ready.
-
Multi-Stage Micro-Bucket Routing:
Uses an LLM to dynamically route user queries into 5 strict semantic categories (e.g., Department, PO-PSO-CO, General) before retrieval. -
Deterministic Inverse Filtering:
Intelligently separates structural PDF documents (Syllabi/Course Outcomes) from Faculty Profiles without relying on standardized naming conventions. -
Optimized Token Payload:
Passes mathematically filtered, highly relevant chunk pools (approx. 7,500 tokens) to guarantee zero "Lost in the Middle" attention degradation. -
Strict Lexical Immunity:
Bypasses traditional Cross-Encoder reranker collapse by forcing structural list retention for department/course queries. -
LLM-as-a-Judge Evaluation:
Includes an automated production evaluation pipeline using the RAGAS framework, mathematically proving:- 100% Faithfulness
- 100% Answer Relevancy
across synthetic user testing.
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| Orchestration | LangChain Core |
| Embeddings | Mistral AI (mistral-embed) |
| Vector Database | ChromaDB |
| Generator LLM | Azure OpenAI (gpt-4o-mini) |
| Evaluation Engine | RAGAS & Pandas |
git clone https://github.com/Baskar-forever/college_chatbot.git
cd college_chatbot
git checkout advanced-rag-pipelinepython -m venv venv
venv\Scripts\Activate.ps1pip install -r requirements.txtCreate a .env file in the project root:
AZURE_OPENAI_API_KEY=your_azure_key
AZURE_OPENAI_ENDPOINT=your_azure_endpoint
AZURE_OPENAI_API_VERSION=2024-12-01-preview
MISTRAL_API_KEY=your_mistral_keystreamlit run app.pyTo validate the chatbot against hallucinations and context drop-off, run the automated RAGAS evaluation pipeline:
python production_eval.pyThis will:
- Process a synthetic batch of evaluation queries
- Grade responses using mathematical RAG metrics
- Export a detailed audit log as:
production_evaluation_results.csv
Since both the simple chatbot and enterprise RAG system exist in separate branches, switch between them using:
git checkout maingit checkout advanced-rag-pipelineYour local files will automatically update to match the selected branch.
This architecture is designed to solve the three major production RAG problems:
- Hallucination
- Context Collapse
- Retriever Noise
The system achieves this through deterministic retrieval control, semantic routing, and evaluation-driven validation.