https://retellai.com/?utm_source=discord&utm_medium=seo logo
Sometimes the agent briefly switches to another la...
# ❓・ai-evy-support
t
@AI Evy Sometimes the agent briefly switches to another language in the middle of a conversation before returning to the predefined language. How can this be prevented and optimized?
a
Thanks for tagging me @tacitus_16379. I'll look through relevant sources and get back to you shortly.
### Answer Based on the available sources, there are several approaches to prevent unwanted language switching in Retell AI agents: ## Configuration Solutions For language configuration, you can set the language of your agent in the dashboard or programmatically [(1) ]() [(2) ]() . The language setting determines what language the agent will understand (speech-to-text) and influences the default TTS model choice [(2) ]() . However, it's important to note that the language setting "will not enforce the agent to generate responses in a certain language. You have to set that in the prompt yourself" . To ensure consistent language use, add explicit language instructions in your prompt, such as "always respond in Spanish" . ## Speech Normalization Issue One specific cause of language switching has been identified: speech normalization can cause agents to blurt out numbers in the wrong language [(3) ]() . To resolve this, turn off "Speech Normalization" in your agent settings . ## Conversation Flow Workaround For Conversation Flow agents, language switching between nodes is a known issue [(4) ]() . A community solution involves: 1. Extracting the user's language as a dynamic variable after the first node 2. Adding this prompt to the top of every subsequent node :
Copy code
Always speak in {{user_language}} throughout this node.
Assume the user only understands {{user_language}}.
Only listen for and recognize speech in {{user_language}}.
Transcribe and interpret the caller's response exclusively in {{user_language}}.
Do not use English unless {{user_language}} is explicitly set to "English".
## Current Limitations Retell AI currently does not support automatic language detection or dynamic language switching during conversations [(5) ]() . The speech-to-text model remains in the "base" language even if you prompt the agent to switch languages . For multi-language support, consider using separate agents for each language and implementing agent swapping based on user preference [(4) ]() .
​ To learn more, see the sources I considered: [[1] Step 1: Configure global settings](https://docs.retellai.com/build/conversation-flow/global-setting) [[2] Set language for your agent](https://docs.retellai.com/agent/language) [[3] IVR Navigation Help](https://discord.com/channels/1186424376300679209/1288834538214264842) [[4] Language Switching](https://discord.com/channels/1186424376300679209/1397465772074467338) [[5] Discord message from @fyodor2572 on 2024-12-27](https://discord.com/channels/1186424376300679209/1294891368505937952/1322038621557100544) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.