Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions app/agents/voice/automatic/prompts/system/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,26 @@ def get_tts_based_instructions(tts_provider: TTSProvider | None) -> str:
"""
Returns TTS-specific instructions.
"""

general_instructions = """
PERCENTAGE HANDLING
For percentages with decimals, ALWAYS replace the decimal symbol (.) with the word "point" in your actual text output. TTS engines cannot properly pronounce decimal symbols.
- Example: "83.5%" → say "eighty-three point five percent"
- Example: "12.75%" → say "twelve point seventy-five percent"
- Example: "0.65%" → say "point sixty-five percent"
- Example: "5%" → say "five percent"
- Example: "95%" → say "ninety-five percent"
"""

provider_specific_instructions = ""
if tts_provider == TTSProvider.ELEVENLABS:
return """
provider_specific_instructions = """
CURRENCY & NUMBER HANDLING
Do not include any currency symbols (₹, $, etc.) in your spoken responses.

For any number with more than two digits, expand it using a **digit-word hybrid format** for natural speech. Say numbers using digits for major units and words for place values.
- Example: 322 → say 3 hundred 22 rupees
- Example: 45,099 → say 45 thousand 99 rupees
- Example: "322" → say "3 hundred 22 rupees"
- Example: "45,099" → say "45 thousand 99 rupees"
"""
Comment on lines +21 to 28
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Fix indentation in provider-specific instructions.

The multi-line string for provider_specific_instructions has inconsistent indentation that will include unnecessary leading whitespace in the output.

Apply this diff to fix the indentation:

-        provider_specific_instructions = """
-            CURRENCY & NUMBER HANDLING
-            Do not include any currency symbols (₹, $, etc.) in your spoken responses.
-
-            For any number with more than two digits, expand it using a **digit-word hybrid format** for natural speech. Say numbers using digits for major units and words for place values.
-            - Example: "322" → say "3 hundred 22 rupees"
-            - Example: "45,099" → say "45 thousand 99 rupees"
-        """
+        provider_specific_instructions = """
+CURRENCY & NUMBER HANDLING
+Do not include any currency symbols (₹, $, etc.) in your spoken responses.
+
+For any number with more than two digits, expand it using a **digit-word hybrid format** for natural speech. Say numbers using digits for major units and words for place values.
+- Example: "322" → say "3 hundred 22 rupees"
+- Example: "45,099" → say "45 thousand 99 rupees"
+"""

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In app/agents/voice/automatic/prompts/system/tts.py around lines 21 to 28, the
multi-line string assigned to provider_specific_instructions contains
inconsistent leading indentation which will embed unwanted whitespace in the
string; reformat the triple-quoted string so its content lines are left-aligned
(no extra leading spaces), preserving line breaks and punctuation exactly as
intended, so the string contains clean text without leading indentation.

return ""

return general_instructions + provider_specific_instructions