retell-sdk 2.2.4 → 2.2.7

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 (87) hide show
  1. package/example.js +19 -4
  2. package/example.js.map +1 -1
  3. package/models/components/agent.d.ts +3 -205
  4. package/models/components/agent.d.ts.map +1 -1
  5. package/models/components/agent.js +5 -221
  6. package/models/components/agent.js.map +1 -1
  7. package/models/components/calldetail.d.ts +33 -22
  8. package/models/components/calldetail.d.ts.map +1 -1
  9. package/models/components/calldetail.js +32 -31
  10. package/models/components/calldetail.js.map +1 -1
  11. package/models/components/index.d.ts +0 -3
  12. package/models/components/index.d.ts.map +1 -1
  13. package/models/components/index.js +0 -3
  14. package/models/components/index.js.map +1 -1
  15. package/models/errors/index.d.ts +1 -6
  16. package/models/errors/index.d.ts.map +1 -1
  17. package/models/errors/index.js +1 -6
  18. package/models/errors/index.js.map +1 -1
  19. package/models/errors/registercall.d.ts +218 -0
  20. package/models/errors/registercall.d.ts.map +1 -0
  21. package/models/errors/registercall.js +386 -0
  22. package/models/errors/registercall.js.map +1 -0
  23. package/models/operations/createagent.d.ts +3 -16
  24. package/models/operations/createagent.d.ts.map +1 -1
  25. package/models/operations/createagent.js +4 -22
  26. package/models/operations/createagent.js.map +1 -1
  27. package/models/operations/getcall.d.ts +1 -1
  28. package/models/operations/index.d.ts +1 -7
  29. package/models/operations/index.d.ts.map +1 -1
  30. package/models/operations/index.js +1 -7
  31. package/models/operations/index.js.map +1 -1
  32. package/models/operations/listcalls.d.ts +1 -7
  33. package/models/operations/listcalls.d.ts.map +1 -1
  34. package/models/operations/listcalls.js +0 -4
  35. package/models/operations/listcalls.js.map +1 -1
  36. package/models/operations/registercall.d.ts +74 -0
  37. package/models/operations/registercall.d.ts.map +1 -0
  38. package/models/operations/registercall.js +104 -0
  39. package/models/operations/registercall.js.map +1 -0
  40. package/models/operations/updateagent.d.ts +3 -16
  41. package/models/operations/updateagent.d.ts.map +1 -1
  42. package/models/operations/updateagent.js +7 -25
  43. package/models/operations/updateagent.js.map +1 -1
  44. package/package.json +4 -2
  45. package/sdk/audioWsClient.d.ts +10 -0
  46. package/sdk/audioWsClient.d.ts.map +1 -0
  47. package/sdk/audioWsClient.js +66 -0
  48. package/sdk/audioWsClient.js.map +1 -0
  49. package/sdk/index.d.ts +1 -1
  50. package/sdk/index.d.ts.map +1 -1
  51. package/sdk/index.js +1 -1
  52. package/sdk/index.js.map +1 -1
  53. package/sdk/sdk.d.ts +1 -23
  54. package/sdk/sdk.d.ts.map +1 -1
  55. package/sdk/sdk.js +11 -437
  56. package/sdk/sdk.js.map +1 -1
  57. package/src/example.ts +26 -4
  58. package/src/models/components/agent.ts +8 -460
  59. package/src/models/components/calldetail.ts +47 -42
  60. package/src/models/components/index.ts +0 -3
  61. package/src/models/errors/index.ts +1 -6
  62. package/src/models/errors/{createphonecall.ts → registercall.ts} +60 -60
  63. package/src/models/operations/createagent.ts +8 -50
  64. package/src/models/operations/getcall.ts +1 -1
  65. package/src/models/operations/index.ts +1 -7
  66. package/src/models/operations/listcalls.ts +1 -11
  67. package/src/models/operations/registercall.ts +167 -0
  68. package/src/models/operations/updateagent.ts +11 -58
  69. package/src/sdk/audioWsClient.ts +68 -0
  70. package/src/sdk/index.ts +1 -1
  71. package/src/sdk/sdk.ts +13 -526
  72. package/src/models/components/agentpromptparams.ts +0 -61
  73. package/src/models/components/callphonenumber.ts +0 -64
  74. package/src/models/components/phonenumber.ts +0 -84
  75. package/src/models/errors/createphonenumber.ts +0 -552
  76. package/src/models/errors/deletephonenumber.ts +0 -442
  77. package/src/models/errors/getphonenumber.ts +0 -442
  78. package/src/models/errors/listphonenumbers.ts +0 -332
  79. package/src/models/errors/updatephoneagent.ts +0 -442
  80. package/src/models/operations/createphonecall.ts +0 -353
  81. package/src/models/operations/createphonenumber.ts +0 -144
  82. package/src/models/operations/createwebcall.ts +0 -16
  83. package/src/models/operations/deletephonenumber.ts +0 -119
  84. package/src/models/operations/getphonenumber.ts +0 -134
  85. package/src/models/operations/listphonenumbers.ts +0 -88
  86. package/src/models/operations/updatephoneagent.ts +0 -187
  87. package/src/sdk/liveClient.ts +0 -113
