set language mode.md

call.set_language_mode(
    primary: Language = "english",
    secondary: list[Language] | None = None,
)
await call.setLanguageMode({
  primary?: Language,   // default: "english"
  secondary?: Language[],
})
@agent.on_call_start
def on_call_start(call: guava.Call):
    call.set_persona(organization_name="Harper Valley Property Insurance")
    call.set_language_mode(primary="english", secondary=["spanish"])
    call.set_task(
        task_id="intro",
        objective="Answer questions regarding property insurance policy.",
    )
agent.onCallStart(async (call: guava.Call) => {
  await call.setPersona({ organizationName: "Harper Valley Property Insurance" });
  await call.setLanguageMode({ primary: "english", secondary: ["spanish"] });
  await call.setTask({
    taskId: "intro",
    objective: "Answer questions regarding property insurance policy.",
  });
});
call.set_language_mode(
    primary="english",
    secondary=["spanish", "french", "german"],
)
await call.setLanguageMode({
  primary: "english",
  secondary: ["spanish", "french", "german"],
});

set_language_mode()

Configures the voice agent to understand and respond in additional languages beyond English. The agent starts in the primary language and switches to a secondary language when the caller requests it or speaks in that language.

Example: single secondary language

<CodeTabs
  python={{ code: SET_LANGUAGE_MODE_EX1_PY, filename: "example.py" }}
  typescript={{ code: SET_LANGUAGE_MODE_EX1_TS, filename: "example.ts" }}
/>
<CodeTabs
  python={{ code: SET_LANGUAGE_MODE_EX1_PY, filename: "example.py" }}
  typescript={{ code: SET_LANGUAGE_MODE_EX1_TS, filename: "example.ts" }}
/>

Example: multiple secondary languages

<CodeTabs
  python={{ code: SET_LANGUAGE_MODE_EX2_PY, filename: "example.py" }}
  typescript={{ code: SET_LANGUAGE_MODE_EX2_TS, filename: "example.ts" }}
/>

Transcript behavior

Edge cases

Compliance: English and Spanish are currently supported for HITRUST / PCI-compliant deployments. All languages other than English and Spanish are not. Support for other languages is planned.