Prompt templates tuned for spoken output — our recommended way to prompt LLMs for voice AI with Smallest AI.
LangChain prompts are designed for text. Voice AI is different — your LLM output goes through TTS and gets spoken aloud, so it needs to sound natural, be concise, and avoid anything that doesn't translate to speech (markdown, bullet lists, URLs).
Base dependencies are installed via the root
requirements.txt. See the main README for setup. Install LangChain deps fromintegrations/langchain/. Copy../.env.sampleto.envand add your API keys.
from prompts import VOICE_AGENT_SYSTEM_PROMPT, voice_response_chain
chain = voice_response_chain()
response = chain.invoke({"input": "Tell me about your pricing"})
# Short, spoken-friendly text ready for TTSvoice-optimized-prompts/
└── prompts.py # Prompt templates + clean_for_voice helper + ready-to-use chains
| Text output | Voice output |
|---|---|
| Users scan and skim | Users must listen linearly |
| Bullet lists are helpful | Bullet lists are confusing when spoken |
| Markdown formatting works | Markdown syntax gets read aloud |
| Long responses are fine | Long responses lose the listener |
- Keep it short — 1-3 sentences per turn
- No formatting — no markdown, bullets, code blocks
- Conversational language — write the way people talk
- One idea per turn — don't dump info, ask if they want more
- Explicit turn-taking — end with a question or pause cue
- Numbers/abbreviations — spell out awkward numbers, avoid "e.g."
- No meta-commentary — never say "As an AI..."
A flexible base prompt for any voice assistant. Covers the fundamental rules for spoken output.
When to use: Starting point for custom voice agents, general Q&A, or when no specialized prompt fits.
VOICE_AGENT_SYSTEM_PROMPT = """\
You are a voice AI assistant. Your responses will be converted to speech \
using Smallest AI's Lightning TTS and played back to the user in real time.
Rules:
- Keep responses to 1-3 sentences. Users are listening, not reading.
- Use natural, conversational language. Write the way people talk.
- Never use markdown, bullet points, numbered lists, or any formatting.
- Never mention URLs, links, or ask users to "click" anything.
- Spell out numbers when they'd sound awkward as digits.
- Avoid abbreviations. Say "for example" not "e.g.".
- End with a clear question or pause point so the user knows it's their turn.
- If you don't know something, say so briefly. Don't pad with filler."""Tuned for support calls — acknowledges frustration, confirms understanding, walks through steps one at a time.
When to use: Help desks, support lines, troubleshooting flows, account assistance.
from prompts import VOICE_CUSTOMER_SERVICE_PROMPT
chain = voice_response_chain(system_prompt=VOICE_CUSTOMER_SERVICE_PROMPT)Enthusiastic but not pushy. Leads with benefits, asks qualifying questions naturally.
When to use: Product inquiries, demos, pricing questions, lead qualification calls.
from prompts import VOICE_SALES_PROMPT
chain = voice_response_chain(system_prompt=VOICE_SALES_PROMPT)Short, efficient, polite. Asks one question at a time, confirms details by repeating them.
When to use: Front desk routing, appointment scheduling, call screening.
from prompts import VOICE_RECEPTIONIST_PROMPT
chain = voice_response_chain(system_prompt=VOICE_RECEPTIONIST_PROMPT)import re
def clean_for_voice(text: str) -> str:
"""Strip formatting artifacts that shouldn't be spoken."""
text = re.sub(r'\*+', '', text) # Remove bold/italic markers
text = re.sub(r'`[^`]*`', '', text) # Remove inline code
text = re.sub(r'\[([^\]]+)\]\([^)]+\)', r'\1', text) # [text](url) → text
text = re.sub(r'^\s*[-*]\s+', '', text, flags=re.MULTILINE) # Remove list markers
text = re.sub(r'^\s*\d+\.\s+', '', text, flags=re.MULTILINE) # Remove numbered lists
text = re.sub(r'#{1,6}\s+', '', text) # Remove headers
return text.strip()
chain = prompt | llm | (lambda resp: clean_for_voice(resp.content))- Conversation Memory for Voice — Memory strategies that pair with these prompts
- TTS as LangChain Tool — Turn the text output into speech
- Voice AI Agent — Full end-to-end example