Healthcare RAG Chatbot
A conversational assistant built to demonstrate that a language model can be constrained to a trusted body of knowledge. Every answer is generated from passages actually retrieved from the knowledge base, and the sources are shown alongside the response.
Project detail
- Type
- Personal Project
- Category
- AI Solutions
- Year
- 2025
- Technology
- PythonLangChainOpenAI APIVector DatabaseFastAPIStreamlitSentence Transformers
Language models answer health questions fluently and, often, incorrectly. In any domain where a wrong answer carries real consequences, fluency without grounding is a liability. The requirement was an assistant that could hold a natural conversation while remaining anchored to a reviewed knowledge base — and that would decline to answer rather than improvise when the knowledge base had nothing relevant.
Source documents are chunked with overlap, embedded and stored in a vector index. Each user question is embedded and used to retrieve candidate passages, which are re-ranked for relevance before the top passages are passed to the model as the sole permitted context. Multi-turn questions are rewritten into standalone queries first, so follow-ups like "what about for children?" retrieve correctly. When retrieval confidence falls below threshold, the assistant says it doesn't know and recommends speaking to a professional instead of generating an answer.
What the system does
Grounded answers with citations
Responses are generated only from retrieved passages, with sources surfaced so any claim can be checked.
Context-aware conversation
Follow-up questions are rewritten into standalone queries, so pronouns and implicit context resolve correctly.
Retrieval with re-ranking
Vector search retrieves candidates; a re-ranking pass orders them before generation to raise precision.
Safety guardrails
Out-of-scope and low-confidence questions produce an explicit refusal and a recommendation to consult a professional.
Knowledge base management
Documents can be added or replaced and re-indexed without changing application code.
What it demonstrates
Stated as capability rather than invented metrics — we only publish numbers we can stand behind.
Grounding
Answers restricted to retrieved, citable source passages
Safety
Explicit refusal path for out-of-scope questions
Maintenance
Knowledge base updated without code changes
Other case studies
Have a project like this in mind?
Book a free consultation and we'll walk through the approach, the scope and what it would realistically take.
Prefer to just message? Chat with us on WhatsApp.