Skip to content

Commit 4def74b

Browse files
committed
fix(docs): remove function parameters from dynamic transfer examples
1 parent 92c771e commit 4def74b

File tree

3 files changed

+101
-164
lines changed

3 files changed

+101
-164
lines changed

fern/assistants/examples/inbound-support.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ We will be creating a customer support agent for VapiBank, a bank that wants to
159159
},
160160
voice: {
161161
provider: "11labs",
162-
voice_id: "burt"
162+
voice_id: "rachel"
163163
}
164164
});
165165

@@ -193,7 +193,7 @@ We will be creating a customer support agent for VapiBank, a bank that wants to
193193
},
194194
"voice": {
195195
"provider": "11labs",
196-
"voice_id": "burt"
196+
"voice_id": "rachel"
197197
}
198198
}
199199

@@ -222,7 +222,7 @@ We will be creating a customer support agent for VapiBank, a bank that wants to
222222
},
223223
"voice": {
224224
"provider": "11labs",
225-
"voice_id": "burt"
225+
"voice_id": "rachel"
226226
}
227227
}'
228228
```

fern/assistants/examples/support-escalation.mdx

Lines changed: 71 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Build an intelligent customer support escalation system that determines transfer
2121
* Webhook server for escalation destination logic
2222
* CRM integration for customer tier-based routing
2323

24+
<Warning>
25+
**Important:** Dynamic transfer tools do not support function parameters. When creating a transfer tool with an empty destinations array, you cannot define or pass parameters. The webhook will analyze the conversation transcript and call context instead to determine routing logic.
26+
</Warning>
27+
2428
## Prerequisites
2529

2630
* A [Vapi account](https://dashboard.vapi.ai/)
@@ -49,13 +53,6 @@ We will build a customer support escalation system for TechCorp that intelligent
4953
- Set function name: `escalateToSupport`
5054
- Add description: `Escalate calls to appropriate support specialists based on customer tier and issue complexity`
5155
</Step>
52-
<Step title="Configure tool parameters">
53-
Add these parameters to help the assistant provide context:
54-
- `issue_category` (string): Category of customer issue (technical, billing, account, product)
55-
- `complexity_level` (string): Issue complexity (basic, intermediate, advanced, critical)
56-
- `customer_context` (string): Relevant customer information for routing
57-
- `escalation_reason` (string): Why this needs escalation vs self-service
58-
</Step>
5956
</Steps>
6057
</Tab>
6158
<Tab title="TypeScript (Server SDK)">
@@ -72,31 +69,7 @@ We will build a customer support escalation system for TechCorp that intelligent
7269
destinations: [],
7370
function: {
7471
name: "escalateToSupport",
75-
description: "Escalate calls to appropriate support specialists based on customer tier and issue complexity",
76-
parameters: {
77-
type: "object",
78-
properties: {
79-
issue_category: {
80-
type: "string",
81-
description: "Category of customer issue",
82-
enum: ["technical", "billing", "account", "product"]
83-
},
84-
complexity_level: {
85-
type: "string",
86-
description: "Issue complexity level",
87-
enum: ["basic", "intermediate", "advanced", "critical"]
88-
},
89-
customer_context: {
90-
type: "string",
91-
description: "Relevant customer information for routing"
92-
},
93-
escalation_reason: {
94-
type: "string",
95-
description: "Why this needs escalation vs self-service"
96-
}
97-
},
98-
required: ["issue_category", "complexity_level"]
99-
}
72+
description: "Escalate calls to appropriate support specialists based on customer tier and issue complexity"
10073
}
10174
});
10275

@@ -131,31 +104,7 @@ We will build a customer support escalation system for TechCorp that intelligent
131104
"destinations": [],
132105
"function": {
133106
"name": "escalateToSupport",
134-
"description": "Escalate calls to appropriate support specialists based on customer tier and issue complexity",
135-
"parameters": {
136-
"type": "object",
137-
"properties": {
138-
"issue_category": {
139-
"type": "string",
140-
"description": "Category of customer issue",
141-
"enum": ["technical", "billing", "account", "product"]
142-
},
143-
"complexity_level": {
144-
"type": "string",
145-
"description": "Issue complexity level",
146-
"enum": ["basic", "intermediate", "advanced", "critical"]
147-
},
148-
"customer_context": {
149-
"type": "string",
150-
"description": "Relevant customer information for routing"
151-
},
152-
"escalation_reason": {
153-
"type": "string",
154-
"description": "Why this needs escalation vs self-service"
155-
}
156-
},
157-
"required": ["issue_category", "complexity_level"]
158-
}
107+
"description": "Escalate calls to appropriate support specialists based on customer tier and issue complexity"
159108
}
160109
}
161110

@@ -183,31 +132,7 @@ We will build a customer support escalation system for TechCorp that intelligent
183132
"destinations": [],
184133
"function": {
185134
"name": "escalateToSupport",
186-
"description": "Escalate calls to appropriate support specialists based on customer tier and issue complexity",
187-
"parameters": {
188-
"type": "object",
189-
"properties": {
190-
"issue_category": {
191-
"type": "string",
192-
"description": "Category of customer issue",
193-
"enum": ["technical", "billing", "account", "product"]
194-
},
195-
"complexity_level": {
196-
"type": "string",
197-
"description": "Issue complexity level",
198-
"enum": ["basic", "intermediate", "advanced", "critical"]
199-
},
200-
"customer_context": {
201-
"type": "string",
202-
"description": "Relevant customer information for routing"
203-
},
204-
"escalation_reason": {
205-
"type": "string",
206-
"description": "Why this needs escalation vs self-service"
207-
}
208-
},
209-
"required": ["issue_category", "complexity_level"]
210-
}
135+
"description": "Escalate calls to appropriate support specialists based on customer tier and issue complexity"
211136
}
212137
}'
213138
```
@@ -235,10 +160,11 @@ We will build a customer support escalation system for TechCorp that intelligent
235160
2. Assess issue complexity and customer needs
236161
3. Escalate to human specialists when appropriate using the escalateToSupport function
237162

