addLanguage
Add a language configuration with voice settings. The agent uses these configurations to support multilingual conversations with appropriate TTS voices.
Language configurations map to the SWML ai.languages array.
See the SWML languages reference for the full specification.
Write voice as "engine.voice", optionally with a ":model" suffix. A bare voice name works
only alongside an explicit engine field, because on its own it resolves against a default
engine that can change.
Parameters
config
A language configuration object with the following fields:
config.name
Human-readable language name (e.g., "English", "French", "Spanish").
config.code
Language code (e.g., "en-US", "fr-FR", "es-MX").
config.voice
TTS voice identifier. Accepts one of three formats:
- Engine and voice:
"elevenlabs.josh" - Engine, voice, and model:
"elevenlabs.josh:eleven_turbo_v2_5" - Voice name with explicit
engine:"josh"
Always name the engine, either in the voice string or through engine. A voice name on its own —
"en-US-Neural2-F" — is resolved against a default engine, and that default can change.
config.engine
Explicit TTS engine name (e.g., "elevenlabs", "rime").
config.model
Explicit TTS model identifier (e.g., "mistv2", "eleven_turbo_v2_5").
config.speechFillers
Phrases the AI can say to fill a pause in speech. Rendered as speech_fillers.
config.functionFillers
Phrases the AI says while a function runs. Rendered as function_fillers. An
object keyed by function name then language code is flattened into one list,
with a warning; for fillers per tool, use the tool’s own fillers option.
When both speech and function fillers are set, the language renders
speech_fillers and function_fillers. When only one is set, it renders as the
older fillers list.
config.fillers
Filler phrases for both speech and functions, the older single fillers list.
Used as speechFillers when that isn’t set. An object keyed by category is
flattened into one list, with a warning; pass a string array instead.
config.speechModel
Speech recognition model identifier.
config.params
Optional per-language params dictionary for engine-specific tuning (e.g. voice
settings). Only emitted into the SWML document when non-empty, so existing
entries stay byte-identical when omitted. Can also be set or updated later via
setLanguageParams().
Returns
AgentBase — Returns this for method chaining.