retell-sdk 2.2.1 → 2.2.3

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 (71) hide show
  1. package/README.md +3 -433
  2. package/example.d.ts +2 -0
  3. package/example.d.ts.map +1 -0
  4. package/example.js +96 -0
  5. package/example.js.map +1 -0
  6. package/models/components/agent.d.ts +193 -24
  7. package/models/components/agent.d.ts.map +1 -1
  8. package/models/components/agent.js +189 -27
  9. package/models/components/agent.js.map +1 -1
  10. package/models/components/index.d.ts +0 -1
  11. package/models/components/index.d.ts.map +1 -1
  12. package/models/components/index.js +0 -1
  13. package/models/components/index.js.map +1 -1
  14. package/models/operations/createagent.d.ts +14 -34
  15. package/models/operations/createagent.d.ts.map +1 -1
  16. package/models/operations/createagent.js +12 -32
  17. package/models/operations/createagent.js.map +1 -1
  18. package/models/operations/createphonecall.d.ts +12 -6
  19. package/models/operations/createphonecall.d.ts.map +1 -1
  20. package/models/operations/createphonecall.js +8 -8
  21. package/models/operations/createphonecall.js.map +1 -1
  22. package/models/operations/createphonenumber.d.ts +1 -1
  23. package/models/operations/createwebcall.d.ts +16 -0
  24. package/models/operations/createwebcall.d.ts.map +1 -0
  25. package/models/operations/createwebcall.js +3 -0
  26. package/models/operations/createwebcall.js.map +1 -0
  27. package/models/operations/index.d.ts +1 -0
  28. package/models/operations/index.d.ts.map +1 -1
  29. package/models/operations/index.js +1 -0
  30. package/models/operations/index.js.map +1 -1
  31. package/models/operations/listagents.d.ts +3 -3
  32. package/models/operations/listagents.d.ts.map +1 -1
  33. package/models/operations/listagents.js +4 -4
  34. package/models/operations/listagents.js.map +1 -1
  35. package/models/operations/listcalls.d.ts +3 -3
  36. package/models/operations/listcalls.d.ts.map +1 -1
  37. package/models/operations/listcalls.js +4 -4
  38. package/models/operations/listcalls.js.map +1 -1
  39. package/models/operations/listphonenumbers.d.ts +3 -3
  40. package/models/operations/listphonenumbers.d.ts.map +1 -1
  41. package/models/operations/listphonenumbers.js +4 -4
  42. package/models/operations/listphonenumbers.js.map +1 -1
  43. package/models/operations/updateagent.d.ts +42 -3
  44. package/models/operations/updateagent.d.ts.map +1 -1
  45. package/models/operations/updateagent.js +43 -5
  46. package/models/operations/updateagent.js.map +1 -1
  47. package/package.json +1 -1
  48. package/sdk/liveClient.d.ts +2 -4
  49. package/sdk/liveClient.d.ts.map +1 -1
  50. package/sdk/liveClient.js +9 -5
  51. package/sdk/liveClient.js.map +1 -1
  52. package/sdk/sdk.d.ts +2 -6
  53. package/sdk/sdk.d.ts.map +1 -1
  54. package/sdk/sdk.js +10 -10
  55. package/sdk/sdk.js.map +1 -1
  56. package/src/example.ts +102 -0
  57. package/src/models/components/agent.ts +382 -52
  58. package/src/models/components/index.ts +0 -1
  59. package/src/models/operations/createagent.ts +30 -66
  60. package/src/models/operations/createphonecall.ts +20 -14
  61. package/src/models/operations/createphonenumber.ts +1 -1
  62. package/src/models/operations/createwebcall.ts +16 -0
  63. package/src/models/operations/index.ts +1 -0
  64. package/src/models/operations/listagents.ts +7 -7
  65. package/src/models/operations/listcalls.ts +7 -7
  66. package/src/models/operations/listphonenumbers.ts +7 -7
  67. package/src/models/operations/updateagent.ts +87 -7
  68. package/src/sdk/liveClient.ts +11 -8
  69. package/src/sdk/sdk.ts +10 -17
  70. package/docs/sdks/retellclient/README.md +0 -713
  71. package/src/models/components/agentnodefaultnorequired.ts +0 -121
