A Retrieval-Augmented Generation (RAG) chatbot that answers customer questions about banking products, policies, and services using internal bank documents as the knowledge source.
Banks receive thousands of repetitive customer inquiries daily about interest rates, account types, fees, and regulations. This RAG chatbot retrieves relevant information from internal bank documents and generates accurate, sourced answers — reducing call center load while ensuring compliance-safe responses.
- Document Ingestion: Processes PDF, DOCX, and TXT banking documents
- Semantic Search: ChromaDB vector store with sentence-transformer embeddings
- Grounded Answers: Every response includes source document references
- Hallucination Guard: Built-in checks to prevent fabricated information
- Multi-Turn Chat: Maintains conversation context for follow-up questions
- Turkish Language Support: Optimized for Turkish banking terminology
- REST API: FastAPI endpoint for integration with banking channels
Customer Query
│
▼
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Query │────▶│ Vector │────▶│ LLM │
│ Processing │ │ Search │ │ Generation │
│ (Embedding)│ │ (ChromaDB) │ │ (Context + │
│ │ │ Top-K Docs │ │ Sources) │
└─────────────┘ └──────────────┘ └─────────────┘
│
▼
Grounded Answer
with Sources
banking-chatbot-rag/
├── data/
│ └── sample_docs/ # Sample banking documents
│ ├── account_types.txt
│ ├── credit_policies.txt
│ ├── fee_schedule.txt
│ └── faq.txt
├── src/
│ ├── __init__.py # Package init
│ ├── ingest.py # Document loader & chunker
│ ├── retriever.py # Vector store & semantic search
│ ├── chatbot.py # Main chatbot orchestrator
│ ├── guardrails.py # Hallucination prevention & compliance
│ └── api.py # FastAPI chat endpoint
├── tests/
│ └── test_pipeline.py # Pipeline integration tests
├── docs/
├── requirements.txt
├── Dockerfile
└── README.md
git clone https://github.com/metehanulusoy/banking-chatbot-rag.git
cd banking-chatbot-rag
pip install -r requirements.txtpython src/ingest.py --docs-dir data/sample_docsexport OPENAI_API_KEY=your_key # or use local model
uvicorn src.api:app --reloadcurl -X POST http://localhost:8000/chat \
-H "Content-Type: application/json" \
-d '{"message": "Vadesiz hesap açmak için ne gerekiyor?", "session_id": "user_123"}'Response:
{
"answer": "Vadesiz hesap açmak için kimlik belgesi (TC kimlik kartı veya pasaport) ve adınıza kayıtlı bir telefon numarası yeterlidir. 18 yaş üstü tüm Türkiye Cumhuriyeti vatandaşları herhangi bir şubeye gelerek veya mobil uygulama üzerinden vadesiz hesap açabilir. Hesap açılışında herhangi bir ücret alınmamaktadır.",
"sources": [
{"document": "account_types.txt", "chunk": "Vadesiz Mevduat Hesabı", "relevance": 0.94},
{"document": "fee_schedule.txt", "chunk": "Hesap Açılış Ücretleri", "relevance": 0.87}
],
"confidence": 0.91,
"session_id": "user_123"
}- Account opening requirements and types
- Interest rates and deposit conditions
- Fee schedules and commissions
- Credit card features and limits
- Loan application requirements
- SWIFT/EFT/Havale procedures
- ATM and branch information
- Digital banking features
The chatbot implements several safety measures for banking compliance:
- Source Grounding: Only answers using retrieved documents, never invents information
- Confidence Scoring: Returns confidence level; low-confidence answers trigger "Please contact a representative"
- Scope Detection: Detects out-of-scope questions (investment advice, legal matters) and redirects
- PII Protection: Does not store or reveal customer personal information
- Regulatory Compliance: Adds disclaimers for interest rate and fee information
- LLM: OpenAI GPT-4 / Local (Ollama) compatible
- Embeddings: sentence-transformers (multilingual)
- Vector Store: ChromaDB
- Framework: LangChain
- API: FastAPI
- Document Processing: PyPDF2, python-docx
MIT License
Metehan Ulusoy - Computer Engineering Student
- GitHub: @metehanulusoy