AgentsAgentBase

set_multilingual

View as MarkdownOpen in Claude

Configure recognizer-driven multilingual mode. The speech recognizer runs in code-switching mode and the agent answers in whichever language the caller actually spoke; the model doesn’t pick the language. The SDK emits the object as the top-level multilingual key of the AI verb.

This is mutually exclusive with set_languages() and add_language(). If both are set, the platform uses multilingual and ignores languages.

Parameters

config
dict[str, Any]Required

The multilingual configuration object, passed through unchanged. See the SWML multilingual reference for its keys, including the language list, the starting language, and switching thresholds.

Returns

AgentBase — Returns self for method chaining.

Example

from signalwire import AgentBase
agent = AgentBase(name="dispatch", route="/dispatch")
agent.set_prompt_text("You are Ada, the dispatcher for Bayview Taxi.")
agent.set_multilingual({
"start_language": "en",
"allowed": ["en", "es", "fr"],
"languages": [
{"language": "default", "voice": "elevenlabs.rachel"},
{"language": "es", "voice": "elevenlabs.maria"},
{"language": "fr", "voice": "gcloud.fr-FR-Neural2-B"},
],
})
agent.serve()