Production-grade Retrieval-Augmented Generation (RAG) system for banking document intelligence.
ArgusLens is a domain-specific RAG pipeline built for banking document Q&A. It answers queries about loan eligibility, interest rates, foreclosure charges, repayment terms, and required documents — with source traceability on every response.
Key differentiators over naive RAG:
- Two-stage retrieval — BM25 sparse search + FAISS dense search fused via Reciprocal Rank Fusion, followed by BGE cross-encoder reranking
- Query-type router — deterministic rule extraction for structured queries (eligibility checks, max amounts), LLM generation for open-ended questions
- Multi-turn memory — query condensation converts follow-up questions into standalone queries before retrieval
- Source attribution — every response cites document name and page/row number
User Query
│
▼
┌─────────────────────────────┐
│ Query Router │
│ (regex intent classifier) │
└────────────┬────────────────┘
│
┌─────────┴──────────┐
│ │
▼ ▼
Deterministic LLM Path
Rule Extraction │
(eligibility, │ Query Condensation
max amount) │ (follow-up → standalone)
│
▼
┌────────────────────┐
│ Stage 1: Hybrid │
│ BM25 + FAISS │
│ (RRF fusion) │
└────────┬───────────┘
│
▼
┌────────────────────┐
│ Stage 2: Rerank │
│ BGE Cross-Encoder │
└────────┬───────────┘
│
▼
┌────────────────────┐
│ Gemini 3.1 Flash │
│ LCEL Chain + │
│ Chat Memory │
└────────┬───────────┘
│
▼
Answer + Sources
| Component | Technology |
|---|---|
| LLM | Google Gemini 3.1 Flash Lite (via LangChain) |
| Orchestration | LangChain 0.3 · LCEL |
| Dense Retrieval | FAISS + BAAI/bge-base-en-v1.5 embeddings |
| Sparse Retrieval | BM25 (rank-bm25) |
| Fusion | Reciprocal Rank Fusion (EnsembleRetriever) |
| Reranking | BAAI/bge-reranker-base (CrossEncoderReranker) |
| Evaluation | RAGAs (faithfulness, answer relevancy, context precision) |
| UI | Streamlit |
| Domain | Banking (loans, eligibility, interest rates, documents) |
ArgusLens/
├── app.py # Streamlit UI — chat interface, routing, source attribution
├── retriever.py # Two-stage hybrid retriever (BM25+FAISS+RRF+BGE reranker)
├── query_router.py # Query intent classifier + deterministic rule extraction
├── ingest.py # Document loaders and chunking (PDF, TXT, CSV)
├── embed_store.py # Builds and saves FAISS vector index
├── eval_ragas.py # RAGAs evaluation harness (10 curated test cases)
├── requirements.txt # Pinned dependencies
├── data/
│ ├── Documents_Required.txt # Loan document checklists
│ ├── interest_rates.csv # Loan interest rate table
│ ├── loan_eligibility.csv # Eligibility thresholds by loan type
│ └── loan_policies.txt # Repayment terms, fees, and penalties
└── vector_store/ # FAISS index (built locally, not committed)
# 1. Clone the repo
git clone https://github.com/R-Sreenivas-Raju/ArgusLens.git
cd ArgusLens
# 2. Install dependencies
pip install -r requirements.txt
# 3. Add your Gemini API key
echo "GEMINI_API_KEY=your_key_here" > .env
# 4. Build the vector store
python embed_store.py
# 5. Launch the app
streamlit run app.pyGet a free Gemini API key at aistudio.google.com.
RAGAs metrics on 3 curated banking Q&A pairs:
| Metric | Score |
|---|---|
| Faithfulness | 1.0000 |
| Answer Relevancy | 0.0000 (Gemini API Candidate Limit) |
| Context Precision | 1.0000 |
Run python eval_ragas.py to generate the full evaluation report.
| Query Type | Example | Route |
|---|---|---|
| Eligibility check | "I have income 45000 and credit score 680. Can I get a home loan?" | Deterministic |
| Max amount | "What is the maximum amount for a personal loan?" | Deterministic |
| Policy question | "What are the foreclosure charges on an auto loan?" | Gemini RAG |
| Multi-turn | "What about for education loans?" (follow-up) | Gemini RAG + Memory |
| Document retrieval | "What documents do I need for an education loan?" | Gemini RAG |
R. Sreenivas Raju