238-
Try to resolve simple issues first. For complex issues or when customers request human help, escalate intelligently based on:
239-
- Issue category (technical, billing, account, product)
240-
- Complexity level (basic, intermediate, advanced, critical)
241-
- Customer context and history
163+
When you need to escalate, clearly state the issue type and complexity in the conversation before calling the escalation function. For example:
164+
- "I see you're having a technical issue that seems quite complex. Let me connect you with a specialist."
165+
- "This billing matter is critical. I'll transfer you to our billing team right away."
166+
167+
The system will analyze the conversation to route you to the right specialist.
242168

243169
Always be professional and efficient in your support.
244170
```
@@ -284,10 +210,6 @@ Always be professional and efficient in your support.`
284210
],
285211
toolIds: [escalationToolId]
286212
},
287-
voice: {
288-
provider: "11labs",
289-
voiceId: "burt"
290-
},
291213
serverUrl: "https://your-app.com/webhook/escalation",
292214
serverUrlSecret: process.env.WEBHOOK_SECRET
293215
});
@@ -342,10 +264,6 @@ Always be professional and efficient in your support."""
342264
],
343265
"toolIds": [escalation_tool_id]
344266
},
345-
"voice": {
346-
"provider": "11labs",
347-
"voiceId": "burt"
348-
},
349267
"serverUrl": "https://your-app.com/webhook/escalation",
350268
"serverUrlSecret": os.getenv("WEBHOOK_SECRET")
351269
}
@@ -385,7 +303,7 @@ Always be professional and efficient in your support."""
385303
},
386304
"voice": {
387305
"provider": "11labs",
388-
"voiceId": "burt"
306+
"voiceId": "rachel"
389307
},
390308
"serverUrl": "https://your-app.com/webhook/escalation",
391309
"serverUrlSecret": "your-webhook-secret"
@@ -421,8 +339,32 @@ Always be professional and efficient in your support."""
421339

422340
// Support escalation logic
423341
function determineSupportDestination(request: any) {
424-
const { functionCall, call, customer } = request;
425-
const { issue_category, complexity_level, customer_context, escalation_reason } = functionCall.parameters;
342+
const { call, customer } = request;
343+
344+
// Analyze the transcript to determine issue type and complexity
345+
// Since dynamic transfers don't support parameters, we must analyze the conversation
346+
const transcript = call.transcript || '';
347+
const lowerTranscript = transcript.toLowerCase();
348+
349+
// Determine issue category from conversation
350+
let issue_category = 'general';
351+
if (lowerTranscript.includes('technical') || lowerTranscript.includes('error') || lowerTranscript.includes('bug')) {
352+
issue_category = 'technical';
353+
} else if (lowerTranscript.includes('billing') || lowerTranscript.includes('payment') || lowerTranscript.includes('invoice')) {
354+
issue_category = 'billing';
355+
} else if (lowerTranscript.includes('account') || lowerTranscript.includes('password') || lowerTranscript.includes('login')) {
356+
issue_category = 'account';
357+
} else if (lowerTranscript.includes('product') || lowerTranscript.includes('feature')) {
358+
issue_category = 'product';
359+
}
360+
361+
// Determine complexity level from keywords
362+
let complexity_level = 'basic';
363+
if (lowerTranscript.includes('urgent') || lowerTranscript.includes('critical') || lowerTranscript.includes('emergency')) {
364+
complexity_level = 'critical';
365+
} else if (lowerTranscript.includes('complex') || lowerTranscript.includes('advanced') || lowerTranscript.includes('integration')) {
366+
complexity_level = 'advanced';
367+
}
426368

427369
// Simulate customer tier lookup
428370
const customerData = lookupCustomerTier(customer.number);
@@ -444,7 +386,7 @@ Always be professional and efficient in your support."""
444386
},
445387
{
446388
role: "user",
447-
content: `Enterprise customer with ${issue_category} issue. Complexity: ${complexity_level}. Reason: ${escalation_reason}. Context: ${customer_context}`
389+
content: `Enterprise customer with ${issue_category} issue. Complexity: ${complexity_level}.`
448390
}
449391
]
450392
}
@@ -460,7 +402,7 @@ Always be professional and efficient in your support."""
460402
message: "Transferring you to our technical support specialists.",
461403
transferPlan: {
462404
mode: "warm-transfer-say-message",
463-
message: `Technical ${complexity_level} issue. Customer context: ${customer_context}. Escalation reason: ${escalation_reason}`
405+
message: `Technical ${complexity_level} issue requiring specialist support.`
464406
}
465407
};
466408
}
@@ -473,7 +415,7 @@ Always be professional and efficient in your support."""
473415
message: "Connecting you with our billing and account specialists.",
474416
transferPlan: {
475417
mode: "warm-transfer-say-message",
476-
message: `${issue_category} issue, complexity ${complexity_level}. Context: ${customer_context}`
418+
message: `${issue_category} issue, complexity ${complexity_level}.`
477419
}
478420
};
479421
}
@@ -486,7 +428,7 @@ Always be professional and efficient in your support."""
486428
message: "Transferring you to our product specialists.",
487429
transferPlan: {
488430
mode: "warm-transfer-say-message",
489-
message: `Product ${complexity_level} inquiry. Context: ${customer_context}`
431+
message: `Product ${complexity_level} inquiry.`
490432
}
491433
};
492434
}
@@ -581,14 +523,31 @@ Always be professional and efficient in your support."""
581523

