The problem
A small clinic misses calls while its therapists are treating patients. Every missed call is a booking that may go elsewhere, and every "can I move my appointment?" takes someone away from a patient.
A voice receptionist takes the routine calls (bookings, changes, cancellations, hours and fees) by the clinic's own rules, and passes anything urgent or unusual to a person at once, with the details written down.
The data
Arogya Physio is made up: three therapists in RS Puram, Coimbatore, open 9 am to 7 pm on weekdays and 9 am to 1 pm on Saturday, with a lunch break from 1 to 2. Each therapist has a speciality: Dr Priya (sports injuries, knees and ankles), Dr Karthik (back and neck pain), Dr Meena (rehab after surgery, balance).
402 made-up phrasings of six intents (book, reschedule, cancel, hours or location, fees, urgent pain), written by hand as core sentences with gaps for a day, a time, a therapist and a body part, then filled in and given greetings. I hold out a fifth of the core sentences, so the test phrasings are ones the model has never seen in any form.
A calendar for the next two weeks with 127 made-up bookings (on a sample Monday), generated with a seed, plus three named patients the sample calls refer to.
Six sample calls, each a short script I wrote, read by a Kokoro voice and saved as a 16 kHz WAV: Ravi Kumar (am_michael), Anitha Rao (bf_emma), Lakshmi Iyer (af_bella), Arjun Menon (bm_george), Suresh Babu (am_fenrir), Kavitha (af_nicole). The voices are American and British English, as Kokoro's English voices are; the names are made up.
The model
Deep learning: Whisper tiny.en turns the caller's audio into text. It is a 39-million-parameter speech model, about 40 MB, and it runs on your processor. Without it, typed words and the sample calls' scripts stand in, so the rest of the system works before any download.
Machine learning: naive Bayes intent model. Words become counts (with word pairs, and numbers, times and phone numbers turned into placeholder words), and the model learns how likely each word is under each intent. It trains in your browser in a few milliseconds and gives a probability for every intent. Below 50% it does not act: the receptionist asks again. Rules then pull out the details: the therapist, the problem, the day and time (chrono-node reads dates such as "next Tuesday"), the caller's name and mobile number.
Automation: booking rules. The clinic's rules decide what happens: opening days and hours, the lunch break, a 15-minute buffer between patients, no double booking, therapists' specialities, an hour's notice for same-day bookings, four hours' notice for cancellations, and urgent pain to a person. Safety words such as "unbearable" or "can't move" send a call to a person whatever the model says. Every action shows the rule that decided it.
Generative AI: the reply. The sentence comes from a small set of templates filled only with facts from the calendar, so it cannot promise a time that is not free. Kokoro 82M then speaks it in the voice you choose, about 90 MB on the processor or 330 MB on a graphics chip.
Measured in Edge, both models on the processor of a busy machine: Whisper loaded in 12 s and heard the 15.4-second booking call in 8.0 s; the rules took milliseconds; Kokoro loaded in 22 s, and its two-sentence reply took 51 s to start. That last figure is why the demo picks the graphics chip for the voice when your browser has one.
The pipeline
- 01Hear
Whisper tiny.en transcribes the call (deep learning), or typed words go straight on.
- 02Understand
The intent model scores six intents; rules and chrono-node pull out the therapist, day, time, name and phone (machine learning).
- 03Act
Booking rules check the calendar and book, move, cancel, offer alternatives or create a task for a person (automation).
- 04Reply
A template is filled with the booking facts, with a text message and a calendar file for bookings.
- 05Speak
Kokoro 82M reads the reply aloud on your device (generative AI).
Results
Measured when this page was built, with the same code the demo runs, on 305 training phrasings and a calendar for a sample Monday. The phrasings are mine, so real callers will say things these do not cover; that is what the 50% rule and the hand-over to a person are for.
For a client
For a real clinic I would connect it to their phone line and their booking system, so the calendar is the real one and a booking is a real booking, and train the intent model on transcripts of their own calls, in the languages their patients speak.
Speech recognition and the voice would run on a small server near the phone line rather than in a browser, so callers hear the answer in under a second. The rules and templates stay the same, written with the clinic and easy for them to change.
Every call would leave a record: the transcript, the intent and its probability, the rule that decided, and what was said back. The front desk checks the hand-overs first, and a weekly look at the unclear calls shows what to add.
Stack
| Part | What it does here | Licence |
|---|---|---|
| Whisper tiny.en | Speech to text, in a worker | Apache 2.0 |
| Kokoro 82M | The reply's voice, in a worker; also read the sample calls | Apache 2.0 |
| transformers.js and kokoro-js | Run both models in the browser | Apache 2.0 |
| chrono-node | Reads dates such as "next Tuesday" | MIT |
| My machine-learning library | Naive Bayes, the seeded generators and the metrics, written in TypeScript and unit-tested | Mine |
| Booking rules, slot rules and templates | The clinic's logic and the replies | Mine |
| Preact and Astro | The interactive page, built as static HTML | MIT |
Privacy
Everything happens in your browser. Your voice is recorded only while you press the button, transcribed on your device and never uploaded; recording stops if you leave the tab.
The two models download once from their public host and stay in your browser's cache. The calendar, the patients and the bookings are made up and live only in this page.
Limits
- The phrasings and the calendar are made up, so the accuracy shows how well the model handles my phrasings, not real callers.
- Whisper tiny.en knows English only and can mishear names and numbers; a real system would read the number back to the caller.
- Each call here is a single turn. A real receptionist would ask a follow-up question ("which of those times suits you?") and keep the conversation going.
- Kokoro's English voices are American and British, so the replies do not sound like a Coimbatore front desk.