@@ -4,431 +4,6 @@
4
4
 
5
5
  import { z } from "zod";
6
6
 
7
- export type Function = {
8
- /**
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
- */
11
- url: string;
12
- /**
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
- */
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
- /**
26
- * The type of parameters is object.
27
- */
28
- type: "object";
29
- /**
30
- * Defines what properties are required for the parameters.
31
- */
32
- required?: string[] | undefined;
33
- /**
34
- * Key-value pairs object where each key is the name of a property and each value is a schema used to validate that property.
35
- */
36
- properties: Record<string, any>;
37
- }
38
- | undefined;
39
- };
40
-
41
- /** @internal */
42
- export namespace Function$ {
43
- export type Inbound = {
44
- url: string;
45
- description?: string | undefined;
46
- name: string;
47
- parameters?:
48
- | {
49
- type: "object";
50
- required?: string[] | undefined;
51
- properties: Record<string, any>;
52
- }
53
- | undefined;
54
- };
55
-
56
- export const inboundSchema: z.ZodType<Function, z.ZodTypeDef, Inbound> = z
57
- .object({
58
- url: z.string(),
59
- description: z.string().optional(),
60
- name: z.string(),
61
- parameters: z
62
- .object({
63
- type: z.literal("object"),
64
- required: z.array(z.string()).optional(),
65
- properties: z.record(z.any()),
66
- })
67
- .optional(),
68
- })
69
- .transform((v) => {
70
- return {
71
- url: v.url,
72
- ...(v.description === undefined
73
- ? null
74
- : { description: v.description }),
75
- name: v.name,
76
- ...(v.parameters === undefined ? null : { parameters: v.parameters }),
77
- };
78
- });
79
-
80
- export type Outbound = {
81
- url: string;
82
- description?: string | undefined;
83
- name: string;
84
- parameters?:
85
- | {
86
- type: "object";
87
- required?: string[] | undefined;
88
- properties: Record<string, any>;
89
- }
90
- | undefined;
91
- };
92
-
93
- export const outboundSchema: z.ZodType<Function, z.ZodTypeDef, Inbound> = z
94
- .object({
95
- url: z.string(),
96
- description: z.string().optional(),
97
- name: z.string(),
98
- parameters: z
99
- .object({
100
- type: z.literal("object"),
101
- required: z.array(z.string()).optional(),
102
- properties: z.record(z.any()),
103
- })
104
- .optional(),
105
- })
106
- .transform((v) => {
107
- return {
108
- url: v.url,
109
- ...(v.description === undefined
110
- ? null
111
- : { description: v.description }),
112
- name: v.name,
113
- ...(v.parameters === undefined ? null : { parameters: v.parameters }),
114
- };
115
- });
116
- }
117
-
118
- export type RetellLlmSetting = {
119
- /**
120
- * Retell picked LLM based conversation response.
121
- */
122
- provider: "retell";
123
- /**
124
- * The prompt agent will follow. Can use `${YOUR_PARAM_NAME}` to represent dynamic data that would get injected at each call.
125
- */
126
- prompt: string;
127
- };
128
-
129
- /** @internal */
130
- export namespace RetellLlmSetting$ {
131
- export type Inbound = {
132
- provider: "retell";
133
- prompt: string;
134
- };
135
-
136
- export const inboundSchema: z.ZodType<
137
- RetellLlmSetting,
138
- z.ZodTypeDef,
139
- Inbound
140
- > = z
141
- .object({
142
- provider: z.literal("retell"),
143
- prompt: z.string(),
144
- })
145
- .transform((v) => {
146
- return {
147
- provider: v.provider,
148
- prompt: v.prompt,
149
- };
150
- });
151
-
152
- export type Outbound = {
153
- provider: "retell";
154
- prompt: string;
155
- };
156
-
157
- export const outboundSchema: z.ZodType<
158
- Outbound,
159
- z.ZodTypeDef,
160
- RetellLlmSetting
161
- > = z
162
- .object({
163
- provider: z.literal("retell"),
164
- prompt: z.string(),
165
- })
166
- .transform((v) => {
167
- return {
168
- provider: v.provider,
169
- prompt: v.prompt,
170
- };
171
- });
172
- }
173
-
174
- export type CustomLlmSetting = {
175
- /**
176
- * Custom response system, usually your custom LLM. Note that you may see a higher latency if provided server is slow.
177
- */
178
- provider: "custom";
179
- /**
180
- * The URL we will call for getting response, usually your server.
181
- */
182
- url: string;
183
- /**
184
- * Whether the provided URL support return response via Server Sent Events.
185
- */
186
- stream: boolean;
187
- };
188
-
189
- /** @internal */
190
- export namespace CustomLlmSetting$ {
191
- export type Inbound = {
192
- provider: "custom";
193
- url: string;
194
- stream: boolean;
195
- };
196
-
197
- export const inboundSchema: z.ZodType<
198
- CustomLlmSetting,
199
- z.ZodTypeDef,
200
- Inbound
201
- > = z
202
- .object({
203
- provider: z.literal("custom"),
204
- url: z.string(),
205
- stream: z.boolean(),
206
- })
207
- .transform((v) => {
208
- return {
209
- provider: v.provider,
210
- url: v.url,
211
- stream: v.stream,
212
- };
213
- });
214
-
215
- export type Outbound = {
216
- provider: "custom";
217
- url: string;
218
- stream: boolean;
219
- };
220
-
221
- export const outboundSchema: z.ZodType<
222
- Outbound,
223
- z.ZodTypeDef,
224
- CustomLlmSetting
225
- > = z
226
- .object({
227
- provider: z.literal("custom"),
228
- url: z.string(),
229
- stream: z.boolean(),
230
- })
231
- .transform((v) => {
232
- return {
233
- provider: v.provider,
234
- url: v.url,
235
- stream: v.stream,
236
- };
237
- });
238
- }
239
-
240
- export type InteractionSettingRequest = {
241
- /**
242
- * 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.
243
- */
244
- enableBeginMessage?: boolean | undefined;
245
- /**
246
- * 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.
247
- */
248
- beginMessage?: string | undefined;
249
- /**
250
- * Whether the agent can end a call. If false, the agent would never end a call.
251
- */
252
- enableEndCall?: boolean | undefined;
253
- /**
254
- * 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.
255
- */
256
- enableEndMessage?: boolean | undefined;
257
- /**
258
- * 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.
259
- */
260
- endMessage?: string | undefined;
261
- };
262
-
263
- /** @internal */
264
- export namespace InteractionSettingRequest$ {
265
- export type Inbound = {
266
- enable_begin_message?: boolean | undefined;
267
- begin_message?: string | undefined;
268
- enable_end_call?: boolean | undefined;
269
- enable_end_message?: boolean | undefined;
270
- end_message?: string | undefined;
271
- };
272
-
273
- export const inboundSchema: z.ZodType<
274
- InteractionSettingRequest,
275
- z.ZodTypeDef,
276
- Inbound
277
- > = z
278
- .object({
279
- enable_begin_message: z.boolean().optional(),
280
- begin_message: z.string().optional(),
281
- enable_end_call: z.boolean().optional(),
282
- enable_end_message: z.boolean().optional(),
283
- end_message: z.string().optional(),
284
- })
285
- .transform((v) => {
286
- return {
287
- ...(v.enable_begin_message === undefined
288
- ? null
289
- : { enableBeginMessage: v.enable_begin_message }),
290
- ...(v.begin_message === undefined
291
- ? null
292
- : { beginMessage: v.begin_message }),
293
- ...(v.enable_end_call === undefined
294
- ? null
295
- : { enableEndCall: v.enable_end_call }),
296
- ...(v.enable_end_message === undefined
297
- ? null
298
- : { enableEndMessage: v.enable_end_message }),
299
- ...(v.end_message === undefined ? null : { endMessage: v.end_message }),
300
- };
301
- });
302
-
303
- export type Outbound = {
304
- enable_begin_message?: boolean | undefined;
305
- begin_message?: string | undefined;
306
- enable_end_call?: boolean | undefined;
307
- enable_end_message?: boolean | undefined;
308
- end_message?: string | undefined;
309
- };
310
-
311
- export const outboundSchema: z.ZodType<
312
- Outbound,
313
- z.ZodTypeDef,
314
- InteractionSettingRequest
315
- > = z
316
- .object({
317
- enableBeginMessage: z.boolean().optional(),
318
- beginMessage: z.string().optional(),
319
- enableEndCall: z.boolean().optional(),
320
- enableEndMessage: z.boolean().optional(),
321
- endMessage: z.string().optional(),
322
- })
323
- .transform((v) => {
324
- return {
325
- ...(v.enableBeginMessage === undefined
326
- ? null
327
- : { enable_begin_message: v.enableBeginMessage }),
328
- ...(v.beginMessage === undefined
329
- ? null
330
- : { begin_message: v.beginMessage }),
331
- ...(v.enableEndCall === undefined
332
- ? null
333
- : { enable_end_call: v.enableEndCall }),
334
- ...(v.enableEndMessage === undefined
335
- ? null
336
- : { enable_end_message: v.enableEndMessage }),
337
- ...(v.endMessage === undefined ? null : { end_message: v.endMessage }),
338
- };
339
- });
340
- }
341
-
342
- export type InteractionSettingResponse = {
343
- /**
344
- * 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.
345
- */
346
- enableBeginMessage: boolean;
347
- /**
348
- * 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.
349
- */
350
- beginMessage?: string | undefined;
351
- /**
352
- * Whether the agent can end a call. If false, the agent would never end a call.
353
- */
354
- enableEndCall: boolean;
355
- /**
356
- * 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.
357
- */
358
- enableEndMessage: boolean;
359
- /**
360
- * 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.
361
- */
362
- endMessage?: string | undefined;
363
- };
364
-
365
- /** @internal */
366
- export namespace InteractionSettingResponse$ {
367
- export type Inbound = {
368
- enable_begin_message: boolean;
369
- begin_message?: string | undefined;
370
- enable_end_call: boolean;
371
- enable_end_message: boolean;
372
- end_message?: string | undefined;
373
- };
374
-
375
- export const inboundSchema: z.ZodType<
376
- InteractionSettingResponse,
377
- z.ZodTypeDef,
378
- Inbound
379
- > = z
380
- .object({
381
- enable_begin_message: z.boolean(),
382
- begin_message: z.string().optional(),
383
- enable_end_call: z.boolean(),
384
- enable_end_message: z.boolean(),
385
- end_message: z.string().optional(),
386
- })
387
- .transform((v) => {
388
- return {
389
- enableBeginMessage: v.enable_begin_message,
390
- ...(v.begin_message === undefined
391
- ? null
392
- : { beginMessage: v.begin_message }),
393
- enableEndCall: v.enable_end_call,
394
- enableEndMessage: v.enable_end_message,
395
- ...(v.end_message === undefined ? null : { endMessage: v.end_message }),
396
- };
397
- });
398
-
399
- export type Outbound = {
400
- enable_begin_message: boolean;
401
- begin_message?: string | undefined;
402
- enable_end_call: boolean;
403
- enable_end_message: boolean;
404
- end_message?: string | undefined;
405
- };
406
-
407
- export const outboundSchema: z.ZodType<
408
- Outbound,
409
- z.ZodTypeDef,
410
- InteractionSettingResponse
411
- > = z
412
- .object({
413
- enableBeginMessage: z.boolean(),
414
- beginMessage: z.string().optional(),
415
- enableEndCall: z.boolean(),
416
- enableEndMessage: z.boolean(),
417
- endMessage: z.string().optional(),
418
- })
419
- .transform((v) => {
420
- return {
421
- enable_begin_message: v.enableBeginMessage,
422
- ...(v.beginMessage === undefined
423
- ? null
424
- : { begin_message: v.beginMessage }),
425
- enable_end_call: v.enableEndCall,
426
- enable_end_message: v.enableEndMessage,
427
- ...(v.endMessage === undefined ? null : { end_message: v.endMessage }),
428
- };
429
- });
430
- }
431
-
432
7
  export type Agent = {
433
8
  /**
434
9
  * Unique id of agent.
@@ -439,14 +14,9 @@ export type Agent = {
439
14
  */
440
15
  agentName?: string | undefined;
441
16
  /*
442
- * Determines how to generate the response in the call. Currently supports using our in-house LLM response system or your own custom
443
- * response generation system.
444
- */
445
- llmSetting: RetellLlmSetting | CustomLlmSetting;
446
- /**
447
- * Setting combination that controls interaction flow, like begin and end logic.
17
+ * The URL we will establish LLM websocket for getting response, usually your server.
448
18
  */
449
- interactionSetting: InteractionSettingResponse;
19
+ llmWebsocketUrl: string;
450
20
  /**
451
21
  * Unique voice id used for the agent. Find list of available voices in documentation.
452
22
  */
@@ -455,10 +25,6 @@ export type Agent = {
455
25
  * Last modification timestamp (milliseconds since epoch). Either the time of last update or creation if no updates available.
456
26
  */
457
27
  lastModificationTimestamp: number;
458
- /**
459
- * 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.
460
- */
461
- functions?: Function[] | undefined;
462
28
  };
463
29
 
464
30
  /** @internal */
@@ -466,70 +32,52 @@ export namespace Agent$ {
466
32
  export type Inbound = {
467
33
  agent_id: string;
468
34
  agent_name?: string | undefined;
469
- llm_setting: RetellLlmSetting$.Inbound | CustomLlmSetting$.Inbound;
470
- interaction_setting: InteractionSettingResponse$.Inbound;
35
+ llm_websocket_url: string;
471
36
  voice_id: string;
472
37
  last_modification_timestamp: number;
473
- functions?: Function[] | undefined;
474
38
  };
475
39
 
476
40
  export const inboundSchema: z.ZodType<Agent, z.ZodTypeDef, Inbound> = z
477
41
  .object({
478
42
  agent_id: z.string(),
479
43
  agent_name: z.string().optional(),
480
- llm_setting: z.union([
481
- RetellLlmSetting$.inboundSchema,
482
- CustomLlmSetting$.inboundSchema,
483
- ]),
484
- interaction_setting: InteractionSettingResponse$.inboundSchema,
44
+ llm_websocket_url: z.string(),
485
45
  voice_id: z.string(),
486
46
  last_modification_timestamp: z.number().int(),
487
- functions: z.array(Function$.inboundSchema).optional(),
488
47
  })
489
48
  .transform((v) => {
490
49
  return {
491
50
  agentId: v.agent_id,
492
51
  ...(v.agent_name === undefined ? null : { agentName: v.agent_name }),
493
- llmSetting: v.llm_setting,
494
- interactionSetting: v.interaction_setting,
52
+ llmWebsocketUrl: v.llm_websocket_url,
495
53
  voiceId: v.voice_id,
496
54
  lastModificationTimestamp: v.last_modification_timestamp,
497
- ...(v.functions === undefined ? null : { functions: v.functions }),
498
55
  };
499
56
  });
500
57
 
501
58
  export type Outbound = {
502
59
  agent_id: string;
503
60
  agent_name?: string | undefined;
504
- llm_setting: RetellLlmSetting$.Outbound | CustomLlmSetting$.Outbound;
505
- interaction_setting: InteractionSettingResponse$.Outbound;
61
+ llm_websocket_url: string;
506
62
  voice_id: string;
507
63
  last_modification_timestamp: number;
508
- functions?: Function[] | undefined;
509
64
  };
510
65
 
511
66
  export const outboundSchema: z.ZodType<Outbound, z.ZodTypeDef, Agent> = z
512
67
  .object({
513
68
  agentId: z.string(),
514
69
  agentName: z.string().optional(),
515
- llmSetting: z.union([
516
- RetellLlmSetting$.outboundSchema,
517
- CustomLlmSetting$.outboundSchema,
518
- ]),
519
- interactionSetting: InteractionSettingResponse$.outboundSchema,
70
+ llmWebsocketUrl: z.string(),
520
71
  voiceId: z.string(),
521
72
  lastModificationTimestamp: z.number().int(),
522
- functions: z.array(Function$.inboundSchema).optional(),
523
73
  })
524
74
  .transform((v) => {
525
75
  return {
526
76
  agent_id: v.agentId,
527
77
  ...(v.agentName === undefined ? null : { agent_name: v.agentName }),
528
- llm_setting: v.llmSetting,
529
- interaction_setting: v.interactionSetting,
78
+ llm_websocket_url: v.llmWebsocketUrl,
530
79
  voice_id: v.voiceId,
531
80
  last_modification_timestamp: v.lastModificationTimestamp,
532
- ...(v.functions === undefined ? null : { functions: v.functions }),
533
81
  };
534
82
  });
535
83
  }