How It Works
When a user speaks to your persona, their speech is transcribed using speech-to-text technology. By default, the system expects English input. For non-English users, you can specify the expected language to dramatically improve:- Transcription accuracy: The system correctly interprets words and phrases in the target language
- Response latency: Optimized processing for the specified language reduces delays
The
languageCode controls what language the system expects to hear from
users. This is separate from the persona’s voice, which determines what
language the persona speaks.When to Configure Language
For many use cases, the default English setting works well—even when users speak other languages. The LLM can still understand the meaning of what’s said and respond appropriately. Setting a specificlanguageCode becomes important when:
- You need exact transcription: In English mode, non-English speech may be translated to English in the transcript rather than preserved in the original language. If your application displays transcripts or the persona needs to see the exact words spoken, set the matching language code.
- You’re building language-focused experiences: For language learning apps, pronunciation practice, or any use case where the specific words matter as much as their meaning.
- You want optimized latency: Configuring the correct language reduces processing time for non-English speech.
Setting the Language Code
Configure the transcription language when requesting a session token viaPOST /v1/auth/session-token. Add the languageCode field to your personaConfig:
Configuration Reference
A 2-character ISO 639-1 language code specifying the expected user speech language. Defaults to
en (English) if not provided.Supported Languages
The following languages are supported for speech recognition:| Language | Code |
|---|---|
| English | en |
| French | fr |
| German | de |
| Spanish | es |
| Portuguese | pt |
| Italian | it |
| Dutch | nl |
| Polish | pl |
| Japanese | ja |
| Korean | ko |
| Chinese (Mandarin) | zh |
Understanding Language Configuration
There are two language settings to consider when building multilingual experiences:Transcription Language (What Users Speak)
ThelanguageCode field tells the speech recognition system what language to expect from users. Set this to match your users’ spoken language for accurate transcription.
Voice Language (What the Persona Speaks)
ThevoiceId determines the voice and language your persona uses when speaking. Select a voice that matches your target language from the Voice Gallery or the Anam Lab.
For a fully localized experience, configure both the
languageCode (for
user speech recognition) and select an appropriate voiceId (for persona
speech output).Best Practices
Match transcription language to user input
Match transcription language to user input
Always set
languageCode to match the language your users will speak.
Mismatched settings result in poor transcription accuracy. If your German
users speak German, set languageCode: "de".One language per session
One language per session
The language code is set per session and cannot be changed mid-conversation.
If your application supports multiple languages:
- Create separate sessions with appropriate language codes for each user
- Determine the user’s preferred language before starting the session
- Consider using a language selection step in your onboarding flow
Combine with matching voice and prompt
Combine with matching voice and prompt
For the best multilingual experience:
- Set
languageCodefor accurate speech recognition - Select a
voiceIdin the target language - Write your
systemPromptin the target language or instruct the persona to respond in that language
Account-level defaults for single-language apps
Account-level defaults for single-language apps
If your application primarily serves users of one non-English language,
contact Anam support to set an account-level
default. Benefits include:
- Simplified integration without passing
languageCodeevery time - No changes needed to existing integrations
- Per-session
languageCodestill overrides the default when needed
SDK Usage
When using the JavaScript SDK with ephemeral personas, thelanguageCode field in your PersonaConfig is passed through when creating session tokens:
The
languageCode configuration only applies to ephemeral persona flows where
you provide the persona configuration at runtime. For stateful personas
created in the Anam Lab, contact Anam support to
configure language settings.
