You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/assistants/function-calling.mdx
+36-17Lines changed: 36 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
-
title: Function Calling
3
-
subtitle: 'Additional Capabilities for Your Assistants '
4
-
slug: assistants/function-calling
2
+
title: Default Tools
3
+
subtitle: 'Adding Transfer Call, End Call, and Dial Keypad capabilities to your assistants.'
4
+
slug: assistants/default-tools
5
5
---
6
6
7
-
Vapi voice assistants are given three additional functions: `transferCall`,`endCall`, and `dialKeypad`. These functions can be used to transfer calls, hang up calls, and enter digits on the keypad.
7
+
Vapi voice assistants are given additional functions: `transferCall`,`endCall`, and `dtmf` (to dial a keypad with [DTMF](https://en.wikipedia.org/wiki/DTMF)). These functions can be used to transfer calls, hang up calls, and enter digits on the keypad.
8
8
9
-
<Note>You **do not**need to add these functions to your model's `functions` array.</Note>
9
+
<Note>You **need** to add these tools to your model's `tools` array.</Note>
10
10
11
11
#### Transfer Call
12
12
13
-
When a `forwardingPhoneNumber` is present on an assistant, the assistant will be given a `transferCall` function. This function can be used to transfer the call to the `forwardingPhoneNumber`.
13
+
This function is provided when `transferCall` is included in the assistant's list of available tools (see configuration options [here](/api-reference/assistants/create#request.body.model.openai.tools.transferCall)). This function can be used to transfer the call to any of the `destinations` defined in the tool configuration (see details on destination options [here](/api-reference/assistants/create#request.body.model.openai.tools.transferCall.destinations)).
14
14
15
15
```json
16
16
{
@@ -22,15 +22,25 @@ When a `forwardingPhoneNumber` is present on an assistant, the assistant will be
22
22
"role": "system",
23
23
"content": "You are an assistant at a law firm. When the user asks to be transferred, use the transferCall function."
24
24
}
25
+
],
26
+
"tools": [
27
+
{
28
+
"type": "transferCall".
29
+
"destinations" : {
30
+
{
31
+
"type": "number",
32
+
"number": "+16054440129"
33
+
}
34
+
}
35
+
}
25
36
]
26
-
},
27
-
"forwardingPhoneNumber": "+16054440129"
37
+
}
28
38
}
29
39
```
30
40
31
41
#### End Call
32
42
33
-
This function is provided when `endCallFunctionEnabled` is enabled on the assistant. The assistant can use this function to end the call.
43
+
This function is provided when `endCall` is included in the assistant's list of available tools (see configuration options [here](/api-reference/assistants/create#request.body.model.openai.tools.endCall)). The assistant can use this function to end the call.
34
44
35
45
```json
36
46
{
@@ -42,15 +52,19 @@ This function is provided when `endCallFunctionEnabled` is enabled on the assist
42
52
"role": "system",
43
53
"content": "You are an assistant at a law firm. If the user is being mean, use the endCall function."
44
54
}
55
+
],
56
+
"tools": [
57
+
{
58
+
"type": "endCall"
59
+
}
45
60
]
46
-
},
47
-
"endCallFunctionEnabled": true
61
+
}
48
62
}
49
63
```
50
64
51
-
#### Dial Keypad
65
+
#### Dial Keypad (DTMF)
52
66
53
-
This function is provided when `dialKeypadFunctionEnabled` is enabled on the assistant. The assistant will be able to enter digits on the keypad.
67
+
This function is provided when `dtmf` is included in the assistant's list of available tools (see configuration options [here](/api-reference/assistants/create#request.body.model.openai.tools.dtmf)). The assistant will be able to enter digits on the keypad.
54
68
55
69
```json
56
70
{
@@ -60,14 +74,18 @@ This function is provided when `dialKeypadFunctionEnabled` is enabled on the ass
60
74
"messages": [
61
75
{
62
76
"role": "system",
63
-
"content": "You are an assistant at a law firm. When you hit a menu, use the dialKeypad function to enter the digits."
77
+
"content": "You are an assistant at a law firm. When you hit a menu, use the dtmf function to enter the digits."
78
+
}
79
+
],
80
+
"tools": [
81
+
{
82
+
"type": "dtmf"
64
83
}
65
84
]
66
-
},
67
-
"dialKeypadFunctionEnabled": true
85
+
}
68
86
}
69
87
```
70
-
88
+
<Accordiontitle="Custom Functions: Deprecated">
71
89
### Custom Functions
72
90
73
91
<Warning>The **Custom Functions** feature is being deprecated in favor of [Tools](/tools-calling). Please refer to the **Tools** section instead. We're working on a solution to migrate your existing functions over to make this a seamless transtion.</Warning>
@@ -111,3 +129,4 @@ At the assistant level, the `serverUrl` can be specified in the assistant config
111
129
If the `serverUrl` is not defined either at the account level or the assistant level, the function call will simply be added to the chat history. This can be particularly useful when you want a function call to trigger an action on the frontend.
112
130
113
131
For instance, the frontend can listen for specific function calls in the chat history and respond by updating the user interface or performing other actions. This allows for a dynamic and interactive user experience, where the frontend can react to changes in the conversation in real time.
0 commit comments