retell-sdk 2.2.2 → 2.2.4

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