amanav050/sbi-mf-rag-chatbot
SBI MF RAG Chatbot
A production-ready, facts-only RAG chatbot for SBI Mutual Fund schemes. Provides cited, factual answers from official SBI MF documents.
SBI MF RAG Chatbot
A production-ready, facts-only RAG (Retrieval-Augmented Generation) chatbot that answers queries about SBI Mutual Fund schemes using only official public sources.
๐ฏ Overview
This chatbot provides factual information about SBI Mutual Fund schemes through a sophisticated RAG pipeline that:
- Scrapes official SBI MF web pages and documents
- Processes content through chunking and embedding
- Stores vectors in Chroma Cloud for fast retrieval
- Generates responses using Groq's Llama 3.1 model
- Always cites sources and provides no investment advice
๐ Selected AMC & Schemes
AMC: SBI Mutual Fund (sbimf.com)
Schemes Covered:
- SBI Large Cap Fund
- SBI Flexicap Fund
- SBI ELSS Tax Saver Fund
- SBI Small Cap Fund
๐๏ธ Architecture Overview
The system follows a complete RAG pipeline:
scrape โ chunk โ embed โ store โ retrieve โ LLM โ cite- Scraping: Daily automated scraping of scheme pages and FAQs from sbimf.com
- Chunking: Text is broken into 512-character overlapping chunks
- Embedding: Local bge-small-en-v1.5 model creates 384-dimensional vectors
- Storage: Vectors stored in Chroma Cloud for similarity search
- Retrieval: Query embedding finds top 5 most relevant chunks
- LLM: Groq's Llama 3.1 generates factual responses
- Citation: All responses include source URLs and last updated dates
๐ ๏ธ Tech Stack
๐ Setup Instructions
Prerequisites
- Python 3.11+
- Valid API keys for Chroma Cloud and Groq
Installation
- Clone the repository
git clone <repository-url>
cd "RAG ChatBOT"- Install dependencies
pip install -r requirements.txt- Add API keys to .env
# Create .env file with:
CHROMA_API_KEY=your_chroma_api_key_here
CHROMA_TENANT=f0d857c0-c00b-4742-bf30-d9a10400d176
CHROMA_DATABASE=sbi_mf_rag
GROQ_API_KEY=your_groq_api_key_here- Run initial data ingestion
# Ingest HTML sources (daily)
python ingestion/router.py --mode dynamic
# Ingest PDF sources (one-time)
python ingestion/router.py --mode static
# Run chunking
python ingestion/phase_3_chunker/chunker.py
# Run embedding
python ingestion/phase_4_embedder/embedder.py
# Store in vector database
python ingestion/phase_5_vector_db/vector_db.py- Start the server
python -m api.phase_10_fastapi.main- Open the UI Navigate to http://127.0.0.1:8000 in your browser
โ ๏ธ Disclaimer
Facts-only. No investment advice. This chatbot provides factual information sourced from official SBI Mutual Fund documents and web pages. It does not provide investment recommendations, financial advice, or opinions. Always consult with a qualified financial advisor before making investment decisions.
๐ซ Known Limitations
- Source-dependent: Only answers questions based on scraped SBI MF content
- No real-time data: NAV values and performance data are only as current as the last scrape
- English only: Supports queries in English language only
- Factual responses: Cannot provide opinions, predictions, or investment advice
- Rate limited: API is rate-limited to 10 requests per minute per IP
- Static PDFs: PDF documents require manual re-ingestion for updates
๐ Project Structure
sbi-mf-rag-chatbot/
โโโ docs/ # Architecture documentation
โโโ corpus/ # Source URLs and metadata
โโโ ingestion/ # Data processing pipeline
โโโ query/ # Query processing components
โโโ api/ # FastAPI server
โโโ ui/ # Web interface
โโโ scheduler/ # GitHub Actions workflows
โโโ phase_results/ # Implementation results๐ง Maintenance
- Daily ingestion: Automatically runs via GitHub Actions at 9:15 AM IST
- Manual PDF updates: Trigger manual workflow when new PDFs are available
- Monitoring: Check GitHub Actions logs for ingestion status
- API usage: Monitor Groq API usage to avoid rate limits
๐ Support
For issues related to:
- Content accuracy: Visit https://www.sbimf.com
- Technical issues: Check GitHub Issues or create a new one
- API keys: Ensure valid keys in .env file
Version: 1.0.0 Last Updated: 2026-04-15
