Context-aware filler (A.2)
Designed and implemented 2026-04-25. First item of the Q2 naturalness sprint, follows Phase 4.3+4.4 (speculative-STT). On by default; an operator setting can turn it off.
Why context-aware fillers exist
Tier-1 fillers fire ~300 ms after the caller stops speaking, while the backend RAG round-trip is still in flight. A generic filler ("Een ogenblikje") signals only "I heard you, working on it." A topic-aware filler ("Ik zoek de bezoekuren voor u op") additionally signals "I understood the topic" — moving caller perception from "is the system buying time?" to "the system parsed my question."
The architectural choice is to do this on the voice-agent side with pattern matching, not in the backend with LLM intent classification. The trade-offs:
| Decision | Chosen | Alternative | Rejected because |
|---|---|---|---|
| Where topic detection runs | Voice agent (media-server side), rule-based | Backend, LLM-classified | Filler must fire ~300 ms after STT-final, and the backend roundtrip already accounts for that 300 ms — putting topic detection in the backend means the filler never wins the race. Rule-based matching on the agent side takes under 1 ms. |
| Topic taxonomy | 10 hand-curated topics × 4 languages | Open-vocabulary topic extraction | Hand-curated misses long-tail topics, but the fallback is the generic filler — strict subset of correct behaviour. Open-vocabulary topic extraction needs an LLM call (back to the latency problem above). |
| Granularity | Topic noun, not exact match | Echo verbatim phrase | Echoing verbatim ("Ik zoek 'wat zijn de bezoekuren bij cardiologie' voor u op") is creepy at scale; the topic-noun substitution preserves naturalness without uncanny-valley quotation. |
Sacks, Schegloff & Jefferson 1974
What it is
When a caller mentions a known hospital topic in their question, the agent's tier-1 filler swaps from generic to topic-aware:
| Caller says | Old filler (generic) | New filler (context-aware) |
|---|---|---|
| "Wat zijn de bezoekuren bij cardiologie?" | "Een ogenblikje." | "Ik zoek de bezoekuren voor u op." |
| "How much is parking?" | "Let me check that for you." | "Let me look up the parking rates for you." |
| "Vorrei un appuntamento" | "Un momento, controllo per voi." | "Controllo le informazioni sull'appuntamento." |
Caller perception shifts from "the system is buying time" to "the system already understood my question and is actively engaged."
How it works
- The voice agent already subscribes to the media server's interim-transcript events for speculation (Phase 4.3+4.4) and distress-on-interim.
- On every interim transcript, the agent runs a topic detector: a per-language pattern map covering 10 hospital topics. First match wins; subsequent partials do not override.
- When the tier-1 filler fires (~300 ms into the retrieval round-trip), it reads the stored topic and swaps in a topic-aware template.
- The fallback chain avoids regressions: no topic detected means the generic filler (existing behaviour); unknown language means generic; a missing topic in the language map means generic.
Topic taxonomy (10 topics × 4 languages)
The taxonomy is a hand-curated map in the voice agent:
| Topic | Coverage |
|---|---|
| Visiting hours | Bezoekuren / visiting hours / heures de visite / orari di visita |
| Parking | Parkeren / parking / tarifs de parking / parcheggio |
| Phone | Telefoonnummer / phone number / numéro de téléphone / numero di telefono |
| Appointment | Afspraak / appointment / rendez-vous / appuntamento |
| Opening hours | Openingsuren / opening hours / heures d'ouverture / orari di apertura |
| Emergency | Spoed / emergency / urgences / pronto soccorso |
| Doctor | Dokter / arts / doctor / médecin / medico |
| Department | Afdeling / dienst / department / service / reparto |
| Admission | Opname / admission / hospitalisation / ricovero |
| Address | Adres / locatie / address / adresse / indirizzo |
3 variants per topic per language (= 120 templates total) so the agent doesn't sound robotic when the same topic comes up across calls.
Failure modes
| Scenario | Behavior |
|---|---|
| Topic detection misses (no keywords matched) | Generic filler — existing behavior |
| Caller speaks language not in the map (e.g., German) | Generic filler — defaults to Dutch |
| Topic key found but missing in language's template map | Generic filler — defensive fallback |
| Switched off | Generic filler — operator override |
No path leads to a crash or silent break. The feature is purely additive layered underneath existing behavior.
Observability
When a context-aware filler fires, the agent logs a structured event with the topic and language. Aggregating these events across a week of pilot calls tells operators which topics dominate, which informs taxonomy expansion in the next iteration.
Settings
The feature is on by default. An operator setting reverts to the earlier generic-filler behaviour.
Test it
Speak a multi-word question containing a known topic keyword. Listen for the topic noun in the agent's first-response filler. Examples:
- nl: "Wat zijn de bezoekuren bij cardiologie?"
- en: "How much does parking cost?"
- fr: "Quel est le numéro de téléphone?"
- it: "Vorrei un appuntamento"
Then say something not on the topic list ("Wat is uw naam?") and observe the generic filler returns. The fallback is the proof that A.2 doesn't regress existing behavior.
Latency budget
| Operation | Local-dev p50 (self-reported) |
|---|---|
| Topic pattern match (10 topics × 4 languages) | < 1 ms |
| Filler template selection (random from 3 variants) | < 0.1 ms |
| ElevenLabs TTS first audio chunk for filler | 150–250 ms* (Multilingual v2 streaming, @elevenlabs_multilingual_v2) |
* Per pilot measurement pass (Phase 5 of readiness plan).
References
- LiveKit Agents Documentation — interim transcript event hooks used to trigger detection
- ElevenLabs Multilingual v2 — production TTS that speaks the filler templates