Skip to content

Commit c346328

Browse files
cursoragentsahil
andcommitted
Refactor tool rejection plan example to use model.tools configuration
Co-authored-by: sahil <[email protected]>
1 parent 817e258 commit c346328

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

fern/tools/tool-rejection-plan.mdx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -112,42 +112,38 @@ Wired into a rejection plan:
112112
}
113113
```
114114

115-
## Using it in assistant hooks
115+
## Normal tool call example
116116

117-
Attach `rejectionPlan` to any tool call inside a hook:
117+
Attach `rejectionPlan` directly on a tool in your assistant configuration (`model.tools`):
118118

119119
```json
120120
{
121-
"hooks": [
122-
{
123-
"on": "call.ending",
124-
"do": [
125-
{
126-
"type": "tool",
127-
"tool": {
128-
"type": "endCall",
129-
"rejectionPlan": {
130-
"conditions": [
131-
{
132-
"type": "regex",
133-
"regex": "(?i)\\b(bye|goodbye|farewell|see you later|take care)\\b",
134-
"target": { "position": -1, "role": "user" },
135-
"negate": true
136-
}
137-
]
121+
"model": {
122+
"provider": "openai",
123+
"model": "gpt-4o",
124+
"messages": [
125+
{ "role": "system", "content": "Only end the call after the user says goodbye." }
126+
],
127+
"tools": [
128+
{
129+
"type": "endCall",
130+
"rejectionPlan": {
131+
"conditions": [
132+
{
133+
"type": "regex",
134+
"regex": "(?i)\\b(bye|goodbye|farewell|see you later|take care)\\b",
135+
"target": { "position": -1, "role": "user" },
136+
"negate": true
138137
}
139-
}
138+
]
140139
}
141-
]
142-
}
143-
]
140+
}
141+
]
142+
}
144143
}
145144
```
146-
147145
## Tips
148146

149147
- Escape backslashes in regex patterns: write `\\b` in JSON to mean `\b` in the regex engine.
150148
- `position: -1` targets the most recent message. Omit `role` to target regardless of role.
151-
- Prefer a `group` with `operator: "OR"` for disjunctive logic at the top level.
152-
153-
See also: [Swagger](https://api.vapi.ai/api), [OpenAPI JSON](https://api.vapi.ai/api-json).
149+
- Prefer a `group` with `operator: "OR"` for disjunctive logic at the top level.

0 commit comments

Comments
 (0)