Case Study: RAG AI Chatbot for a Healthcare Provider
A healthcare provider in the Middle East wanted patients to get accurate answers at any hour, on whichever channel they already use, in their own language. The answers had to come from the provider's own information, show where they came from and reach a person when the chatbot couldn't help. CelloIP designed and built the chatbot, and still maintains it. This is how it works.
Quick answer
What did CelloIP build in this RAG chatbot project?
CelloIP built a retrieval-augmented generation (RAG) AI chatbot for a healthcare provider in the Middle East. It answers patients' questions from the provider's own documents on four channels: a website widget, WhatsApp, chat inside the provider's app and the phone. It works in English, Arabic and one more language, cites the source of every answer, follows guardrails on what it will and won't answer, and hands conversations to staff when needed. The stack is OpenAI GPT models, a Python backend, PostgreSQL with pgvector and a dedicated vector database. It was built in three to six months and CelloIP maintains it.
Project summary
| Details | |
|---|---|
| Client | Healthcare provider in the Middle East (name confidential) |
| Product | RAG AI chatbot answering patients' questions from the provider's own documents |
| Channels | Website widget, WhatsApp, chat inside the provider's app, and phone |
| Languages | English, Arabic and one more language |
| AI | OpenAI GPT models for answers and embeddings |
| Backend | Python |
| Data | PostgreSQL with pgvector for app data and metadata; a dedicated vector database for search |
| Features | Citations, guardrails, handover to staff, admin panel, analytics, evaluation tests |
| Timeline | First production version in three to six months |
| Status | Live, maintained by CelloIP |
Patients ask a healthcare provider the same kinds of question over and over: which services it offers, how to prepare for a visit, what a process involves, which documents to bring. Staff spend hours answering them by phone and message, and patients wait. The client wanted a chatbot that could answer these questions reliably from its own published information, in the languages its patients speak, and leave staff free for the conversations that need a person.
The challenge
A general AI chatbot will happily answer anything, which is exactly the problem in healthcare. A wrong or invented answer about a service or a process damages trust. The provider needed a chatbot that knew the limits of what it should say, as much as it knew the answers.
- Answers must come from the provider's own documents, not the model's general knowledge.
- Every answer must show its source, so patients and staff can check it.
- The chatbot must decline questions outside its scope, including anything that sounds like a request for medical advice.
- It must work where patients already are: the website, WhatsApp, the provider's app and the phone.
- It must answer in English, Arabic and a third language, with Arabic written right to left.
- Conversations it can't handle must reach staff with the history attached.
- The provider's team must be able to update the knowledge base and see what patients ask, without developers.
Architecture
Channels
A website widget, WhatsApp through the Business API, chat inside the provider's app, and a phone line that turns speech into text and answers back in speech.
Python backend
Receives every message, detects the language, applies guardrails, runs retrieval, calls the model and decides when to hand over to staff.
Dedicated vector database
Holds the embedded passages from the provider's documents and finds the most relevant ones for each question.
OpenAI GPT models
Create the embeddings used for search, and write answers using only the retrieved passages.
PostgreSQL with pgvector
Stores conversations, users, document metadata and settings for the application and admin panel.
Admin panel
Lets the provider's team manage documents, review conversations, see analytics and run evaluation tests.
Keeping a single backend behind every channel was a deliberate choice. Retrieval, guardrails, analytics and handover rules are written once, so a fix or a new document improves the answers on the website, WhatsApp, the app and the phone at the same time.
How each answer is made
Retrieval-augmented generation splits the work into finding and writing. The chatbot never answers from memory alone.
| Step | What happens |
|---|---|
| 1. Receive | A patient's message arrives from one of the four channels; phone speech is turned into text first |
| 2. Check | Guardrails check whether the question is in scope; out-of-scope questions are declined or passed to staff |
| 3. Retrieve | The question is embedded and the vector database returns the most relevant passages from the provider's documents |
| 4. Answer | An OpenAI GPT model writes an answer in the patient's language, using only those passages |
| 5. Cite | The answer links to the source document, or names it on channels without links |
| 6. Hand over | If no good passage is found, or the patient asks for a person, the conversation goes to staff |
If retrieval finds nothing relevant, the chatbot says it doesn't know rather than guessing. That one rule does more for trust than any amount of prompt tuning. Our RAG chatbot guide explains chunking, retrieval and evaluation in more depth.
Four channels, one knowledge base
| Channel | How patients use it | What had to be handled |
|---|---|---|
| Website widget | Ask questions while browsing the provider's site | Clickable source links, right-to-left layout for Arabic |
| Message the provider's WhatsApp number | WhatsApp Business API rules, short answers, sources named in text | |
| In-app chat | Ask inside the provider's own app | Same answers and history as the other channels |
| Phone | Call and speak naturally | Speech to text, spoken answers, short replies, transfer to staff |
Each channel needed its own presentation. A website answer can show a link and several paragraphs; a WhatsApp reply must be short; a spoken answer must be shorter still and can't show a link at all. The retrieval and the facts stay the same, and only the format changes. Our guide to WhatsApp AI chatbots covers the WhatsApp side.
English, Arabic and a third language
Patients write in the language they're comfortable with, and often mix languages in one message. The chatbot detects the language of each message and answers in kind.
- Retrieval is designed to work across languages, so a question in one language can be matched to passages written in another.
- Answers are written in the patient's language, with the source still cited.
- The website widget and app switch to a right-to-left layout for Arabic.
- Evaluation tests run in all three languages, because a chatbot that is accurate in English can still be weak in Arabic.
Arabic deserves particular care: dialects vary, and spelling and transliteration differ from person to person. Testing with real patient-style questions in each language was essential. Our Arabic AI voice agent page covers this for voice.
Guardrails and citations
Stays in scope
The chatbot answers from the provider's documents only, and declines questions outside them.
No medical advice
Questions that ask for a diagnosis or treatment advice are declined politely and pointed to the right person.
Cites every answer
Each answer links to or names the document it came from, so it can be checked.
Admits uncertainty
When retrieval finds nothing relevant, the chatbot says so instead of inventing an answer.
Citations also help the provider. When a patient or staff member spots an outdated answer, the citation shows exactly which document needs updating.
Handover to staff
A chatbot that traps patients in a loop is worse than none. Handover was designed in from the start:
- Patients can ask for a person at any point.
- The chatbot hands over when it can't find a good answer, or when a question is outside its scope.
- Staff receive the conversation history, so patients don't repeat themselves.
- On the phone, the call is transferred to staff rather than ended.
Our guide to AI-to-human handover covers the patterns in detail.
Admin panel, analytics and evaluation
Document management
The provider's team uploads, replaces and removes documents, and the knowledge base is updated to match.
Conversation review
Staff can read conversations, see the sources used and spot weak answers.
Analytics
Shows what patients ask most, which channels and languages they use, and where the chatbot hands over.
Knowledge gaps
Questions with no good source show the team which documents to write or improve.
Evaluation tests
A set of real-style questions with expected answers, run in every language before changes go live.
The evaluation tests are what make changes safe. Whenever the documents, prompts or model change, the test set runs first, so a fix for one question doesn't quietly break others. Our article on testing and monitoring AI agents describes the approach.
Delivery
The first production version was built in three to six months:
| Stage | What was built |
|---|---|
| 1. Knowledge base | Document ingestion, chunking, embeddings, the vector database and PostgreSQL with pgvector |
| 2. Answer engine | Python backend with retrieval, OpenAI GPT answers, citations and guardrails |
| 3. Evaluation | Test set of real-style questions in English, Arabic and the third language |
| 4. Text channels | Website widget, WhatsApp and in-app chat |
| 5. Phone channel | Speech to text, spoken answers and transfer to staff |
| 6. Admin and launch | Admin panel, analytics, handover to staff, then ongoing maintenance by CelloIP |
CelloIP maintains the chatbot, including updates when models change, tuning from the analytics, and keeping the evaluation tests current as the provider's information changes.
Lessons for anyone building a RAG chatbot
- Decide what the chatbot must not answer before deciding what it should.
- Cite every answer; it builds trust and shows which documents need fixing.
- Let the chatbot say 'I don't know' when retrieval finds nothing.
- Build evaluation tests early, in every language you support.
- Use one backend for all channels, and change only the presentation per channel.
- Make handover easy and keep the conversation history with it.
- Give the client's team an admin panel, so content stays current without developers.
Frequently asked questions
What did CelloIP build?
A RAG AI chatbot that answers patients' questions from a healthcare provider's own documents. It runs on a website widget, WhatsApp, chat inside the provider's app and the phone, in English, Arabic and one more language. It cites its sources, follows guardrails, hands conversations to staff, and comes with an admin panel, analytics and evaluation tests.
Who is the client?
A healthcare provider in the Middle East. Its name is confidential under our agreement.
What is RAG, and why use it here?
Retrieval-augmented generation means the chatbot first finds the relevant passages in the client's own documents, then asks the language model to answer using only those passages. Answers stay tied to the provider's real information instead of the model's general knowledge, and each one can cite where it came from.
Does the chatbot give medical advice?
No. Its guardrails keep it to the provider's own information, such as services and patient guidance from its documents. Questions it shouldn't answer are declined politely and, where appropriate, passed to staff.
Why both PostgreSQL with pgvector and a dedicated vector database?
They do different jobs. PostgreSQL, with the pgvector extension, holds the application's data and document metadata. The dedicated vector database handles similarity search across the knowledge base. Keeping them separate lets each be tuned and scaled for its own work.
How long did it take?
The first production version took three to six months. That is longer than a single-channel chatbot because this one covers four channels, including phone calls, and three languages, each tested separately. The chatbot is live and CelloIP maintains it.
What would a similar chatbot cost?
As a guide, a knowledge-base chatbot MVP on one channel typically costs $6,000–$15,000 over 3–5 weeks, and a production RAG chatbot with several sources, channels and integrations $15,000–$40,000 over 6–10 weeks. A multi-channel, multilingual build with a voice channel, like this one, is scoped after discovery. Model usage and hosting are separate running costs.
Work with CelloIP
Planning an AI chatbot for your organisation?
CelloIP builds RAG AI chatbots that answer from your own documents on your website, WhatsApp, your app and the phone, in the languages your customers use, with citations, guardrails and handover to your team. You own the code.