582524
def determine_support_destination(request_data: Dict[str, Any]) -> Dict[str, Any]:
583525
"""Determine support escalation destination based on request context"""
584-
function_call = request_data.get('functionCall', {})
585-
parameters = function_call.get('parameters', {})
526+
call = request_data.get('call', {})
586527
customer = request_data.get('customer', {})
587528

588-
issue_category = parameters.get('issue_category', 'general')
589-
complexity_level = parameters.get('complexity_level', 'basic')
590-
customer_context = parameters.get('customer_context', '')
591-
escalation_reason = parameters.get('escalation_reason', '')
529+
# Analyze the transcript to determine issue type and complexity
530+
# Since dynamic transfers don't support parameters, we must analyze the conversation
531+
transcript = call.get('transcript', '')
532+
lower_transcript = transcript.lower()
533+
534+
# Determine issue category from conversation
535+
issue_category = 'general'
536+
if 'technical' in lower_transcript or 'error' in lower_transcript or 'bug' in lower_transcript:
537+
issue_category = 'technical'
538+
elif 'billing' in lower_transcript or 'payment' in lower_transcript or 'invoice' in lower_transcript:
539+
issue_category = 'billing'
540+
elif 'account' in lower_transcript or 'password' in lower_transcript or 'login' in lower_transcript:
541+
issue_category = 'account'
542+
elif 'product' in lower_transcript or 'feature' in lower_transcript:
543+
issue_category = 'product'
544+
545+
# Determine complexity level from keywords
546+
complexity_level = 'basic'
547+
if 'urgent' in lower_transcript or 'critical' in lower_transcript or 'emergency' in lower_transcript:
548+
complexity_level = 'critical'
549+
elif 'complex' in lower_transcript or 'advanced' in lower_transcript or 'integration' in lower_transcript:
550+
complexity_level = 'advanced'
592551

