Skip to main content

Languages and voices

Multilingual Support

Agents can support multiple languages:

# Add English language
self.add_language(
name="English",
code="en-US",
voice="en-US-Neural2-F",
speech_fillers=["Let me think...", "One moment please..."],
function_fillers=["I'm looking that up...", "Let me check that..."]
)

# Add Spanish language
self.add_language(
name="Spanish",
code="es",
voice="rime.spore:multilingual",
speech_fillers=["Un momento por favor...", "Estoy pensando..."]
)

Voice formats

There are different ways to specify voices:

# Simple format
self.add_language(name="English", code="en-US", voice="en-US-Neural2-F")

# Explicit parameters with engine and model
self.add_language(
name="British English",
code="en-GB",
voice="spore",
engine="rime",
model="multilingual"
)

# Combined string format
self.add_language(
name="Spanish",
code="es",
voice="rime.spore:multilingual"
)

Hints

Hints help the AI understand certain terms better:

# Simple hints (list of words)
self.add_hints(["SignalWire", "SWML", "SWAIG"])

# Pattern hint with replacement
self.add_pattern_hint(
hint="AI Agent",
pattern="AI\\s+Agent",
replace="A.I. Agent",
ignore_case=True
)

Pronunciation rules

Pronunciation rules help the AI speak certain terms correctly:

# Add pronunciation rule
self.add_pronunciation("API", "A P I", ignore_case=False)
self.add_pronunciation("SIP", "sip", ignore_case=True)

AI speech behavior

Configure various AI behavior parameters:

# Set AI parameters
self.set_params({
"wait_for_user": False,
"end_of_speech_timeout": 1000,
"ai_volume": 5,
"languages_enabled": True,
"local_tz": "America/Los_Angeles"
})

Global data

Provide global data for the AI to reference:

# Set global data
self.set_global_data({
"company_name": "SignalWire",
"product": "AI Agent SDK",
"supported_features": [
"Voice AI",
"Telephone integration",
"SWAIG functions"
]
})