Skip to content

Commit 693c226

Browse files
committed
docs(squads): add ts/python/curl tabs to multilingual example
1 parent 3e68ced commit 693c226

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

fern/squads/examples/multilingual-support.mdx

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,65 @@ Provide structured multilingual support using a Squad: present a short language
3232

3333
Start with a brief selection (EN/ES/FR). Route to the matching assistant. Optionally auto‑detect and confirm.
3434

35-
## 3. Test
35+
## 3. Implement
36+
37+
<Tabs>
38+
<Tab title="TypeScript (Server SDK)">
39+
```typescript
40+
import { VapiClient } from "@vapi-ai/server-sdk";
41+
const vapi = new VapiClient({ token: process.env.VAPI_API_KEY! });
42+
43+
await vapi.calls.create({
44+
transport: { type: "web" },
45+
squad: {
46+
members: [
47+
{ assistant: { name: "English Support", model: { provider: "openai", model: "gpt-4o", messages: [{ role: "system", content: "English support. Direct, friendly, professional." }] }, voice: { provider: "azure", voiceId: "en-US-AriaNeural" }, firstMessage: "Hello! How can I help you today?", firstMessageMode: "assistant-speaks-first" } },
48+
{ assistant: { name: "Soporte Español", model: { provider: "openai", model: "gpt-4o", messages: [{ role: "system", content: "Soporte en español. Cálido y respetuoso; usa 'usted' inicialmente." }] }, voice: { provider: "azure", voiceId: "es-ES-ElviraNeural" } } },
49+
{ assistant: { name: "Support Français", model: { provider: "openai", model: "gpt-4o", messages: [{ role: "system", content: "Support français. Poli, courtois et formel." }] }, voice: { provider: "azure", voiceId: "fr-FR-DeniseNeural" } } }
50+
],
51+
},
52+
});
53+
```
54+
</Tab>
55+
56+
<Tab title="Python (Server SDK)">
57+
```python
58+
import os
59+
from vapi import Vapi
60+
61+
client = Vapi(token=os.getenv("VAPI_API_KEY"))
62+
client.calls.create(
63+
transport={"type": "web"},
64+
squad={
65+
"members": [
66+
{"assistant": {"name": "English Support", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "English support. Direct, friendly, professional."}]}, "voice": {"provider": "azure", "voiceId": "en-US-AriaNeural"}, "first_message": "Hello! How can I help you today?", "first_message_mode": "assistant-speaks-first"}},
67+
{"assistant": {"name": "Soporte Español", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Soporte en español. Cálido y respetuoso; usa 'usted' inicialmente."}]}, "voice": {"provider": "azure", "voiceId": "es-ES-ElviraNeural"}}},
68+
{"assistant": {"name": "Support Français", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Support français. Poli, courtois et formel."}]}, "voice": {"provider": "azure", "voiceId": "fr-FR-DeniseNeural"}}},
69+
]
70+
},
71+
)
72+
```
73+
</Tab>
74+
75+
<Tab title="cURL (web)">
76+
```bash
77+
curl -X POST "https://api.vapi.ai/call/web" \
78+
-H "Authorization: Bearer $VAPI_API_KEY" \
79+
-H "Content-Type: application/json" \
80+
-d '{
81+
"squad": {
82+
"members": [
83+
{ "assistant": { "name": "English Support", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "English support. Direct, friendly, professional."}] }, "voice": {"provider": "azure", "voiceId": "en-US-AriaNeural"}, "firstMessage": "Hello! How can I help you today?", "firstMessageMode": "assistant-speaks-first" } },
84+
{ "assistant": { "name": "Soporte Español", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Soporte en español. Cálido y respetuoso; usa 'usted' inicialmente."}] }, "voice": {"provider": "azure", "voiceId": "es-ES-ElviraNeural" } } },
85+
{ "assistant": { "name": "Support Français", "model": {"provider": "openai", "model": "gpt-4o", "messages": [{"role": "system", "content": "Support français. Poli, courtois et formel."}] }, "voice": {"provider": "azure", "voiceId": "fr-FR-DeniseNeural" } } }
86+
]
87+
}
88+
}'
89+
```
90+
</Tab>
91+
</Tabs>
92+
93+
## 4. Test
3694

3795
Create a phone number for the Squad and test each language path.
3896

0 commit comments

Comments
 (0)