@@ -4,23 +4,296 @@
4
4
 
5
5
  import { z } from "zod";
6
6
 
7
- export type Agent = {
7
+ export type Function = {
8
8
  /**
9
- * Unique id of agent.
9
+ * Link to the url where the function call parameters would sent to as a json body. Most likely your server endpoint you expose for this function.
10
10
  */
11
- agentId: string;
11
+ url: string;
12
12
  /**
13
- * The name of the agent. Only used for your own reference.
13
+ * A description of what the function does, used by the model to choose when and how to call the function. Recommended to populate this for better results.
14
14
  */
15
- agentName?: string | undefined;
15
+ description?: string | undefined;
16
+ /**
17
+ * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
18
+ */
19
+ name: string;
20
+ /**
21
+ * The parameters the functions accepts, described as a JSON Schema object for type object
22
+ */
23
+ parameters?: {
24
+ /**
25
+ * The type of parameters is object.
26
+ */
27
+ type: 'object';
28
+ /**
29
+ * Defines what properties are required for the parameters.
30
+ */
31
+ required?: string[] | undefined;
32
+ /**
33
+ * Key-value pairs object where each key is the name of a property and each value is a schema used to validate that property.
34
+ */
35
+ properties: Record<string, any>;
36
+ } | undefined;
37
+ };
38
+
39
+ /** @internal */
40
+ export namespace Function$ {
41
+ export type Inbound = {
42
+ url: string;
43
+ description?: string | undefined;
44
+ name: string;
45
+ parameters?: {
46
+ type: 'object';
47
+ required?: string[] | undefined;
48
+ properties: Record<string, any>;
49
+ } | undefined;
50
+ };
51
+
52
+ export const inboundSchema: z.ZodType<Function, z.ZodTypeDef, Inbound> = z
53
+ .object({
54
+ url: z.string(),
55
+ description: z.string().optional(),
56
+ name: z.string(),
57
+ parameters: z.object({
58
+ type: z.literal('object'),
59
+ required: z.array(z.string()).optional(),
60
+ properties: z.record(z.any()),
61
+ }).optional(),
62
+ })
63
+ .transform((v) => {
64
+ return {
65
+ url: v.url,
66
+ description: v.description,
67
+ name: v.name,
68
+ parameters: v.parameters,
69
+ };
70
+ });
71
+
72
+ export type Outbound = {
73
+ url: string;
74
+ description?: string | undefined;
75
+ name: string;
76
+ parameters?: {
77
+ type: 'object';
78
+ required?: string[] | undefined;
79
+ properties: Record<string, any>;
80
+ } | undefined;
81
+ };
82
+
83
+ export const outboundSchema: z.ZodType<Function, z.ZodTypeDef, Inbound> = z
84
+ .object({
85
+ url: z.string(),
86
+ description: z.string().optional(),
87
+ name: z.string(),
88
+ parameters: z.object({
89
+ type: z.literal('object'),
90
+ required: z.array(z.string()).optional(),
91
+ properties: z.record(z.any()),
92
+ }).optional(),
93
+ })
94
+ .transform((v) => {
95
+ return {
96
+ url: v.url,
97
+ description: v.description,
98
+ name: v.name,
99
+ parameters: v.parameters,
100
+ };
101
+ });
102
+ }
103
+
104
+ export type RetellLlmSetting = {
105
+ /**
106
+ * Retell picked LLM based conversation response.
107
+ */
108
+ provider: "retell";
109
+ /**
110
+ * The prompt agent will follow. Can use `${YOUR_PARAM_NAME}` to represent dynamic data that would get injected at each call.
111
+ */
112
+ prompt: string;
113
+ }
114
+
115
+ /** @internal */
116
+ export namespace RetellLlmSetting$ {
117
+ export type Inbound = {
118
+ provider: "retell";
119
+ prompt: string;
120
+ };
121
+
122
+ export const inboundSchema: z.ZodType<RetellLlmSetting, z.ZodTypeDef, Inbound> = z
123
+ .object({
124
+ provider: z.literal("retell"),
125
+ prompt: z.string(),
126
+ })
127
+ .transform((v) => {
128
+ return {
129
+ provider: v.provider,
130
+ prompt: v.prompt,
131
+ };
132
+ });
133
+
134
+ export type Outbound = {
135
+ provider: "retell";
136
+ prompt: string;
137
+ };
138
+
139
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, RetellLlmSetting> = z
140
+ .object({
141
+ provider: z.literal("retell"),
142
+ prompt: z.string(),
143
+ })
144
+ .transform((v) => {
145
+ return {
146
+ provider: v.provider,
147
+ prompt: v.prompt,
148
+ };
149
+ });
150
+ }
151
+
152
+ export type CustomLlmSetting = {
153
+ /**
154
+ * Custom response system, usually your custom LLM. Note that you may see a higher latency if provided server is slow.
155
+ */
156
+ provider: "custom";
157
+ /**
158
+ * The URL we will call for getting response, usually your server.
159
+ */
160
+ url: string;
161
+ /**
162
+ * Whether the provided URL support return response via Server Sent Events.
163
+ */
164
+ stream: boolean;
165
+ }
166
+
167
+ /** @internal */
168
+ export namespace CustomLlmSetting$ {
169
+ export type Inbound = {
170
+ provider: "custom";
171
+ url: string;
172
+ stream: boolean;
173
+ };
174
+
175
+ export const inboundSchema: z.ZodType<CustomLlmSetting, z.ZodTypeDef, Inbound> = z
176
+ .object({
177
+ provider: z.literal("custom"),
178
+ url: z.string(),
179
+ stream: z.boolean(),
180
+ })
181
+ .transform((v) => {
182
+ return {
183
+ provider: v.provider,
184
+ url: v.url,
185
+ stream: v.stream
186
+ };
187
+ });
188
+
189
+ export type Outbound = {
190
+ provider: "custom";
191
+ url: string;
192
+ stream: boolean;
193
+ };
194
+
195
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, CustomLlmSetting> = z
196
+ .object({
197
+ provider: z.literal("custom"),
198
+ url: z.string(),
199
+ stream: z.boolean(),
200
+ })
201
+ .transform((v) => {
202
+ return {
203
+ provider: v.provider,
204
+ url: v.url,
205
+ stream: v.stream
206
+ };
207
+ });
208
+ }
209
+
210
+ export type InteractionSettingRequest = {
211
+ /**
212
+ * Whether the agent begins the call with a pre-defined message. When this is false, the agent will still start the call, but with a dynamic message. If you wish for user to be the first to talk, set this to true and set `begin_message` as empty string.
213
+ */
214
+ enableBeginMessage?: boolean | undefined;
16
215
  /**
17
216
  * Pre-defined message for agent to say in the begining of call. Only used when `enable_begin_message` is true. When empty, agent would wait for user to talk first.
18
217
  */
19
218
  beginMessage?: string | undefined;
219
+ /**
220
+ * Whether the agent can end a call. If false, the agent would never end a call.
221
+ */
222
+ enableEndCall?: boolean | undefined;
223
+ /**
224
+ * Whether the agent attempts to end the call with a pre-defined message. When this is false, the agent might still be the last one speaking in the call, but the massage can be dynamic.
225
+ */
226
+ enableEndMessage?: boolean | undefined;
227
+ /**
228
+ * Pre-defined message for agent to say when agent ends the call. Only used when `enable_end_call` and `enable_end_message` is true. If you wish for agent to hang up without saying anything, set this to empty string.
229
+ */
230
+ endMessage?: string | undefined;
231
+ }
232
+
233
+ /** @internal */
234
+ export namespace InteractionSettingRequest$ {
235
+ export type Inbound = {
236
+ enable_begin_message?: boolean | undefined;
237
+ begin_message?: string | undefined;
238
+ enable_end_call?: boolean | undefined;
239
+ enable_end_message?: boolean | undefined;
240
+ end_message?: string | undefined;
241
+ };
242
+
243
+ export const inboundSchema: z.ZodType<InteractionSettingRequest, z.ZodTypeDef, Inbound> = z
244
+ .object({
245
+ enable_begin_message: z.boolean().optional(),
246
+ begin_message: z.string().optional(),
247
+ enable_end_call: z.boolean().optional(),
248
+ enable_end_message: z.boolean().optional(),
249
+ end_message: z.string().optional(),
250
+ })
251
+ .transform((v) => {
252
+ return {
253
+ ...(v.enable_begin_message === undefined ? null : { enableBeginMessage: v.enable_begin_message }),
254
+ ...(v.begin_message === undefined ? null : { beginMessage: v.begin_message }),
255
+ ...(v.enable_end_call === undefined ? null : { enableEndCall: v.enable_end_call }),
256
+ ...(v.enable_end_message === undefined ? null : { enableEndMessage: v.enable_end_message }),
257
+ ...(v.end_message === undefined ? null : { endMessage: v.end_message }),
258
+ };
259
+ });
260
+
261
+ export type Outbound = {
262
+ enable_begin_message?: boolean | undefined;
263
+ begin_message?: string | undefined;
264
+ enable_end_call?: boolean | undefined;
265
+ enable_end_message?: boolean | undefined;
266
+ end_message?: string | undefined;
267
+ };
268
+
269
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, InteractionSettingRequest> = z
270
+ .object({
271
+ enableBeginMessage: z.boolean().optional(),
272
+ beginMessage: z.string().optional(),
273
+ enableEndCall: z.boolean().optional(),
274
+ enableEndMessage: z.boolean().optional(),
275
+ endMessage: z.string().optional(),
276
+ })
277
+ .transform((v) => {
278
+ return {
279
+ ...(v.enableBeginMessage === undefined ? null : { enable_begin_message: v.enableBeginMessage }),
280
+ ...(v.beginMessage === undefined ? null : { begin_message: v.beginMessage }),
281
+ ...(v.enableEndCall === undefined ? null : { enable_end_call: v.enableEndCall }),
282
+ ...(v.enableEndMessage === undefined ? null : { enable_end_message: v.enableEndMessage }),
283
+ ...(v.endMessage === undefined ? null : { end_message: v.endMessage }),
284
+ };
285
+ });
286
+ }
287
+
288
+ export type InteractionSettingResponse = {
20
289
  /**
21
290
  * Whether the agent begins the call with a pre-defined message. When this is false, the agent will still start the call, but with a dynamic message. If you wish for user to be the first to talk, set this to true and set `begin_message` as empty string.
22
291
  */
23
292
  enableBeginMessage: boolean;
293
+ /**
294
+ * Pre-defined message for agent to say in the begining of call. Only used when `enable_begin_message` is true. When empty, agent would wait for user to talk first.
295
+ */
296
+ beginMessage?: string | undefined;
24
297
  /**
25
298
  * Whether the agent can end a call. If false, the agent would never end a call.
26
299
  */
@@ -33,18 +306,93 @@ export type Agent = {
33
306
  * Pre-defined message for agent to say when agent ends the call. Only used when `enable_end_call` and `enable_end_message` is true. If you wish for agent to hang up without saying anything, set this to empty string.
34
307
  */
35
308
  endMessage?: string | undefined;
309
+ }
310
+
311
+ /** @internal */
312
+ export namespace InteractionSettingResponse$ {
313
+ export type Inbound = {
314
+ enable_begin_message: boolean;
315
+ begin_message?: string | undefined;
316
+ enable_end_call: boolean;
317
+ enable_end_message: boolean;
318
+ end_message?: string | undefined;
319
+ };
320
+
321
+ export const inboundSchema: z.ZodType<InteractionSettingResponse, z.ZodTypeDef, Inbound> = z
322
+ .object({
323
+ enable_begin_message: z.boolean(),
324
+ begin_message: z.string().optional(),
325
+ enable_end_call: z.boolean(),
326
+ enable_end_message: z.boolean(),
327
+ end_message: z.string().optional(),
328
+ })
329
+ .transform((v) => {
330
+ return {
331
+ enableBeginMessage: v.enable_begin_message,
332
+ ...(v.begin_message === undefined ? null : { beginMessage: v.begin_message }),
333
+ enableEndCall: v.enable_end_call,
334
+ enableEndMessage: v.enable_end_message,
335
+ ...(v.end_message === undefined ? null : { endMessage: v.end_message }),
336
+ };
337
+ });
338
+
339
+ export type Outbound = {
340
+ enable_begin_message: boolean;
341
+ begin_message?: string | undefined;
342
+ enable_end_call: boolean;
343
+ enable_end_message: boolean;
344
+ end_message?: string | undefined;
345
+ };
346
+
347
+ export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, InteractionSettingResponse> = z
348
+ .object({
349
+ enableBeginMessage: z.boolean(),
350
+ beginMessage: z.string().optional(),
351
+ enableEndCall: z.boolean(),
352
+ enableEndMessage: z.boolean(),
353
+ endMessage: z.string().optional(),
354
+ })
355
+ .transform((v) => {
356
+ return {
357
+ enable_begin_message: v.enableBeginMessage,
358
+ ...(v.beginMessage === undefined ? null : { begin_message: v.beginMessage }),
359
+ enable_end_call: v.enableEndCall,
360
+ enable_end_message: v.enableEndMessage,
361
+ ...(v.endMessage === undefined ? null : { end_message: v.endMessage }),
362
+ };
363
+ });
364
+ }
365
+
366
+ export type Agent = {
36
367
  /**
37
- * Last modification timestamp (milliseconds since epoch). Either the time of last update or creation if no updates available.
368
+ * Unique id of agent.
38
369
  */
39
- lastModificationTimestamp: number;
370
+ agentId: string;
40
371
  /**
41
- * The prompt agent will follow. Check out [Prompt Best Practices](/features/prompt). Can use `${YOUR_PARAM_NAME}` to represent dynamic data that would get injected at each call. Learn more about [Agent Prompt Parameters](/features/prompt#prompt-parameters).
372
+ * The name of the agent. Only used for your own reference.
42
373
  */
43
- prompt: string;
374
+ agentName?: string | undefined;
375
+ /*
376
+ * Determines how to generate the response in the call. Currently supports using our in-house LLM response system or your own custom
377
+ * response generation system.
378
+ */
379
+ llmSetting: RetellLlmSetting | CustomLlmSetting;
380
+ /**
381
+ * Setting combination that controls interaction flow, like begin and end logic.
382
+ */
383
+ interactionSetting: InteractionSettingResponse;
44
384
  /**
45
- * Unique voice id used for the agent. Find list of available voices and their characteristics in [Voices](/features/voices).
385
+ * Unique voice id used for the agent. Find list of available voices in documentation.
46
386
  */
47
387
  voiceId: string;
388
+ /**
389
+ * Last modification timestamp (milliseconds since epoch). Either the time of last update or creation if no updates available.
390
+ */
391
+ lastModificationTimestamp: number;
392
+ /**
393
+ * Functions are the actions that the agent can perform, like booking appointments, retriving information, etc. By setting this field, either OpenAI's function calling feature or your own custom LLM's logic would determine when the function shall get called, and our server would make the call.
394
+ */
395
+ functions?: Function[] | undefined;
48
396
  };
49
397
 
50
398
  /** @internal */
@@ -52,82 +400,64 @@ export namespace Agent$ {
52
400
  export type Inbound = {
53
401
  agent_id: string;
54
402
  agent_name?: string | undefined;
55
- begin_message?: string | undefined;
56
- enable_begin_message: boolean;
57
- enable_end_call: boolean;
58
- enable_end_message: boolean;
59
- end_message?: string | undefined;
60
- last_modification_timestamp: number;
61
- prompt: string;
403
+ llm_setting: RetellLlmSetting$.Inbound | CustomLlmSetting$.Inbound;
404
+ interaction_setting: InteractionSettingResponse$.Inbound;
62
405
  voice_id: string;
406
+ last_modification_timestamp: number;
407
+ functions?: Function[] | undefined;
63
408
  };
64
409
 
65
410
  export const inboundSchema: z.ZodType<Agent, z.ZodTypeDef, Inbound> = z
66
411
  .object({
67
412
  agent_id: z.string(),
68
413
  agent_name: z.string().optional(),
69
- begin_message: z.string().optional(),
70
- enable_begin_message: z.boolean(),
71
- enable_end_call: z.boolean(),
72
- enable_end_message: z.boolean(),
73
- end_message: z.string().optional(),
74
- last_modification_timestamp: z.number().int(),
75
- prompt: z.string(),
414
+ llm_setting: z.union([RetellLlmSetting$.inboundSchema, CustomLlmSetting$.inboundSchema]),
415
+ interaction_setting: InteractionSettingResponse$.inboundSchema,
76
416
  voice_id: z.string(),
417
+ last_modification_timestamp: z.number().int(),
418
+ functions: z.array(Function$.inboundSchema).optional(),
77
419
  })
78
420
  .transform((v) => {
79
421
  return {
80
422
  agentId: v.agent_id,
81
423
  ...(v.agent_name === undefined ? null : { agentName: v.agent_name }),
82
- ...(v.begin_message === undefined ? null : { beginMessage: v.begin_message }),
83
- enableBeginMessage: v.enable_begin_message,
84
- enableEndCall: v.enable_end_call,
85
- enableEndMessage: v.enable_end_message,
86
- ...(v.end_message === undefined ? null : { endMessage: v.end_message }),
87
- lastModificationTimestamp: v.last_modification_timestamp,
88
- prompt: v.prompt,
424
+ llmSetting: v.llm_setting,
425
+ interactionSetting: v.interaction_setting,
89
426
  voiceId: v.voice_id,
427
+ lastModificationTimestamp: v.last_modification_timestamp,
428
+ functions: v.functions
90
429
  };
91
430
  });
92
431
 
93
432
  export type Outbound = {
94
433
  agent_id: string;
95
434
  agent_name?: string | undefined;
96
- begin_message?: string | undefined;
97
- enable_begin_message: boolean;
98
- enable_end_call: boolean;
99
- enable_end_message: boolean;
100
- end_message?: string | undefined;
101
- last_modification_timestamp: number;
102
- prompt: string;
435
+ llm_setting: RetellLlmSetting$.Outbound | CustomLlmSetting$.Outbound;
436
+ interaction_setting: InteractionSettingResponse$.Outbound;
103
437
  voice_id: string;
438
+ last_modification_timestamp: number;
439
+ functions?: Function[] | undefined;
104
440
  };
105
441
 
106
442
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Agent> = z
107
443
  .object({
108
444
  agentId: z.string(),
109
445
  agentName: z.string().optional(),
110
- beginMessage: z.string().optional(),
111
- enableBeginMessage: z.boolean(),
112
- enableEndCall: z.boolean(),
113
- enableEndMessage: z.boolean(),
114
- endMessage: z.string().optional(),
115
- lastModificationTimestamp: z.number().int(),
116
- prompt: z.string(),
446
+ llmSetting: z.union([RetellLlmSetting$.outboundSchema, CustomLlmSetting$.outboundSchema]),
447
+ interactionSetting: InteractionSettingResponse$.outboundSchema,
117
448
  voiceId: z.string(),
449
+ lastModificationTimestamp: z.number().int(),
450
+ functions: z.array(Function$.inboundSchema).optional(),
118
451
  })
119
452
  .transform((v) => {
120
453
  return {
121
454
  agent_id: v.agentId,
122
455
  ...(v.agentName === undefined ? null : { agent_name: v.agentName }),
123
- ...(v.beginMessage === undefined ? null : { begin_message: v.beginMessage }),
124
- enable_begin_message: v.enableBeginMessage,
125
- enable_end_call: v.enableEndCall,
126
- enable_end_message: v.enableEndMessage,
127
- ...(v.endMessage === undefined ? null : { end_message: v.endMessage }),
128
- last_modification_timestamp: v.lastModificationTimestamp,
129
- prompt: v.prompt,
456
+ llm_setting: v.llmSetting,
457
+ interaction_setting: v.interactionSetting,
130
458
  voice_id: v.voiceId,
459
+ last_modification_timestamp: v.lastModificationTimestamp,
460
+ functions: v.functions
131
461
  };
132
462
  });
133
463
  }
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  export * from "./agent";
6
- export * from "./agentnodefaultnorequired";
7
6
  export * from "./agentpromptparams";
8
7
  export * from "./calldetail";
9
8
  export * from "./callphonenumber";
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import * as components from "../../models/components";
6
+ import { Function } from "../../models/components";
6
7
  import { z } from "zod";
7
8
 
8
9
  export type CreateAgentRequestBody = {
@@ -10,34 +11,23 @@ export type CreateAgentRequestBody = {
10
11
  * The name of the agent. Only used for your own reference.
11
12
  */
12
13
  agentName?: string | undefined;
14
+ /*
15
+ * Determines how to generate the response in the call. Currently supports using our in-house LLM response system or your own custom
16
+ * response generation system.
17
+ */
18
+ llmSetting: components.RetellLlmSetting | components.CustomLlmSetting;
13
19
  /**
14
- * Pre-defined message for agent to say in the begining of call. Only used when `enable_begin_message` is true. When empty, agent would wait for user to talk first.
20
+ * Setting combination that controls interaction flow, like begin and end logic.
15
21
  */
16
- beginMessage?: string | undefined;
22
+ interactionSetting?: components.InteractionSettingRequest | undefined;
17
23
  /**
18
- * Whether the agent begins the call with a pre-defined message. When this is false, the agent will still start the call, but with a dynamic message. If you wish for user to be the first to talk, set this to true and set `begin_message` as empty string.
24
+ * Unique voice id used for the agent. Find list of available voices in documentation.
19
25
  */
20
- enableBeginMessage?: boolean | undefined;
21
- /**
22
- * Whether the agent can end a call. If false, the agent would never end a call.
23
- */
24
- enableEndCall?: boolean | undefined;
25
- /**
26
- * Whether the agent attempts to end the call with a pre-defined message. When this is false, the agent might still be the last one speaking in the call, but the massage can be dynamic.
27
- */
28
- enableEndMessage?: boolean | undefined;
29
- /**
30
- * Pre-defined message for agent to say when agent ends the call. Only used when `enable_end_call` and `enable_end_message` is true. If you wish for agent to hang up without saying anything, set this to empty string.
31
- */
32
- endMessage?: string | undefined;
33
- /**
34
- * The prompt agent will follow. Check out [Prompt Best Practices](/features/prompt). Can use `${YOUR_PARAM_NAME}` to represent dynamic data that would get injected at each call. Learn more about [Agent Prompt Parameters](/features/prompt#prompt-parameters).
35
- */
36
- prompt: string;
26
+ voiceId: string;
37
27
  /**
38
- * Unique voice id used for the agent. Find list of available voices and their characteristics in [Voices](/features/voices).
28
+ * Functions are the actions that the agent can perform, like booking appointments, retriving information, etc. By setting this field, either OpenAI's function calling feature or your own custom LLM's logic would determine when the function shall get called, and our server would make the call.
39
29
  */
40
- voiceId: string;
30
+ functions?: Function[] | undefined;
41
31
  };
42
32
 
43
33
  export type CreateAgentResponse = {
@@ -63,79 +53,53 @@ export type CreateAgentResponse = {
63
53
  export namespace CreateAgentRequestBody$ {
64
54
  export type Inbound = {
65
55
  agent_name?: string | undefined;
66
- begin_message?: string | undefined;
67
- enable_begin_message?: boolean | undefined;
68
- enable_end_call?: boolean | undefined;
69
- enable_end_message?: boolean | undefined;
70
- end_message?: string | undefined;
71
- prompt: string;
56
+ llm_setting: components.RetellLlmSetting$.Inbound | components.CustomLlmSetting$.Inbound;
57
+ interaction_setting?: components.InteractionSettingRequest$.Inbound | undefined;
72
58
  voice_id: string;
59
+ functions?: Function[] | undefined;
73
60
  };
74
61
 
75
62
  export const inboundSchema: z.ZodType<CreateAgentRequestBody, z.ZodTypeDef, Inbound> = z
76
63
  .object({
77
64
  agent_name: z.string().optional(),
78
- begin_message: z.string().optional(),
79
- enable_begin_message: z.boolean().optional(),
80
- enable_end_call: z.boolean().optional(),
81
- enable_end_message: z.boolean().optional(),
82
- end_message: z.string().optional(),
83
- prompt: z.string(),
65
+ llm_setting: z.union([components.RetellLlmSetting$.inboundSchema, components.CustomLlmSetting$.inboundSchema]),
66
+ interaction_setting: components.InteractionSettingRequest$.inboundSchema.optional(),
84
67
  voice_id: z.string(),
68
+ functions: z.array(components.Function$.inboundSchema).optional(),
85
69
  })
86
70
  .transform((v) => {
87
71
  return {
88
72
  ...(v.agent_name === undefined ? null : { agentName: v.agent_name }),
89
- ...(v.begin_message === undefined ? null : { beginMessage: v.begin_message }),
90
- ...(v.enable_begin_message === undefined
91
- ? null
92
- : { enableBeginMessage: v.enable_begin_message }),
93
- ...(v.enable_end_call === undefined ? null : { enableEndCall: v.enable_end_call }),
94
- ...(v.enable_end_message === undefined
95
- ? null
96
- : { enableEndMessage: v.enable_end_message }),
97
- ...(v.end_message === undefined ? null : { endMessage: v.end_message }),
98
- prompt: v.prompt,
73
+ llmSetting: v.llm_setting,
74
+ ...(v.interaction_setting === undefined ? null : { interactionSetting: v.interaction_setting }),
99
75
  voiceId: v.voice_id,
76
+ functions: v.functions,
100
77
  };
101
78
  });
102
79
 
103
80
  export type Outbound = {
104
81
  agent_name?: string | undefined;
105
- begin_message?: string | undefined;
106
- enable_begin_message?: boolean | undefined;
107
- enable_end_call?: boolean | undefined;
108
- enable_end_message?: boolean | undefined;
109
- end_message?: string | undefined;
110
- prompt: string;
82
+ llm_setting: components.RetellLlmSetting$.Inbound | components.CustomLlmSetting$.Inbound;
83
+ interaction_setting?: components.InteractionSettingRequest$.Inbound | undefined;
111
84
  voice_id: string;
85
+ functions?: Function[] | undefined;
112
86
  };
113
87
 
114
88
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, CreateAgentRequestBody> = z
115
89
  .object({
116
90
  agentName: z.string().optional(),
117
- beginMessage: z.string().optional(),
118
- enableBeginMessage: z.boolean().optional(),
119
- enableEndCall: z.boolean().optional(),
120
- enableEndMessage: z.boolean().optional(),
121
- endMessage: z.string().optional(),
122
- prompt: z.string(),
91
+ llmSetting: z.union([components.RetellLlmSetting$.outboundSchema, components.CustomLlmSetting$.outboundSchema]),
92
+ interactionSetting: components.InteractionSettingRequest$.outboundSchema.optional(),
123
93
  voiceId: z.string(),
94
+ functions: z.array(components.Function$.inboundSchema).optional(),
124
95
  })
125
96
  .transform((v) => {
126
97
  return {
127
98
  ...(v.agentName === undefined ? null : { agent_name: v.agentName }),
128
- ...(v.beginMessage === undefined ? null : { begin_message: v.beginMessage }),
129
- ...(v.enableBeginMessage === undefined
130
- ? null
131
- : { enable_begin_message: v.enableBeginMessage }),
132
- ...(v.enableEndCall === undefined ? null : { enable_end_call: v.enableEndCall }),
133
- ...(v.enableEndMessage === undefined
134
- ? null
135
- : { enable_end_message: v.enableEndMessage }),
136
- ...(v.endMessage === undefined ? null : { end_message: v.endMessage }),
137
- prompt: v.prompt,
99
+ llm_setting: v.llmSetting,
100
+ ...(v.interactionSetting === undefined ? null : { interaction_setting: v.interactionSetting }),
138
101
  voice_id: v.voiceId,
102
+ functions: v.functions,
139
103
  };
140
104
  });
141
105
  }