retell-sdk 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/LICENSE +201 -0
  3. package/README.md +304 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +90 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +237 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +868 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +837 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +53 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +143 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +127 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +133 -0
  87. package/index.d.ts +133 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +117 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +89 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +107 -0
  94. package/resource.d.ts +6 -0
  95. package/resource.d.ts.map +1 -0
  96. package/resource.js +11 -0
  97. package/resource.js.map +1 -0
  98. package/resource.mjs +7 -0
  99. package/resource.mjs.map +1 -0
  100. package/resources/agent.d.ts +372 -0
  101. package/resources/agent.d.ts.map +1 -0
  102. package/resources/agent.js +44 -0
  103. package/resources/agent.js.map +1 -0
  104. package/resources/agent.mjs +40 -0
  105. package/resources/agent.mjs.map +1 -0
  106. package/resources/call.d.ts +461 -0
  107. package/resources/call.d.ts.map +1 -0
  108. package/resources/call.js +36 -0
  109. package/resources/call.js.map +1 -0
  110. package/resources/call.mjs +32 -0
  111. package/resources/call.mjs.map +1 -0
  112. package/resources/index.d.ts +5 -0
  113. package/resources/index.d.ts.map +1 -0
  114. package/resources/index.js +13 -0
  115. package/resources/index.js.map +1 -0
  116. package/resources/index.mjs +6 -0
  117. package/resources/index.mjs.map +1 -0
  118. package/resources/llm.d.ts +1355 -0
  119. package/resources/llm.d.ts.map +1 -0
  120. package/resources/llm.js +44 -0
  121. package/resources/llm.js.map +1 -0
  122. package/resources/llm.mjs +40 -0
  123. package/resources/llm.mjs.map +1 -0
  124. package/resources/phone-number.d.ts +78 -0
  125. package/resources/phone-number.d.ts.map +1 -0
  126. package/resources/phone-number.js +44 -0
  127. package/resources/phone-number.js.map +1 -0
  128. package/resources/phone-number.mjs +40 -0
  129. package/resources/phone-number.mjs.map +1 -0
  130. package/shims/node.d.ts +29 -0
  131. package/shims/node.d.ts.map +1 -0
  132. package/shims/node.js +31 -0
  133. package/shims/node.js.map +1 -0
  134. package/shims/node.mjs +5 -0
  135. package/shims/node.mjs.map +1 -0
  136. package/shims/web.d.ts +26 -0
  137. package/shims/web.d.ts.map +1 -0
  138. package/shims/web.js +31 -0
  139. package/shims/web.js.map +1 -0
  140. package/shims/web.mjs +5 -0
  141. package/shims/web.mjs.map +1 -0
  142. package/src/_shims/MultipartBody.ts +9 -0
  143. package/src/_shims/README.md +46 -0
  144. package/src/_shims/auto/runtime-bun.ts +4 -0
  145. package/src/_shims/auto/runtime-node.ts +4 -0
  146. package/src/_shims/auto/runtime.ts +4 -0
  147. package/src/_shims/auto/types-node.ts +4 -0
  148. package/src/_shims/auto/types.d.ts +101 -0
  149. package/src/_shims/auto/types.js +3 -0
  150. package/src/_shims/auto/types.mjs +3 -0
  151. package/src/_shims/bun-runtime.ts +14 -0
  152. package/src/_shims/index.d.ts +81 -0
  153. package/src/_shims/index.js +13 -0
  154. package/src/_shims/index.mjs +7 -0
  155. package/src/_shims/manual-types.d.ts +12 -0
  156. package/src/_shims/manual-types.js +3 -0
  157. package/src/_shims/manual-types.mjs +3 -0
  158. package/src/_shims/node-runtime.ts +83 -0
  159. package/src/_shims/node-types.d.ts +42 -0
  160. package/src/_shims/node-types.js +3 -0
  161. package/src/_shims/node-types.mjs +3 -0
  162. package/src/_shims/registry.ts +67 -0
  163. package/src/_shims/web-runtime.ts +103 -0
  164. package/src/_shims/web-types.d.ts +83 -0
  165. package/src/_shims/web-types.js +3 -0
  166. package/src/_shims/web-types.mjs +3 -0
  167. package/src/core.ts +1146 -0
  168. package/src/error.ts +146 -0
  169. package/src/index.ts +215 -0
  170. package/src/lib/.keep +4 -0
  171. package/src/resource.ts +11 -0
  172. package/src/resources/agent.ts +468 -0
  173. package/src/resources/call.ts +542 -0
  174. package/src/resources/index.ts +21 -0
  175. package/src/resources/llm.ts +1643 -0
  176. package/src/resources/phone-number.ts +111 -0
  177. package/src/shims/node.ts +50 -0
  178. package/src/shims/web.ts +50 -0
  179. package/src/tsconfig.json +11 -0
  180. package/src/uploads.ts +248 -0
  181. package/src/version.ts +1 -0
  182. package/uploads.d.ts +75 -0
  183. package/uploads.d.ts.map +1 -0
  184. package/uploads.js +165 -0
  185. package/uploads.js.map +1 -0
  186. package/uploads.mjs +152 -0
  187. package/uploads.mjs.map +1 -0
  188. package/version.d.ts +2 -0
  189. package/version.d.ts.map +1 -0
  190. package/version.js +5 -0
  191. package/version.js.map +1 -0
  192. package/version.mjs +2 -0
  193. package/version.mjs.map +1 -0
