The problem
Questions do not always use the same wording as the documents that answer them. A retrieval-backed assistant also needs to preserve conversation context and show where an answer came from, whether the question arrives through a website or WhatsApp.
My contribution
I built an omnichannel RAG chatbot with website and WhatsApp interfaces. The public repository version uses FastAPI, Qdrant, BGE embeddings, Llama 3.2 and PostgreSQL.
Its retrieval pipeline combines dense and BM25 search, reciprocal rank fusion and cross-encoder reranking, alongside deduplication, source attribution and session persistence.
Engineering choices
The retrieval design separates finding candidates from choosing context. Dense search can match semantic relationships; BM25 can preserve exact terms. Reciprocal rank fusion combines their ranked results without requiring the two search methods to share a score scale.
A cross-encoder then scores query-document pairs to refine the candidate ordering. The design prioritizes recall first, precision second: gather plausible evidence, then narrow it before generation.
- WhatsApp message deduplication prevents repeated responses when a webhook is retried.
- Source attribution connects generated answers to supporting material for review.
- PostgreSQL-backed session persistence stores conversational context beyond an individual request.
Proposed next step
Build an evaluation set covering exact-term queries, paraphrases and unanswerable questions. Compare retrieval stages and check whether cited sources support each answer.