CoolFace
Apppublic

akashh0210/mutual-funds-api

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

SBI Mutual Fund — Facts-Only RAG FAQ Assistant

Product context: Groww (UX reference) AMC: SBI Mutual Fund Schemes: SBI Large Cap · SBI Flexicap · SBI ELSS Tax Saver · SBI Equity Hybrid


Project Status

PhaseDescriptionStatus
1Scope Freeze — URL Manifest✅ Complete
2Ingestion — Scheduler + Scraping Service✅ Complete
3Knowledge — Chunking + Embedding + Fact Cards✅ Complete
4Classification — Query Router + Refusal Engine✅ Complete
5Retrieval — Hybrid Search + Citation Selector✅ Complete
6Formatting — Answer Composer + One-Link Contract✅ Complete
7API — FastAPI Backend + Multi-Thread Support✅ Complete
8UI — Groww-Style Minimal Chat Interface✅ Complete
9QA — Evaluation + Refusal Testing + Citation Validation✅ Complete
10Deployment — Vercel + Hugging Face Spaces✅ Complete

Tech Stack

Frontend

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • Styling: Vanilla CSS (Groww-inspired Design System)
  • Deployment: Vercel

Backend

  • Framework: FastAPI (Python 3.11)
  • Deployment: Hugging Face Spaces (Docker SDK) / 16GB RAM
  • Infrastructure: Docker

RAG & AI

  • LLM: Groq (Llama 3.3 70B)
  • Embeddings: BAAI/bge-base-en-v1.5 (768-dim)
  • Vector DB: Chroma Cloud (Persistent)
  • Session DB: SQLite (Thread-based state)

Data & Automation

  • Extraction: Playwright (Headless Chromium)
  • Ingestion: Custom Python Pipeline
  • Orchestration: GitHub Actions (Daily Refresh)

Folder Structure

M 2/
├── .github/
│   └── workflows/
│       └── daily-corpus-refresh.yml   ← GitHub Actions scheduler (09:15 AM IST)
├── corpus/
│   └── source-manifest.md             ← Phase 1: validated 20-URL manifest
├── config/
│   ├── __init__.py
│   └── url_manifest.py                ← 20 URLs with priority and fetch method
├── pipeline/
│   ├── __init__.py
│   ├── models.py                      ← SQLite / PostgreSQL schema and helpers
│   ├── pii_guard.py                   ← PII detection + redaction
│   ├── scrape.py                      ← Phase 2: scraping service ✅
│   ├── chunk.py                       ← Phase 3 stub
│   ├── embed.py                       ← Phase 3 stub
│   └── finalize.py                    ← Run finalization step
├── phases/
│   ├── phase-1-scope/
│   ├── phase-2-ingestion/
│   ├── phase-3-knowledge/
│   ├── phase-4-classification/
│   ├── phase-5-retrieval/
│   ├── phase-6-formatting/
│   ├── phase-7-api/
│   ├── phase-8-ui/
│   └── phase-9-qa/
├── docs/
│   ├── RAG-mutual-fund-faq-architecture.md
│   ├── chunking-embedding-architecture.md
│   └── ProblemStatement.md
├── data/                              ← runtime (gitignored)
│   ├── raw/                           ← cleaned text per URL
│   ├── logs/                          ← scrape run logs and summaries
│   └── rag.db                         ← SQLite DB (local dev)
└── requirements.txt

Quick Start (Local — Phase 2)

bash
# 1. Install dependencies
pip install -r requirements.txt
playwright install chromium

# 2. Run the scraping service
python -m pipeline.scrape

# 3. Inspect results
sqlite3 data/rag.db "SELECT source_id, status, http_status FROM source_documents;"

Constraints

  • Facts-only — no investment advice, no fund comparisons, no return calculations
  • Sources — only 7 allowed domains; no third-party blogs or aggregators
  • Privacy — never collect PAN, Aadhaar, account numbers, OTPs, email, or phone
  • Answer limit — max 3 sentences, exactly one source link per answer