@@ -0,0 +1,1643 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import * as Core from "../core";
4
+ import { APIResource } from "../resource";
5
+ import * as LlmAPI from "./llm";
6
+
7
+ export class Llm extends APIResource {
8
+ /**
9
+ * Create a new Retell LLM
10
+ */
11
+ create(body: LlmCreateParams, options?: Core.RequestOptions): Core.APIPromise<LlmResponse> {
12
+ return this._client.post('/create-retell-llm', { body, ...options });
13
+ }
14
+
15
+ /**
16
+ * Retrieve details of a specific Retell LLM
17
+ */
18
+ retrieve(llmId: string, options?: Core.RequestOptions): Core.APIPromise<LlmResponse> {
19
+ return this._client.get(`/get-retell-llm/${llmId}`, options);
20
+ }
21
+
22
+ /**
23
+ * Update an existing Retell LLM
24
+ */
25
+ update(llmId: string, body: LlmUpdateParams, options?: Core.RequestOptions): Core.APIPromise<LlmResponse> {
26
+ return this._client.patch(`/update-retell-llm/${llmId}`, { body, ...options });
27
+ }
28
+
29
+ /**
30
+ * List all retell LLM
31
+ */
32
+ list(options?: Core.RequestOptions): Core.APIPromise<LlmListResponse> {
33
+ return this._client.get('/list-retell-llms', options);
34
+ }
35
+
36
+ /**
37
+ * Delete an existing Retell LLM
38
+ */
39
+ delete(llmId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
40
+ return this._client.delete(`/delete-retell-llm/${llmId}`, {
41
+ ...options,
42
+ headers: { Accept: '*/*', ...options?.headers },
43
+ });
44
+ }
45
+ }
46
+
47
+ export interface LlmResponse {
48
+ /**
49
+ * Last modification timestamp (milliseconds since epoch). Either the time of last
50
+ * update or creation if no updates available.
51
+ */
52
+ last_modification_timestamp: number;
53
+
54
+ /**
55
+ * Unique id of Retell LLM.
56
+ */
57
+ llm_id: string;
58
+
59
+ /**
60
+ * The LLM Websocket URL constructed from unique id of Retell LLM. Used in agent
61
+ * API to create / update agent.
62
+ */
63
+ llm_websocket_url: string;
64
+
65
+ /**
66
+ * First utterance said by the agent in the call. If not set, LLM will dynamically
67
+ * generate a message. If set to "", agent will wait for user to speak first.
68
+ */
69
+ begin_message?: string;
70
+
71
+ /**
72
+ * General prompt that's appended to system prompt no matter what state the agent
73
+ * is in.
74
+ *
75
+ * - System prompt (with state) = general prompt + state prompt.
76
+ *
77
+ * - System prompt (no state) = general prompt.
78
+ */
79
+ general_prompt?: string;
80
+
81
+ /**
82
+ * A list of tools the model may call (to get external knowledge, call API, etc).
83
+ * You can select from some common predefined tools like end call, transfer call,
84
+ * etc; or you can create your own custom tool (last option) for the LLM to use.
85
+ *
86
+ * - Tools of LLM (with state) = general tools + state tools + state transitions
87
+ *
88
+ * - Tools of LLM (no state) = general tools
89
+ */
90
+ general_tools?: Array<
91
+ | LlmResponse.EndCallTool
92
+ | LlmResponse.TransferCallTool
93
+ | LlmResponse.CheckAvailabilityCalTool
94
+ | LlmResponse.BookAppointmentCalTool
95
+ | LlmResponse.CustomTool
96
+ >;
97
+
98
+ /**
99
+ * Name of the starting state. Required if states is not empty.
100
+ */
101
+ starting_state?: string;
102
+
103
+ /**
104
+ * States of the LLM. This is to help reduce prompt length and tool choices when
105
+ * the call can be broken into distinct states. With shorter prompts and less
106
+ * tools, the LLM can better focus and follow the rules, minimizing hallucination.
107
+ * If this field is not set, the agent would only have general prompt and general
108
+ * tools (essentially one state).
109
+ */
110
+ states?: Array<LlmResponse.State>;
111
+ }
112
+
113
+ export namespace LlmResponse {
114
+ export interface EndCallTool {
115
+ /**
116
+ * Name of the tool. Must be unique within all tools available to LLM at any given
117
+ * time (general tools + state tools + state transitions).
118
+ */
119
+ name: string;
120
+
121
+ type: 'end_call';
122
+
123
+ /**
124
+ * Describes when to end the call.
125
+ */
126
+ description?: string;
127
+ }
128
+
129
+ export interface TransferCallTool {
130
+ /**
131
+ * Name of the tool. Must be unique within all tools available to LLM at any given
132
+ * time (general tools + state tools + state edges).
133
+ */
134
+ name: string;
135
+
136
+ /**
137
+ * The number to transfer to in E.164 format (a + and country code, then the phone
138
+ * number with no space or other special characters). For example, +16175551212.
139
+ */
140
+ number: string;
141
+
142
+ type: 'transfer_call';
143
+
144
+ /**
145
+ * Describes when to transfer the call.
146
+ */
147
+ description?: string;
148
+ }
149
+
150
+ export interface CheckAvailabilityCalTool {
151
+ /**
152
+ * Cal.com Api key that have access to the cal.com event you want to check
153
+ * availability for.
154
+ */
155
+ cal_api_key: string;
156
+
157
+ /**
158
+ * Cal.com event type id number for the cal.com event you want to check
159
+ * availability for.
160
+ */
161
+ event_type_id: number;
162
+
163
+ /**
164
+ * Name of the tool. Must be unique within all tools available to LLM at any given
165
+ * time (general tools + state tools + state transitions).
166
+ */
167
+ name: string;
168
+
169
+ type: 'check_availability_cal';
170
+
171
+ /**
172
+ * Describes when to check availability.
173
+ */
174
+ description?: string;
175
+
176
+ /**
177
+ * Timezone to be used when checking availability, must be in
178
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
179
+ * If not specified, will check if user specified timezone in call, and if not,
180
+ * will use the timezone of the Retell servers.
181
+ */
182
+ timezone?: string;
183
+ }
184
+
185
+ export interface BookAppointmentCalTool {
186
+ /**
187
+ * Cal.com Api key that have access to the cal.com event you want to book
188
+ * appointment.
189
+ */
190
+ cal_api_key: string;
191
+
192
+ /**
193
+ * Cal.com event type id number for the cal.com event you want to book appointment.
194
+ */
195
+ event_type_id: number;
196
+
197
+ /**
198
+ * Name of the tool. Must be unique within all tools available to LLM at any given
199
+ * time (general tools + state tools + state transitions).
200
+ */
201
+ name: string;
202
+
203
+ type: 'book_appointment_cal';
204
+
205
+ /**
206
+ * Describes when to book the appointment.
207
+ */
208
+ description?: string;
209
+
210
+ /**
211
+ * Timezone to be used when booking appointment, must be in
212
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
213
+ * If not specified, will check if user specified timezone in call, and if not,
214
+ * will use the timezone of the Retell servers.
215
+ */
216
+ timezone?: string;
217
+ }
218
+
219
+ export interface CustomTool {
220
+ /**
221
+ * Describes what this tool does and when to call this tool.
222
+ */
223
+ description: string;
224
+
225
+ /**
226
+ * Name of the tool. Must be unique within all tools available to LLM at any given
227
+ * time (general tools + state tools + state edges).
228
+ */
229
+ name: string;
230
+
231
+ /**
232
+ * Determines whether the agent would call LLM another time and speak when the
233
+ * result of function is obtained. Usually this needs to get turned on so user can
234
+ * get update for the function call.
235
+ */
236
+ speak_after_execution: boolean;
237
+
238
+ /**
239
+ * Determines whether the agent would say sentence like "One moment, let me check
240
+ * that." when executing the function. Recommend to turn on if your function call
241
+ * takes over 1s (including network) to complete, so that your agent remains
242
+ * responsive.
243
+ */
244
+ speak_during_execution: boolean;
245
+
246
+ type: 'custom';
247
+
248
+ /**
249
+ * The URL we will post the function name and arguments to get a result for the
250
+ * function. Usually this is your server.
251
+ */
252
+ url: string;
253
+
254
+ /**
255
+ * The description for the sentence agent say during execution. Only applicable
256
+ * when speak_during_execution is true. Can write what to say or even provide
257
+ * examples. The default is "The message you will say to callee when calling this
258
+ * tool. Make sure it fits into the conversation smoothly.".
259
+ */
260
+ execution_message_description?: string;
261
+
262
+ /**
263
+ * The parameters the functions accepts, described as a JSON Schema object. See
264
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
265
+ * documentation about the format. Omitting parameters defines a function with an
266
+ * empty parameter list.
267
+ */
268
+ parameters?: CustomTool.Parameters;
269
+ }
270
+
271
+ export namespace CustomTool {
272
+ /**
273
+ * The parameters the functions accepts, described as a JSON Schema object. See
274
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
275
+ * documentation about the format. Omitting parameters defines a function with an
276
+ * empty parameter list.
277
+ */
278
+ export interface Parameters {
279
+ /**
280
+ * The value of properties is an object, where each key is the name of a property
281
+ * and each value is a schema used to validate that property.
282
+ */
283
+ properties: Record<string, unknown>;
284
+
285
+ /**
286
+ * Type must be "object" for a JSON Schema object.
287
+ */
288
+ type: 'object';
289
+
290
+ /**
291
+ * List of names of required property when generating this parameter. LLM will do
292
+ * its best to generate the required properties in its function arguments. Property
293
+ * must exist in properties.
294
+ */
295
+ required?: Array<string>;
296
+ }
297
+ }
298
+
299
+ export interface State {
300
+ /**
301
+ * Name of the state, must be unique for each state.
302
+ */
303
+ name: string;
304
+
305
+ /**
306
+ * Edges of the state define how and what state can be reached from this state.
307
+ */
308
+ edges?: Array<State.Edge>;
309
+
310
+ /**
311
+ * Prompt of the state, will be appended to the system prompt of LLM.
312
+ *
313
+ * - System prompt = general prompt + state prompt.
314
+ */
315
+ state_prompt?: string;
316
+
317
+ /**
318
+ * A list of tools specific to this state the model may call (to get external
319
+ * knowledge, call API, etc). You can select from some common predefined tools like
320
+ * end call, transfer call, etc; or you can create your own custom tool (last
321
+ * option) for the LLM to use.
322
+ *
323
+ * - Tools of LLM = general tools + state tools + state transitions
324
+ */
325
+ tools?: Array<
326
+ | State.EndCallTool
327
+ | State.TransferCallTool
328
+ | State.CheckAvailabilityCalTool
329
+ | State.BookAppointmentCalTool
330
+ | State.CustomTool
331
+ >;
332
+ }
333
+
334
+ export namespace State {
335
+ export interface Edge {
336
+ /**
337
+ * Describes what's the transition and at what time / criteria should this
338
+ * transition happen.
339
+ */
340
+ description: string;
341
+
342
+ /**
343
+ * The destination state name when going through transition of state via this edge.
344
+ * State transition internally is implemented as a tool call of LLM, and a tool
345
+ * call with name "transition*to*{destination_state_name}" will get created. Feel
346
+ * free to reference it inside the prompt.
347
+ */
348
+ destination_state_name: string;
349
+
350
+ /**
351
+ * After the state transitions, the agent would speak based on the new prompt and
352
+ * tools in the new state. This bit here controls whether to speak a transition
353
+ * sentence during the transition (so agent would say sentences like "Let's move on
354
+ * to the next section to help you set up an acount.", and state transitions, and
355
+ * agent continue to speak.). Usually this is not necessary, and is recommended to
356
+ * set to false to avoid LLM repeating itself during and after transition.
357
+ */
358
+ speak_during_transition: boolean;
359
+
360
+ /**
361
+ * Describes what parameters you want to extract out when the transition changes.
362
+ * The parameters extracted here can be referenced in prompts & function
363
+ * descriptions of later states via dynamic variables. The parameters the functions
364
+ * accepts, described as a JSON Schema object. See
365
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
366
+ * documentation about the format.
367
+ */
368
+ parameters?: Edge.Parameters;
369
+ }
370
+
371
+ export namespace Edge {
372
+ /**
373
+ * Describes what parameters you want to extract out when the transition changes.
374
+ * The parameters extracted here can be referenced in prompts & function
375
+ * descriptions of later states via dynamic variables. The parameters the functions
376
+ * accepts, described as a JSON Schema object. See
377
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
378
+ * documentation about the format.
379
+ */
380
+ export interface Parameters {
381
+ /**
382
+ * The value of properties is an object, where each key is the name of a property
383
+ * and each value is a schema used to validate that property.
384
+ */
385
+ properties: Record<string, unknown>;
386
+
387
+ /**
388
+ * Type must be "object" for a JSON Schema object.
389
+ */
390
+ type: 'object';
391
+
392
+ /**
393
+ * List of names of required property when generating this parameter. LLM will do
394
+ * its best to generate the required properties in its function arguments. Property
395
+ * must exist in properties.
396
+ */
397
+ required?: Array<string>;
398
+ }
399
+ }
400
+
401
+ export interface EndCallTool {
402
+ /**
403
+ * Name of the tool. Must be unique within all tools available to LLM at any given
404
+ * time (general tools + state tools + state transitions).
405
+ */
406
+ name: string;
407
+
408
+ type: 'end_call';
409
+
410
+ /**
411
+ * Describes when to end the call.
412
+ */
413
+ description?: string;
414
+ }
415
+
416
+ export interface TransferCallTool {
417
+ /**
418
+ * Name of the tool. Must be unique within all tools available to LLM at any given
419
+ * time (general tools + state tools + state edges).
420
+ */
421
+ name: string;
422
+
423
+ /**
424
+ * The number to transfer to in E.164 format (a + and country code, then the phone
425
+ * number with no space or other special characters). For example, +16175551212.
426
+ */
427
+ number: string;
428
+
429
+ type: 'transfer_call';
430
+
431
+ /**
432
+ * Describes when to transfer the call.
433
+ */
434
+ description?: string;
435
+ }
436
+
437
+ export interface CheckAvailabilityCalTool {
438
+ /**
439
+ * Cal.com Api key that have access to the cal.com event you want to check
440
+ * availability for.
441
+ */
442
+ cal_api_key: string;
443
+
444
+ /**
445
+ * Cal.com event type id number for the cal.com event you want to check
446
+ * availability for.
447
+ */
448
+ event_type_id: number;
449
+
450
+ /**
451
+ * Name of the tool. Must be unique within all tools available to LLM at any given
452
+ * time (general tools + state tools + state transitions).
453
+ */
454
+ name: string;
455
+
456
+ type: 'check_availability_cal';
457
+
458
+ /**
459
+ * Describes when to check availability.
460
+ */
461
+ description?: string;
462
+
463
+ /**
464
+ * Timezone to be used when checking availability, must be in
465
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
466
+ * If not specified, will check if user specified timezone in call, and if not,
467
+ * will use the timezone of the Retell servers.
468
+ */
469
+ timezone?: string;
470
+ }
471
+
472
+ export interface BookAppointmentCalTool {
473
+ /**
474
+ * Cal.com Api key that have access to the cal.com event you want to book
475
+ * appointment.
476
+ */
477
+ cal_api_key: string;
478
+
479
+ /**
480
+ * Cal.com event type id number for the cal.com event you want to book appointment.
481
+ */
482
+ event_type_id: number;
483
+
484
+ /**
485
+ * Name of the tool. Must be unique within all tools available to LLM at any given
486
+ * time (general tools + state tools + state transitions).
487
+ */
488
+ name: string;
489
+
490
+ type: 'book_appointment_cal';
491
+
492
+ /**
493
+ * Describes when to book the appointment.
494
+ */
495
+ description?: string;
496
+
497
+ /**
498
+ * Timezone to be used when booking appointment, must be in
499
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
500
+ * If not specified, will check if user specified timezone in call, and if not,
501
+ * will use the timezone of the Retell servers.
502
+ */
503
+ timezone?: string;
504
+ }
505
+
506
+ export interface CustomTool {
507
+ /**
508
+ * Describes what this tool does and when to call this tool.
509
+ */
510
+ description: string;
511
+
512
+ /**
513
+ * Name of the tool. Must be unique within all tools available to LLM at any given
514
+ * time (general tools + state tools + state edges).
515
+ */
516
+ name: string;
517
+
518
+ /**
519
+ * Determines whether the agent would call LLM another time and speak when the
520
+ * result of function is obtained. Usually this needs to get turned on so user can
521
+ * get update for the function call.
522
+ */
523
+ speak_after_execution: boolean;
524
+
525
+ /**
526
+ * Determines whether the agent would say sentence like "One moment, let me check
527
+ * that." when executing the function. Recommend to turn on if your function call
528
+ * takes over 1s (including network) to complete, so that your agent remains
529
+ * responsive.
530
+ */
531
+ speak_during_execution: boolean;
532
+
533
+ type: 'custom';
534
+
535
+ /**
536
+ * The URL we will post the function name and arguments to get a result for the
537
+ * function. Usually this is your server.
538
+ */
539
+ url: string;
540
+
541
+ /**
542
+ * The description for the sentence agent say during execution. Only applicable
543
+ * when speak_during_execution is true. Can write what to say or even provide
544
+ * examples. The default is "The message you will say to callee when calling this
545
+ * tool. Make sure it fits into the conversation smoothly.".
546
+ */
547
+ execution_message_description?: string;
548
+
549
+ /**
550
+ * The parameters the functions accepts, described as a JSON Schema object. See
551
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
552
+ * documentation about the format. Omitting parameters defines a function with an
553
+ * empty parameter list.
554
+ */
555
+ parameters?: CustomTool.Parameters;
556
+ }
557
+
558
+ export namespace CustomTool {
559
+ /**
560
+ * The parameters the functions accepts, described as a JSON Schema object. See
561
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
562
+ * documentation about the format. Omitting parameters defines a function with an
563
+ * empty parameter list.
564
+ */
565
+ export interface Parameters {
566
+ /**
567
+ * The value of properties is an object, where each key is the name of a property
568
+ * and each value is a schema used to validate that property.
569
+ */
570
+ properties: Record<string, unknown>;
571
+
572
+ /**
573
+ * Type must be "object" for a JSON Schema object.
574
+ */
575
+ type: 'object';
576
+
577
+ /**
578
+ * List of names of required property when generating this parameter. LLM will do
579
+ * its best to generate the required properties in its function arguments. Property
580
+ * must exist in properties.
581
+ */
582
+ required?: Array<string>;
583
+ }
584
+ }
585
+ }
586
+ }
587
+
588
+ export type LlmListResponse = Array<LlmResponse>;
589
+
590
+ export interface LlmCreateParams {
591
+ /**
592
+ * First utterance said by the agent in the call. If not set, LLM will dynamically
593
+ * generate a message. If set to "", agent will wait for user to speak first.
594
+ */
595
+ begin_message?: string;
596
+
597
+ /**
598
+ * General prompt that's appended to system prompt no matter what state the agent
599
+ * is in.
600
+ *
601
+ * - System prompt (with state) = general prompt + state prompt.
602
+ *
603
+ * - System prompt (no state) = general prompt.
604
+ */
605
+ general_prompt?: string;
606
+
607
+ /**
608
+ * A list of tools the model may call (to get external knowledge, call API, etc).
609
+ * You can select from some common predefined tools like end call, transfer call,
610
+ * etc; or you can create your own custom tool (last option) for the LLM to use.
611
+ *
612
+ * - Tools of LLM (with state) = general tools + state tools + state transitions
613
+ *
614
+ * - Tools of LLM (no state) = general tools
615
+ */
616
+ general_tools?: Array<
617
+ | LlmCreateParams.EndCallTool
618
+ | LlmCreateParams.TransferCallTool
619
+ | LlmCreateParams.CheckAvailabilityCalTool
620
+ | LlmCreateParams.BookAppointmentCalTool
621
+ | LlmCreateParams.CustomTool
622
+ >;
623
+
624
+ /**
625
+ * Name of the starting state. Required if states is not empty.
626
+ */
627
+ starting_state?: string;
628
+
629
+ /**
630
+ * States of the LLM. This is to help reduce prompt length and tool choices when
631
+ * the call can be broken into distinct states. With shorter prompts and less
632
+ * tools, the LLM can better focus and follow the rules, minimizing hallucination.
633
+ * If this field is not set, the agent would only have general prompt and general
634
+ * tools (essentially one state).
635
+ */
636
+ states?: Array<LlmCreateParams.State>;
637
+ }
638
+
639
+ export namespace LlmCreateParams {
640
+ export interface EndCallTool {
641
+ /**
642
+ * Name of the tool. Must be unique within all tools available to LLM at any given
643
+ * time (general tools + state tools + state transitions).
644
+ */
645
+ name: string;
646
+
647
+ type: 'end_call';
648
+
649
+ /**
650
+ * Describes when to end the call.
651
+ */
652
+ description?: string;
653
+ }
654
+
655
+ export interface TransferCallTool {
656
+ /**
657
+ * Name of the tool. Must be unique within all tools available to LLM at any given
658
+ * time (general tools + state tools + state edges).
659
+ */
660
+ name: string;
661
+
662
+ /**
663
+ * The number to transfer to in E.164 format (a + and country code, then the phone
664
+ * number with no space or other special characters). For example, +16175551212.
665
+ */
666
+ number: string;
667
+
668
+ type: 'transfer_call';
669
+
670
+ /**
671
+ * Describes when to transfer the call.
672
+ */
673
+ description?: string;
674
+ }
675
+
676
+ export interface CheckAvailabilityCalTool {
677
+ /**
678
+ * Cal.com Api key that have access to the cal.com event you want to check
679
+ * availability for.
680
+ */
681
+ cal_api_key: string;
682
+
683
+ /**
684
+ * Cal.com event type id number for the cal.com event you want to check
685
+ * availability for.
686
+ */
687
+ event_type_id: number;
688
+
689
+ /**
690
+ * Name of the tool. Must be unique within all tools available to LLM at any given
691
+ * time (general tools + state tools + state transitions).
692
+ */
693
+ name: string;
694
+
695
+ type: 'check_availability_cal';
696
+
697
+ /**
698
+ * Describes when to check availability.
699
+ */
700
+ description?: string;
701
+
702
+ /**
703
+ * Timezone to be used when checking availability, must be in
704
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
705
+ * If not specified, will check if user specified timezone in call, and if not,
706
+ * will use the timezone of the Retell servers.
707
+ */
708
+ timezone?: string;
709
+ }
710
+
711
+ export interface BookAppointmentCalTool {
712
+ /**
713
+ * Cal.com Api key that have access to the cal.com event you want to book
714
+ * appointment.
715
+ */
716
+ cal_api_key: string;
717
+
718
+ /**
719
+ * Cal.com event type id number for the cal.com event you want to book appointment.
720
+ */
721
+ event_type_id: number;
722
+
723
+ /**
724
+ * Name of the tool. Must be unique within all tools available to LLM at any given
725
+ * time (general tools + state tools + state transitions).
726
+ */
727
+ name: string;
728
+
729
+ type: 'book_appointment_cal';
730
+
731
+ /**
732
+ * Describes when to book the appointment.
733
+ */
734
+ description?: string;
735
+
736
+ /**
737
+ * Timezone to be used when booking appointment, must be in
738
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
739
+ * If not specified, will check if user specified timezone in call, and if not,
740
+ * will use the timezone of the Retell servers.
741
+ */
742
+ timezone?: string;
743
+ }
744
+
745
+ export interface CustomTool {
746
+ /**
747
+ * Describes what this tool does and when to call this tool.
748
+ */
749
+ description: string;
750
+
751
+ /**
752
+ * Name of the tool. Must be unique within all tools available to LLM at any given
753
+ * time (general tools + state tools + state edges).
754
+ */
755
+ name: string;
756
+
757
+ /**
758
+ * Determines whether the agent would call LLM another time and speak when the
759
+ * result of function is obtained. Usually this needs to get turned on so user can
760
+ * get update for the function call.
761
+ */
762
+ speak_after_execution: boolean;
763
+
764
+ /**
765
+ * Determines whether the agent would say sentence like "One moment, let me check
766
+ * that." when executing the function. Recommend to turn on if your function call
767
+ * takes over 1s (including network) to complete, so that your agent remains
768
+ * responsive.
769
+ */
770
+ speak_during_execution: boolean;
771
+
772
+ type: 'custom';
773
+
774
+ /**
775
+ * The URL we will post the function name and arguments to get a result for the
776
+ * function. Usually this is your server.
777
+ */
778
+ url: string;
779
+
780
+ /**
781
+ * The description for the sentence agent say during execution. Only applicable
782
+ * when speak_during_execution is true. Can write what to say or even provide
783
+ * examples. The default is "The message you will say to callee when calling this
784
+ * tool. Make sure it fits into the conversation smoothly.".
785
+ */
786
+ execution_message_description?: string;
787
+
788
+ /**
789
+ * The parameters the functions accepts, described as a JSON Schema object. See
790
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
791
+ * documentation about the format. Omitting parameters defines a function with an
792
+ * empty parameter list.
793
+ */
794
+ parameters?: CustomTool.Parameters;
795
+ }
796
+
797
+ export namespace CustomTool {
798
+ /**
799
+ * The parameters the functions accepts, described as a JSON Schema object. See
800
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
801
+ * documentation about the format. Omitting parameters defines a function with an
802
+ * empty parameter list.
803
+ */
804
+ export interface Parameters {
805
+ /**
806
+ * The value of properties is an object, where each key is the name of a property
807
+ * and each value is a schema used to validate that property.
808
+ */
809
+ properties: Record<string, unknown>;
810
+
811
+ /**
812
+ * Type must be "object" for a JSON Schema object.
813
+ */
814
+ type: 'object';
815
+
816
+ /**
817
+ * List of names of required property when generating this parameter. LLM will do
818
+ * its best to generate the required properties in its function arguments. Property
819
+ * must exist in properties.
820
+ */
821
+ required?: Array<string>;
822
+ }
823
+ }
824
+
825
+ export interface State {
826
+ /**
827
+ * Name of the state, must be unique for each state.
828
+ */
829
+ name: string;
830
+
831
+ /**
832
+ * Edges of the state define how and what state can be reached from this state.
833
+ */
834
+ edges?: Array<State.Edge>;
835
+
836
+ /**
837
+ * Prompt of the state, will be appended to the system prompt of LLM.
838
+ *
839
+ * - System prompt = general prompt + state prompt.
840
+ */
841
+ state_prompt?: string;
842
+
843
+ /**
844
+ * A list of tools specific to this state the model may call (to get external
845
+ * knowledge, call API, etc). You can select from some common predefined tools like
846
+ * end call, transfer call, etc; or you can create your own custom tool (last
847
+ * option) for the LLM to use.
848
+ *
849
+ * - Tools of LLM = general tools + state tools + state transitions
850
+ */
851
+ tools?: Array<
852
+ | State.EndCallTool
853
+ | State.TransferCallTool
854
+ | State.CheckAvailabilityCalTool
855
+ | State.BookAppointmentCalTool
856
+ | State.CustomTool
857
+ >;
858
+ }
859
+
860
+ export namespace State {
861
+ export interface Edge {
862
+ /**
863
+ * Describes what's the transition and at what time / criteria should this
864
+ * transition happen.
865
+ */
866
+ description: string;
867
+
868
+ /**
869
+ * The destination state name when going through transition of state via this edge.
870
+ * State transition internally is implemented as a tool call of LLM, and a tool
871
+ * call with name "transition*to*{destination_state_name}" will get created. Feel
872
+ * free to reference it inside the prompt.
873
+ */
874
+ destination_state_name: string;
875
+
876
+ /**
877
+ * After the state transitions, the agent would speak based on the new prompt and
878
+ * tools in the new state. This bit here controls whether to speak a transition
879
+ * sentence during the transition (so agent would say sentences like "Let's move on
880
+ * to the next section to help you set up an acount.", and state transitions, and
881
+ * agent continue to speak.). Usually this is not necessary, and is recommended to
882
+ * set to false to avoid LLM repeating itself during and after transition.
883
+ */
884
+ speak_during_transition: boolean;
885
+
886
+ /**
887
+ * Describes what parameters you want to extract out when the transition changes.
888
+ * The parameters extracted here can be referenced in prompts & function
889
+ * descriptions of later states via dynamic variables. The parameters the functions
890
+ * accepts, described as a JSON Schema object. See
891
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
892
+ * documentation about the format.
893
+ */
894
+ parameters?: Edge.Parameters;
895
+ }
896
+
897
+ export namespace Edge {
898
+ /**
899
+ * Describes what parameters you want to extract out when the transition changes.
900
+ * The parameters extracted here can be referenced in prompts & function
901
+ * descriptions of later states via dynamic variables. The parameters the functions
902
+ * accepts, described as a JSON Schema object. See
903
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
904
+ * documentation about the format.
905
+ */
906
+ export interface Parameters {
907
+ /**
908
+ * The value of properties is an object, where each key is the name of a property
909
+ * and each value is a schema used to validate that property.
910
+ */
911
+ properties: Record<string, unknown>;
912
+
913
+ /**
914
+ * Type must be "object" for a JSON Schema object.
915
+ */
916
+ type: 'object';
917
+
918
+ /**
919
+ * List of names of required property when generating this parameter. LLM will do
920
+ * its best to generate the required properties in its function arguments. Property
921
+ * must exist in properties.
922
+ */
923
+ required?: Array<string>;
924
+ }
925
+ }
926
+
927
+ export interface EndCallTool {
928
+ /**
929
+ * Name of the tool. Must be unique within all tools available to LLM at any given
930
+ * time (general tools + state tools + state transitions).
931
+ */
932
+ name: string;
933
+
934
+ type: 'end_call';
935
+
936
+ /**
937
+ * Describes when to end the call.
938
+ */
939
+ description?: string;
940
+ }
941
+
942
+ export interface TransferCallTool {
943
+ /**
944
+ * Name of the tool. Must be unique within all tools available to LLM at any given
945
+ * time (general tools + state tools + state edges).
946
+ */
947
+ name: string;
948
+
949
+ /**
950
+ * The number to transfer to in E.164 format (a + and country code, then the phone
951
+ * number with no space or other special characters). For example, +16175551212.
952
+ */
953
+ number: string;
954
+
955
+ type: 'transfer_call';
956
+
957
+ /**
958
+ * Describes when to transfer the call.
959
+ */
960
+ description?: string;
961
+ }
962
+
963
+ export interface CheckAvailabilityCalTool {
964
+ /**
965
+ * Cal.com Api key that have access to the cal.com event you want to check
966
+ * availability for.
967
+ */
968
+ cal_api_key: string;
969
+
970
+ /**
971
+ * Cal.com event type id number for the cal.com event you want to check
972
+ * availability for.
973
+ */
974
+ event_type_id: number;
975
+
976
+ /**
977
+ * Name of the tool. Must be unique within all tools available to LLM at any given
978
+ * time (general tools + state tools + state transitions).
979
+ */
980
+ name: string;
981
+
982
+ type: 'check_availability_cal';
983
+
984
+ /**
985
+ * Describes when to check availability.
986
+ */
987
+ description?: string;
988
+
989
+ /**
990
+ * Timezone to be used when checking availability, must be in
991
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
992
+ * If not specified, will check if user specified timezone in call, and if not,
993
+ * will use the timezone of the Retell servers.
994
+ */
995
+ timezone?: string;
996
+ }
997
+
998
+ export interface BookAppointmentCalTool {
999
+ /**
1000
+ * Cal.com Api key that have access to the cal.com event you want to book
1001
+ * appointment.
1002
+ */
1003
+ cal_api_key: string;
1004
+
1005
+ /**
1006
+ * Cal.com event type id number for the cal.com event you want to book appointment.
1007
+ */
1008
+ event_type_id: number;
1009
+
1010
+ /**
1011
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1012
+ * time (general tools + state tools + state transitions).
1013
+ */
1014
+ name: string;
1015
+
1016
+ type: 'book_appointment_cal';
1017
+
1018
+ /**
1019
+ * Describes when to book the appointment.
1020
+ */
1021
+ description?: string;
1022
+
1023
+ /**
1024
+ * Timezone to be used when booking appointment, must be in
1025
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
1026
+ * If not specified, will check if user specified timezone in call, and if not,
1027
+ * will use the timezone of the Retell servers.
1028
+ */
1029
+ timezone?: string;
1030
+ }
1031
+
1032
+ export interface CustomTool {
1033
+ /**
1034
+ * Describes what this tool does and when to call this tool.
1035
+ */
1036
+ description: string;
1037
+
1038
+ /**
1039
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1040
+ * time (general tools + state tools + state edges).
1041
+ */
1042
+ name: string;
1043
+
1044
+ /**
1045
+ * Determines whether the agent would call LLM another time and speak when the
1046
+ * result of function is obtained. Usually this needs to get turned on so user can
1047
+ * get update for the function call.
1048
+ */
1049
+ speak_after_execution: boolean;
1050
+
1051
+ /**
1052
+ * Determines whether the agent would say sentence like "One moment, let me check
1053
+ * that." when executing the function. Recommend to turn on if your function call
1054
+ * takes over 1s (including network) to complete, so that your agent remains
1055
+ * responsive.
1056
+ */
1057
+ speak_during_execution: boolean;
1058
+
1059
+ type: 'custom';
1060
+
1061
+ /**
1062
+ * The URL we will post the function name and arguments to get a result for the
1063
+ * function. Usually this is your server.
1064
+ */
1065
+ url: string;
1066
+
1067
+ /**
1068
+ * The description for the sentence agent say during execution. Only applicable
1069
+ * when speak_during_execution is true. Can write what to say or even provide
1070
+ * examples. The default is "The message you will say to callee when calling this
1071
+ * tool. Make sure it fits into the conversation smoothly.".
1072
+ */
1073
+ execution_message_description?: string;
1074
+
1075
+ /**
1076
+ * The parameters the functions accepts, described as a JSON Schema object. See
1077
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1078
+ * documentation about the format. Omitting parameters defines a function with an
1079
+ * empty parameter list.
1080
+ */
1081
+ parameters?: CustomTool.Parameters;
1082
+ }
1083
+
1084
+ export namespace CustomTool {
1085
+ /**
1086
+ * The parameters the functions accepts, described as a JSON Schema object. See
1087
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1088
+ * documentation about the format. Omitting parameters defines a function with an
1089
+ * empty parameter list.
1090
+ */
1091
+ export interface Parameters {
1092
+ /**
1093
+ * The value of properties is an object, where each key is the name of a property
1094
+ * and each value is a schema used to validate that property.
1095
+ */
1096
+ properties: Record<string, unknown>;
1097
+
1098
+ /**
1099
+ * Type must be "object" for a JSON Schema object.
1100
+ */
1101
+ type: 'object';
1102
+
1103
+ /**
1104
+ * List of names of required property when generating this parameter. LLM will do
1105
+ * its best to generate the required properties in its function arguments. Property
1106
+ * must exist in properties.
1107
+ */
1108
+ required?: Array<string>;
1109
+ }
1110
+ }
1111
+ }
1112
+ }
1113
+
1114
+ export interface LlmUpdateParams {
1115
+ /**
1116
+ * First utterance said by the agent in the call. If not set, LLM will dynamically
1117
+ * generate a message. If set to "", agent will wait for user to speak first.
1118
+ */
1119
+ begin_message?: string;
1120
+
1121
+ /**
1122
+ * General prompt that's appended to system prompt no matter what state the agent
1123
+ * is in.
1124
+ *
1125
+ * - System prompt (with state) = general prompt + state prompt.
1126
+ *
1127
+ * - System prompt (no state) = general prompt.
1128
+ */
1129
+ general_prompt?: string;
1130
+
1131
+ /**
1132
+ * A list of tools the model may call (to get external knowledge, call API, etc).
1133
+ * You can select from some common predefined tools like end call, transfer call,
1134
+ * etc; or you can create your own custom tool (last option) for the LLM to use.
1135
+ *
1136
+ * - Tools of LLM (with state) = general tools + state tools + state transitions
1137
+ *
1138
+ * - Tools of LLM (no state) = general tools
1139
+ */
1140
+ general_tools?: Array<
1141
+ | LlmUpdateParams.EndCallTool
1142
+ | LlmUpdateParams.TransferCallTool
1143
+ | LlmUpdateParams.CheckAvailabilityCalTool
1144
+ | LlmUpdateParams.BookAppointmentCalTool
1145
+ | LlmUpdateParams.CustomTool
1146
+ >;
1147
+
1148
+ /**
1149
+ * Name of the starting state. Required if states is not empty.
1150
+ */
1151
+ starting_state?: string;
1152
+
1153
+ /**
1154
+ * States of the LLM. This is to help reduce prompt length and tool choices when
1155
+ * the call can be broken into distinct states. With shorter prompts and less
1156
+ * tools, the LLM can better focus and follow the rules, minimizing hallucination.
1157
+ * If this field is not set, the agent would only have general prompt and general
1158
+ * tools (essentially one state).
1159
+ */
1160
+ states?: Array<LlmUpdateParams.State>;
1161
+ }
1162
+
1163
+ export namespace LlmUpdateParams {
1164
+ export interface EndCallTool {
1165
+ /**
1166
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1167
+ * time (general tools + state tools + state transitions).
1168
+ */
1169
+ name: string;
1170
+
1171
+ type: 'end_call';
1172
+
1173
+ /**
1174
+ * Describes when to end the call.
1175
+ */
1176
+ description?: string;
1177
+ }
1178
+
1179
+ export interface TransferCallTool {
1180
+ /**
1181
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1182
+ * time (general tools + state tools + state edges).
1183
+ */
1184
+ name: string;
1185
+
1186
+ /**
1187
+ * The number to transfer to in E.164 format (a + and country code, then the phone
1188
+ * number with no space or other special characters). For example, +16175551212.
1189
+ */
1190
+ number: string;
1191
+
1192
+ type: 'transfer_call';
1193
+
1194
+ /**
1195
+ * Describes when to transfer the call.
1196
+ */
1197
+ description?: string;
1198
+ }
1199
+
1200
+ export interface CheckAvailabilityCalTool {
1201
+ /**
1202
+ * Cal.com Api key that have access to the cal.com event you want to check
1203
+ * availability for.
1204
+ */
1205
+ cal_api_key: string;
1206
+
1207
+ /**
1208
+ * Cal.com event type id number for the cal.com event you want to check
1209
+ * availability for.
1210
+ */
1211
+ event_type_id: number;
1212
+
1213
+ /**
1214
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1215
+ * time (general tools + state tools + state transitions).
1216
+ */
1217
+ name: string;
1218
+
1219
+ type: 'check_availability_cal';
1220
+
1221
+ /**
1222
+ * Describes when to check availability.
1223
+ */
1224
+ description?: string;
1225
+
1226
+ /**
1227
+ * Timezone to be used when checking availability, must be in
1228
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
1229
+ * If not specified, will check if user specified timezone in call, and if not,
1230
+ * will use the timezone of the Retell servers.
1231
+ */
1232
+ timezone?: string;
1233
+ }
1234
+
1235
+ export interface BookAppointmentCalTool {
1236
+ /**
1237
+ * Cal.com Api key that have access to the cal.com event you want to book
1238
+ * appointment.
1239
+ */
1240
+ cal_api_key: string;
1241
+
1242
+ /**
1243
+ * Cal.com event type id number for the cal.com event you want to book appointment.
1244
+ */
1245
+ event_type_id: number;
1246
+
1247
+ /**
1248
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1249
+ * time (general tools + state tools + state transitions).
1250
+ */
1251
+ name: string;
1252
+
1253
+ type: 'book_appointment_cal';
1254
+
1255
+ /**
1256
+ * Describes when to book the appointment.
1257
+ */
1258
+ description?: string;
1259
+
1260
+ /**
1261
+ * Timezone to be used when booking appointment, must be in
1262
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
1263
+ * If not specified, will check if user specified timezone in call, and if not,
1264
+ * will use the timezone of the Retell servers.
1265
+ */
1266
+ timezone?: string;
1267
+ }
1268
+
1269
+ export interface CustomTool {
1270
+ /**
1271
+ * Describes what this tool does and when to call this tool.
1272
+ */
1273
+ description: string;
1274
+
1275
+ /**
1276
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1277
+ * time (general tools + state tools + state edges).
1278
+ */
1279
+ name: string;
1280
+
1281
+ /**
1282
+ * Determines whether the agent would call LLM another time and speak when the
1283
+ * result of function is obtained. Usually this needs to get turned on so user can
1284
+ * get update for the function call.
1285
+ */
1286
+ speak_after_execution: boolean;
1287
+
1288
+ /**
1289
+ * Determines whether the agent would say sentence like "One moment, let me check
1290
+ * that." when executing the function. Recommend to turn on if your function call
1291
+ * takes over 1s (including network) to complete, so that your agent remains
1292
+ * responsive.
1293
+ */
1294
+ speak_during_execution: boolean;
1295
+
1296
+ type: 'custom';
1297
+
1298
+ /**
1299
+ * The URL we will post the function name and arguments to get a result for the
1300
+ * function. Usually this is your server.
1301
+ */
1302
+ url: string;
1303
+
1304
+ /**
1305
+ * The description for the sentence agent say during execution. Only applicable
1306
+ * when speak_during_execution is true. Can write what to say or even provide
1307
+ * examples. The default is "The message you will say to callee when calling this
1308
+ * tool. Make sure it fits into the conversation smoothly.".
1309
+ */
1310
+ execution_message_description?: string;
1311
+
1312
+ /**
1313
+ * The parameters the functions accepts, described as a JSON Schema object. See
1314
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1315
+ * documentation about the format. Omitting parameters defines a function with an
1316
+ * empty parameter list.
1317
+ */
1318
+ parameters?: CustomTool.Parameters;
1319
+ }
1320
+
1321
+ export namespace CustomTool {
1322
+ /**
1323
+ * The parameters the functions accepts, described as a JSON Schema object. See
1324
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1325
+ * documentation about the format. Omitting parameters defines a function with an
1326
+ * empty parameter list.
1327
+ */
1328
+ export interface Parameters {
1329
+ /**
1330
+ * The value of properties is an object, where each key is the name of a property
1331
+ * and each value is a schema used to validate that property.
1332
+ */
1333
+ properties: Record<string, unknown>;
1334
+
1335
+ /**
1336
+ * Type must be "object" for a JSON Schema object.
1337
+ */
1338
+ type: 'object';
1339
+
1340
+ /**
1341
+ * List of names of required property when generating this parameter. LLM will do
1342
+ * its best to generate the required properties in its function arguments. Property
1343
+ * must exist in properties.
1344
+ */
1345
+ required?: Array<string>;
1346
+ }
1347
+ }
1348
+
1349
+ export interface State {
1350
+ /**
1351
+ * Name of the state, must be unique for each state.
1352
+ */
1353
+ name: string;
1354
+
1355
+ /**
1356
+ * Edges of the state define how and what state can be reached from this state.
1357
+ */
1358
+ edges?: Array<State.Edge>;
1359
+
1360
+ /**
1361
+ * Prompt of the state, will be appended to the system prompt of LLM.
1362
+ *
1363
+ * - System prompt = general prompt + state prompt.
1364
+ */
1365
+ state_prompt?: string;
1366
+
1367
+ /**
1368
+ * A list of tools specific to this state the model may call (to get external
1369
+ * knowledge, call API, etc). You can select from some common predefined tools like
1370
+ * end call, transfer call, etc; or you can create your own custom tool (last
1371
+ * option) for the LLM to use.
1372
+ *
1373
+ * - Tools of LLM = general tools + state tools + state transitions
1374
+ */
1375
+ tools?: Array<
1376
+ | State.EndCallTool
1377
+ | State.TransferCallTool
1378
+ | State.CheckAvailabilityCalTool
1379
+ | State.BookAppointmentCalTool
1380
+ | State.CustomTool
1381
+ >;
1382
+ }
1383
+
1384
+ export namespace State {
1385
+ export interface Edge {
1386
+ /**
1387
+ * Describes what's the transition and at what time / criteria should this
1388
+ * transition happen.
1389
+ */
1390
+ description: string;
1391
+
1392
+ /**
1393
+ * The destination state name when going through transition of state via this edge.
1394
+ * State transition internally is implemented as a tool call of LLM, and a tool
1395
+ * call with name "transition*to*{destination_state_name}" will get created. Feel
1396
+ * free to reference it inside the prompt.
1397
+ */
1398
+ destination_state_name: string;
1399
+
1400
+ /**
1401
+ * After the state transitions, the agent would speak based on the new prompt and
1402
+ * tools in the new state. This bit here controls whether to speak a transition
1403
+ * sentence during the transition (so agent would say sentences like "Let's move on
1404
+ * to the next section to help you set up an acount.", and state transitions, and
1405
+ * agent continue to speak.). Usually this is not necessary, and is recommended to
1406
+ * set to false to avoid LLM repeating itself during and after transition.
1407
+ */
1408
+ speak_during_transition: boolean;
1409
+
1410
+ /**
1411
+ * Describes what parameters you want to extract out when the transition changes.
1412
+ * The parameters extracted here can be referenced in prompts & function
1413
+ * descriptions of later states via dynamic variables. The parameters the functions
1414
+ * accepts, described as a JSON Schema object. See
1415
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1416
+ * documentation about the format.
1417
+ */
1418
+ parameters?: Edge.Parameters;
1419
+ }
1420
+
1421
+ export namespace Edge {
1422
+ /**
1423
+ * Describes what parameters you want to extract out when the transition changes.
1424
+ * The parameters extracted here can be referenced in prompts & function
1425
+ * descriptions of later states via dynamic variables. The parameters the functions
1426
+ * accepts, described as a JSON Schema object. See
1427
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1428
+ * documentation about the format.
1429
+ */
1430
+ export interface Parameters {
1431
+ /**
1432
+ * The value of properties is an object, where each key is the name of a property
1433
+ * and each value is a schema used to validate that property.
1434
+ */
1435
+ properties: Record<string, unknown>;
1436
+
1437
+ /**
1438
+ * Type must be "object" for a JSON Schema object.
1439
+ */
1440
+ type: 'object';
1441
+
1442
+ /**
1443
+ * List of names of required property when generating this parameter. LLM will do
1444
+ * its best to generate the required properties in its function arguments. Property
1445
+ * must exist in properties.
1446
+ */
1447
+ required?: Array<string>;
1448
+ }
1449
+ }
1450
+
1451
+ export interface EndCallTool {
1452
+ /**
1453
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1454
+ * time (general tools + state tools + state transitions).
1455
+ */
1456
+ name: string;
1457
+
1458
+ type: 'end_call';
1459
+
1460
+ /**
1461
+ * Describes when to end the call.
1462
+ */
1463
+ description?: string;
1464
+ }
1465
+
1466
+ export interface TransferCallTool {
1467
+ /**
1468
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1469
+ * time (general tools + state tools + state edges).
1470
+ */
1471
+ name: string;
1472
+
1473
+ /**
1474
+ * The number to transfer to in E.164 format (a + and country code, then the phone
1475
+ * number with no space or other special characters). For example, +16175551212.
1476
+ */
1477
+ number: string;
1478
+
1479
+ type: 'transfer_call';
1480
+
1481
+ /**
1482
+ * Describes when to transfer the call.
1483
+ */
1484
+ description?: string;
1485
+ }
1486
+
1487
+ export interface CheckAvailabilityCalTool {
1488
+ /**
1489
+ * Cal.com Api key that have access to the cal.com event you want to check
1490
+ * availability for.
1491
+ */
1492
+ cal_api_key: string;
1493
+
1494
+ /**
1495
+ * Cal.com event type id number for the cal.com event you want to check
1496
+ * availability for.
1497
+ */
1498
+ event_type_id: number;
1499
+
1500
+ /**
1501
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1502
+ * time (general tools + state tools + state transitions).
1503
+ */
1504
+ name: string;
1505
+
1506
+ type: 'check_availability_cal';
1507
+
1508
+ /**
1509
+ * Describes when to check availability.
1510
+ */
1511
+ description?: string;
1512
+
1513
+ /**
1514
+ * Timezone to be used when checking availability, must be in
1515
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
1516
+ * If not specified, will check if user specified timezone in call, and if not,
1517
+ * will use the timezone of the Retell servers.
1518
+ */
1519
+ timezone?: string;
1520
+ }
1521
+
1522
+ export interface BookAppointmentCalTool {
1523
+ /**
1524
+ * Cal.com Api key that have access to the cal.com event you want to book
1525
+ * appointment.
1526
+ */
1527
+ cal_api_key: string;
1528
+
1529
+ /**
1530
+ * Cal.com event type id number for the cal.com event you want to book appointment.
1531
+ */
1532
+ event_type_id: number;
1533
+
1534
+ /**
1535
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1536
+ * time (general tools + state tools + state transitions).
1537
+ */
1538
+ name: string;
1539
+
1540
+ type: 'book_appointment_cal';
1541
+
1542
+ /**
1543
+ * Describes when to book the appointment.
1544
+ */
1545
+ description?: string;
1546
+
1547
+ /**
1548
+ * Timezone to be used when booking appointment, must be in
1549
+ * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
1550
+ * If not specified, will check if user specified timezone in call, and if not,
1551
+ * will use the timezone of the Retell servers.
1552
+ */
1553
+ timezone?: string;
1554
+ }
1555
+
1556
+ export interface CustomTool {
1557
+ /**
1558
+ * Describes what this tool does and when to call this tool.
1559
+ */
1560
+ description: string;
1561
+
1562
+ /**
1563
+ * Name of the tool. Must be unique within all tools available to LLM at any given
1564
+ * time (general tools + state tools + state edges).
1565
+ */
1566
+ name: string;
1567
+
1568
+ /**
1569
+ * Determines whether the agent would call LLM another time and speak when the
1570
+ * result of function is obtained. Usually this needs to get turned on so user can
1571
+ * get update for the function call.
1572
+ */
1573
+ speak_after_execution: boolean;
1574
+
1575
+ /**
1576
+ * Determines whether the agent would say sentence like "One moment, let me check
1577
+ * that." when executing the function. Recommend to turn on if your function call
1578
+ * takes over 1s (including network) to complete, so that your agent remains
1579
+ * responsive.
1580
+ */
1581
+ speak_during_execution: boolean;
1582
+
1583
+ type: 'custom';
1584
+
1585
+ /**
1586
+ * The URL we will post the function name and arguments to get a result for the
1587
+ * function. Usually this is your server.
1588
+ */
1589
+ url: string;
1590
+
1591
+ /**
1592
+ * The description for the sentence agent say during execution. Only applicable
1593
+ * when speak_during_execution is true. Can write what to say or even provide
1594
+ * examples. The default is "The message you will say to callee when calling this
1595
+ * tool. Make sure it fits into the conversation smoothly.".
1596
+ */
1597
+ execution_message_description?: string;
1598
+
1599
+ /**
1600
+ * The parameters the functions accepts, described as a JSON Schema object. See
1601
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1602
+ * documentation about the format. Omitting parameters defines a function with an
1603
+ * empty parameter list.
1604
+ */
1605
+ parameters?: CustomTool.Parameters;
1606
+ }
1607
+
1608
+ export namespace CustomTool {
1609
+ /**
1610
+ * The parameters the functions accepts, described as a JSON Schema object. See
1611
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
1612
+ * documentation about the format. Omitting parameters defines a function with an
1613
+ * empty parameter list.
1614
+ */
1615
+ export interface Parameters {
1616
+ /**
1617
+ * The value of properties is an object, where each key is the name of a property
1618
+ * and each value is a schema used to validate that property.
1619
+ */
1620
+ properties: Record<string, unknown>;
1621
+
1622
+ /**
1623
+ * Type must be "object" for a JSON Schema object.
1624
+ */
1625
+ type: 'object';
1626
+
1627
+ /**
1628
+ * List of names of required property when generating this parameter. LLM will do
1629
+ * its best to generate the required properties in its function arguments. Property
1630
+ * must exist in properties.
1631
+ */
1632
+ required?: Array<string>;
1633
+ }
1634
+ }
1635
+ }
1636
+ }
1637
+
1638
+ export namespace Llm {
1639
+ export import LlmResponse = LlmAPI.LlmResponse;
1640
+ export import LlmListResponse = LlmAPI.LlmListResponse;
1641
+ export import LlmCreateParams = LlmAPI.LlmCreateParams;
1642
+ export import LlmUpdateParams = LlmAPI.LlmUpdateParams;
1643
+ }