593552
# Simulate customer tier lookup
594553
customer_data = lookup_customer_tier(customer.get('number', ''))
@@ -610,7 +569,7 @@ Always be professional and efficient in your support."""
610569
},
611570
{
612571
"role": "user",
613-
"content": f"Enterprise customer with {issue_category} issue. Complexity: {complexity_level}. Reason: {escalation_reason}. Context: {customer_context}"
572+
"content": f"Enterprise customer with {issue_category} issue. Complexity: {complexity_level}."
614573
}
615574
]
616575
}
@@ -625,7 +584,7 @@ Always be professional and efficient in your support."""
625584
"message": "Transferring you to our technical support specialists.",
626585
"transferPlan": {
627586
"mode": "warm-transfer-say-message",
628-
"message": f"Technical {complexity_level} issue. Customer context: {customer_context}. Escalation reason: {escalation_reason}"
587+
"message": f"Technical {complexity_level} issue requiring specialist support."
629588
}
630589
}
631590

@@ -637,7 +596,7 @@ Always be professional and efficient in your support."""
637596
"message": "Connecting you with our billing and account specialists.",
638597
"transferPlan": {
639598
"mode": "warm-transfer-say-message",
640-
"message": f"{issue_category} issue, complexity {complexity_level}. Context: {customer_context}"
599+
"message": f"{issue_category} issue, complexity {complexity_level}."
641600
}
642601
}
643602

@@ -649,7 +608,7 @@ Always be professional and efficient in your support."""
649608
"message": "Transferring you to our product specialists.",
650609
"transferPlan": {
651610
"mode": "warm-transfer-say-message",
652-
"message": f"Product {complexity_level} inquiry. Context: {customer_context}"
611+
"message": f"Product {complexity_level} inquiry."
653612
}
654613
}
655614

@@ -939,8 +898,7 @@ function handleEscalationError(error: any, context: any) {
939898
// Log escalation details for debugging
940899
console.error('Escalation context:', {
941900
phoneNumber: context.customer?.number,
942-
issueCategory: context.functionCall?.parameters?.issue_category,
943-
complexityLevel: context.functionCall?.parameters?.complexity_level,
901+
callId: context.call?.id,
944902
timestamp: new Date().toISOString()
945903
});
946904

0 commit comments

Comments
 (0)