How surajsuru/banking-rag-copilot works
Banking RAG Copilot lets employees ask banking-operations questions and receive answers grounded in retrieved knowledge-base chunks, with sources and grounding signals. The principal flow is Streamlit chat → FastAPI → RAG orchestration → access-filtered hybrid retrieval → prompt and LLM → citation/grounding results. Documents also pass through parsing, cleaning, chunking, embedding, and vector storage; evaluation is a separate product capability. The README documents API/UI, reranking, RBAC, and evaluation; unsampled wiring is shown only where documented, and uncertain links are omitted.
Main entry points: hybrid_search.py Hybrid search · ingestion/pipeline.py Ingestion pipeline · rag/pipeline.py RAG orchestrator · api.py REST API
Components 22
Knowledge Ingestion
- Ingestion pipeline
src/ingestion/pipeline.py - File discovery
src/ingestion/loader.py - Format parsers
src/ingestion/parser.py - Text cleaning
src/ingestion/cleaner.py - Document chunking
src/ingestion/chunker.py
Retrieval and Storage
- Embedding model
src/embeddings/embedder.py - Hybrid search
src/retrieval/hybrid_search.py - Vector search
src/retrieval/vector_search.py - BM25 search
src/retrieval/bm25_search.py - Cross-encoder reranker
src/retrieval/reranker.py - Chunk vector store
src/database/vector_store.py
Answer Generation
- RAG orchestrator
src/rag/pipeline.py - Prompt construction
src/generation/prompt.py - LLM client
src/generation/llm.py - Citations and grounding
src/rag/citations.py
Security and Evaluation
- Role access rules
src/security/access_control.py - RAG evaluation
src/evaluation
Other components
- Bank employee
- PostgreSQL pgvector
- Groq inference
Connections 25
- Bank employee → Chat UI: asks question
- Chat UI → REST API: POSTs question
- REST API → RAG orchestrator: invokes
- RAG orchestrator → Hybrid search: retrieves chunks
- Hybrid search → Vector search: runs semantic search
- Hybrid search → BM25 search: runs keyword search
- Hybrid search → Cross-encoder reranker: reranks results
- Hybrid search → Role access rules: gets role permissions
- Vector search → Embedding model: embeds query
- Vector search → Chunk vector store: searches vectors
- Chunk vector store → PostgreSQL pgvector: queries
- Hybrid search → PostgreSQL pgvector: loads BM25 chunks
- Ingestion pipeline → File discovery: discovers files
- Ingestion pipeline → Format parsers: parses files
- Ingestion pipeline → Text cleaning: cleans text
- Ingestion pipeline → Document chunking: creates chunks
- Ingestion pipeline → Embedding model: embeds chunks
- Ingestion pipeline → Chunk vector store: stores chunks
- RAG orchestrator → Prompt construction: builds prompt
- RAG orchestrator → LLM client: generates answer
- LLM client → Groq inference: requests completion
- RAG orchestrator → Citations and grounding: checks answer
- RAG orchestrator → REST API: returns answer and sources
- REST API → Chat UI: returns response
- RAG evaluation → Hybrid search: benchmarks retrieval