The problem
Clinics, salons and other service businesses lose bookings out of hours, and the front desk spends its day on the same questions: are you open on Sunday, how much is a cleaning, can I move my appointment. Patients want to type the way they talk, whenever suits them.
A large language model is more than this needs, and hard to keep on script. Booking has a small, known set of requests and details, so an intent classifier, slot filling and a handful of tools do the job: fast, predictable, nearly free to run, and every decision is visible to the front desk.
The data
Pearl Dental Studio is fictional. Two dentists, 6 treatments with their durations and sample prices, open 9:30 am to 7:30 pm Monday to Saturday with lunch from 1 to 2, closed on Sundays. The address is on Sample Street and the phone number is all zeros.
313 example phrasings across 10 intents, written by me the way patients in Chennai type: Indian English ("kindly book", "prepone my appointment") and a little Tanglish ("naalaikku cleaning pannanum", "clinic enga irukku"). Another 80 phrasings are held back to test the classifier.
The diary is generated from a fixed seed: 310 existing bookings over the next six weeks, busier in the coming days and in the evenings, as a real clinic's would be. They carry no names, only blocked time. One sample booking, PDS-2R7K, is there so you can try moving or cancelling without booking first.
The model
Intents come from a naive Bayes classifier over words and word pairs. Before it sees a message, booking codes, phone numbers, times and other numbers become placeholder words, and question words such as "where" and "how much" are kept as markers: they are what separates a location question from a price question. Below 50% confidence the assistant does not act on the guess.
Slots come from rules and chrono-node. The treatment comes from the words patients use ("scaling" is a cleaning, "RCT" a root canal consultation, "teeth clips" braces). Dates come from chrono-node, read against the clinic's clock in India whatever time zone your device is in. Times, day ranges ("next week", "this weekend"), Tanglish day words, names and Indian mobile numbers come from my own patterns. A bare "4" means 4 pm: the clinic is shut at 4 am.
A dialogue manager, a small state machine, holds the request in progress and asks only for what is missing, in order: the treatment, a day, one of three offered times, a name, a mobile number, then a yes. It answers side questions without losing its place, takes a change of mind at any step, offers later times on "no, later", and hands the conversation to a person, with a note, when asked.
Tools are plain functions the manager calls: findSlots, book, reschedule, cancel and handOver. findSlots keeps to opening hours, lunch, Sundays, an hour's notice and each dentist's bookings, and spreads its three picks out. Every call and its answer is shown in the trace, the way an agent framework logs them.
The pipeline
- 01Normalise
Codes, phone numbers and times become placeholder words; Tanglish day words become English.
- 02Classify
Naive Bayes picks the intent and says how sure it is.
- 03Extract
Treatment, day, time, dentist, name, mobile number and booking code, each with the words it came from.
- 04Decide
The state machine updates the request and picks the next move: ask, offer, confirm or act.
- 05Call tools
findSlotssearches the diary;book,rescheduleandcancelchange it, and only after a yes. - 06Reply
Text, time buttons and quick replies; after a booking, a confirmation card with a calendar file in India time.
Results
Measured when this page was built, with the same code the demo runs. The held-out phrasings are new wordings of the same requests; real patients will find gaps, which is why the trace and the handover are there.
For a client
For a real clinic I would connect the tools to its practice software or Google Calendar, send confirmations and reminders by SMS or WhatsApp, and put the same assistant on the website and on WhatsApp.
I would train the classifier on the clinic's real enquiries, with names removed, and log every turn the assistant could not handle. Reviewing those each week turns them into new examples or new rules, so it gets better where patients actually struggle.
For open questions ("is whitening safe if I have sensitive teeth?") I would add a language model behind the same tools, on a short leash: it can phrase replies and answer from the clinic's own leaflets, but bookings still go through the tools and need a yes.
Stack
| Part | What it does here | Licence |
|---|---|---|
| My intent classifier and dialogue manager | Naive Bayes, the slot rules, the state machine and the tools, in TypeScript and unit-tested | Mine |
| chrono-node | Reads dates such as "next Tuesday" and "14 Dec" | MIT |
| Preact | The chat, the trace and the diary | MIT |
| Astro | The page, built as static HTML | MIT |
Privacy
Everything runs in your browser. What you type, including any name or number, stays in this tab and is gone when you close it; nothing is sent anywhere.
The calendar file is made on your device.
Limits
- It understands what it was taught. Requests far from the example phrasings, long stories, or two requests in one message can confuse it; it then says so and offers a person.
- It takes names as typed and does not check them, and it treats each dentist as one chair. A real clinic also juggles rooms, equipment and buffers between patients.
- The clinic, dentists, prices and diary are made up, and nothing is really booked.