CoolFace
Apppublic

amanav050/sbi-mf-rag-chatbot

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes
App README

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
  1. 1.Scraping: Daily automated scraping of scheme pages and FAQs from sbimf.com
  2. 2.Chunking: Text is broken into 512-character overlapping chunks
  3. 3.Embedding: Local bge-small-en-v1.5 model creates 384-dimensional vectors
  4. 4.Storage: Vectors stored in Chroma Cloud for similarity search
  5. 5.Retrieval: Query embedding finds top 5 most relevant chunks
  6. 6.LLM: Groq's Llama 3.1 generates factual responses
  7. 7.Citation: All responses include source URLs and last updated dates

๐Ÿ› ๏ธ Tech Stack

ComponentToolVersion
HTML Scrapingrequests + BeautifulSoup42.31.0 + 4.12.3
PDF IngestionPyMuPDF + pdfplumber1.24.1 + 0.11.0
ChunkingLangChain RecursiveCharacterTextSplitter0.1.20
Embeddingsentence-transformers bge-small-en-v1.52.7.0
Vector DBChroma Cloud0.5.0
SchedulerGitHub Actions CRON-
LLMGroq API - llama-3.1-8b-instant0.9.0
APIFastAPI + uvicorn0.111.0 + 0.30.1
UIPlain HTML + CSS + JS-
Rate Limitingslowapi0.1.9

๐Ÿš€ Setup Instructions

Prerequisites

  • โ€”Python 3.11+
  • โ€”Valid API keys for Chroma Cloud and Groq

Installation

  1. 1.Clone the repository
bash
   git clone <repository-url>
   cd "RAG ChatBOT"
  1. 1.Install dependencies
bash
   pip install -r requirements.txt
  1. 1.Add API keys to .env
bash
   # 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
  1. 1.Run initial data ingestion
bash
   # 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
  1. 1.Start the server
bash
   python -m api.phase_10_fastapi.main
  1. 1.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