Skip to content

Commit e2fb8ac

Browse files
committed
fix function calling guide
1 parent 8ff1b16 commit e2fb8ac

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

fern/assistants/function-calling.mdx

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ subtitle: 'Additional Capabilities for Your Assistants '
44
slug: assistants/function-calling
55
---
66

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.
88

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>
1010

1111
#### Transfer Call
1212

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)).
1414

1515
```json
1616
{
@@ -22,15 +22,25 @@ When a `forwardingPhoneNumber` is present on an assistant, the assistant will be
2222
"role": "system",
2323
"content": "You are an assistant at a law firm. When the user asks to be transferred, use the transferCall function."
2424
}
25+
],
26+
"tools": [
27+
{
28+
"type": "transferCall".
29+
"destinations" : {
30+
{
31+
"type": "number",
32+
"number": "+16054440129"
33+
}
34+
}
35+
}
2536
]
26-
},
27-
"forwardingPhoneNumber": "+16054440129"
37+
}
2838
}
2939
```
3040

3141
#### End Call
3242

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.
3444

3545
```json
3646
{
@@ -42,15 +52,19 @@ This function is provided when `endCallFunctionEnabled` is enabled on the assist
4252
"role": "system",
4353
"content": "You are an assistant at a law firm. If the user is being mean, use the endCall function."
4454
}
55+
],
56+
"tools": [
57+
{
58+
"type": "endCall"
59+
}
4560
]
46-
},
47-
"endCallFunctionEnabled": true
61+
}
4862
}
4963
```
5064

51-
#### Dial Keypad
65+
#### Dial Keypad (DTMF)
5266

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.
5468

5569
```json
5670
{
@@ -60,14 +74,18 @@ This function is provided when `dialKeypadFunctionEnabled` is enabled on the ass
6074
"messages": [
6175
{
6276
"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"
6483
}
6584
]
66-
},
67-
"dialKeypadFunctionEnabled": true
85+
}
6886
}
6987
```
70-
88+
<Accordion title="Custom Functions: Deprecated">
7189
### Custom Functions
7290

7391
<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
111129
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.
112130

113131
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.
132+
</Accordion>

0 commit comments

Comments
 (0)