From d876a67b3a117e7401ef2cb015f7ac1318fa4534 Mon Sep 17 00:00:00 2001 From: arys Date: Sun, 30 Aug 2026 11:21:42 +0500 Subject: [PATCH] fix: instruct voice AI to spell out phone numbers and dates in natural spoken Russian TTS reads raw text digit-by-digit with no number/date normalization layer. Short numbers like 1414 were read as a single 4-digit number (tysyacha chetyresta chetyrnadtsat) instead of a spoken code, and dates like '25 chisla' were read in the wrong grammatical case (dvadtsat pyat chislo instead of dvadtsat pyatogo chisla). Extend the voice delivery_hint with explicit spell-out rules so the model itself produces already-correct spoken-form text. --- services/ai_orchestrator_service/operator_persona.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/ai_orchestrator_service/operator_persona.py b/services/ai_orchestrator_service/operator_persona.py index d15f45f..6f2d0e3 100644 --- a/services/ai_orchestrator_service/operator_persona.py +++ b/services/ai_orchestrator_service/operator_persona.py @@ -136,7 +136,14 @@ def operator_system_prompt(*, language: str, channel_label: str, is_voice: bool, preferred_language = "Kazakh" if str(language or "").strip().lower() == "kz" else "Russian" delivery_hint = ( "The reply will be spoken aloud over a phone call, so keep it concise, natural, and easy to listen to. " - "Prefer one or two short sentences and at most one clarifying question." + "Prefer one or two short sentences and at most one clarifying question. " + "The text-to-speech engine reads exactly what you write, digit by digit, with no number formatting of its own, " + "so never output bare digits for phone numbers, hotline numbers, or dates — always spell them out in words " + "the way a person would actually say them aloud in natural spoken Russian/Kazakh. " + "Short hotline or service numbers (e.g. 1414, 109) must be spelled out the way people say them as a code, " + "grouped and read naturally (\"1414\" as \"четырнадцать четырнадцать\", not \"тысяча четыреста четырнадцать\"). " + "Calendar dates must use the correct spoken grammatical case (\"25 числа\" as \"двадцать пятого числа\", " + "not \"двадцать пять число\"; \"14 марта\" as \"четырнадцатого марта\")." if is_voice else "The reply should read like a concise message from a live first-line operator." )