@vapi-ai/web 1.0.222 → 1.0.223
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.
- package/api.ts +63 -18
- package/dist/api.d.ts +61 -17
- package/dist/api.js +3 -2
- package/package.json +1 -1
package/api.ts
CHANGED
|
@@ -9,9 +9,15 @@
|
|
|
9
9
|
* ---------------------------------------------------------------
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
export interface
|
|
13
|
-
type: string;
|
|
14
|
-
|
|
12
|
+
export interface OpenAIFunctionParameterProperty {
|
|
13
|
+
type: "string" | "number" | "boolean";
|
|
14
|
+
enum?: string[];
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface OpenAIFunctionParameters {
|
|
19
|
+
type: "object";
|
|
20
|
+
properties: Record<string, OpenAIFunctionParameterProperty>;
|
|
15
21
|
required?: string[];
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -23,6 +29,8 @@ export interface OpenAIFunction {
|
|
|
23
29
|
* @maxLength 64
|
|
24
30
|
*/
|
|
25
31
|
name: string;
|
|
32
|
+
/** Setting async: true will cause the function to be called asynchronously, meaning that the Assistant will not wait for the function to return before continuing. */
|
|
33
|
+
async?: boolean;
|
|
26
34
|
/** This is the description of what the function does, used by the AI to choose when and how to call the function. */
|
|
27
35
|
description?: string;
|
|
28
36
|
/**
|
|
@@ -32,12 +40,12 @@ export interface OpenAIFunction {
|
|
|
32
40
|
*
|
|
33
41
|
* To describe a function that accepts no parameters, provide the value {"type": "object", "properties": {}}.
|
|
34
42
|
*/
|
|
35
|
-
parameters:
|
|
43
|
+
parameters: OpenAIFunctionParameters;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
export interface CreateAssistantDTO {
|
|
39
47
|
/** This is the OpenAI model that will be used. */
|
|
40
|
-
model?: "gpt-4
|
|
48
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
41
49
|
/**
|
|
42
50
|
* This is the voice that will be used.
|
|
43
51
|
*
|
|
@@ -90,18 +98,30 @@ export interface CreateAssistantDTO {
|
|
|
90
98
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
91
99
|
*/
|
|
92
100
|
callbackUrl?: string;
|
|
101
|
+
/**
|
|
102
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
103
|
+
*
|
|
104
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
105
|
+
*
|
|
106
|
+
* ```
|
|
107
|
+
* { message: "Oh hey! How are..." }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
customLlmUrl?: string;
|
|
93
111
|
/** This is the number to forward to if assistant runs into issues. */
|
|
94
112
|
forwardingPhoneNumber?: string;
|
|
95
113
|
/**
|
|
96
114
|
* This is the first message that the assistant will say.
|
|
97
115
|
*
|
|
98
116
|
* If unspecified, it will wait for the user to speak.
|
|
99
|
-
* @maxLength
|
|
117
|
+
* @maxLength 400
|
|
100
118
|
*/
|
|
101
119
|
firstMessage?: string;
|
|
102
|
-
/** This sets whether
|
|
120
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
121
|
+
interruptionsEnabled?: boolean;
|
|
122
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
103
123
|
recordingEnabled?: boolean;
|
|
104
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
124
|
+
/** This sets whether assistant leaves voicemails when call is not picked up. Defaults to true. */
|
|
105
125
|
voicemailEnabled?: boolean;
|
|
106
126
|
}
|
|
107
127
|
|
|
@@ -264,7 +284,7 @@ export interface CreateWebCallDTO {
|
|
|
264
284
|
|
|
265
285
|
export interface Assistant {
|
|
266
286
|
/** This is the OpenAI model that will be used. */
|
|
267
|
-
model?: "gpt-4
|
|
287
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
268
288
|
/**
|
|
269
289
|
* This is the voice that will be used.
|
|
270
290
|
*
|
|
@@ -317,18 +337,30 @@ export interface Assistant {
|
|
|
317
337
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
318
338
|
*/
|
|
319
339
|
callbackUrl?: string;
|
|
340
|
+
/**
|
|
341
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
342
|
+
*
|
|
343
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
344
|
+
*
|
|
345
|
+
* ```
|
|
346
|
+
* { message: "Oh hey! How are..." }
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
customLlmUrl?: string;
|
|
320
350
|
/** This is the number to forward to if assistant runs into issues. */
|
|
321
351
|
forwardingPhoneNumber?: string;
|
|
322
352
|
/**
|
|
323
353
|
* This is the first message that the assistant will say.
|
|
324
354
|
*
|
|
325
355
|
* If unspecified, it will wait for the user to speak.
|
|
326
|
-
* @maxLength
|
|
356
|
+
* @maxLength 400
|
|
327
357
|
*/
|
|
328
358
|
firstMessage?: string;
|
|
329
|
-
/** This sets whether
|
|
359
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
360
|
+
interruptionsEnabled?: boolean;
|
|
361
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
330
362
|
recordingEnabled?: boolean;
|
|
331
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
363
|
+
/** This sets whether assistant leaves voicemails when call is not picked up. Defaults to true. */
|
|
332
364
|
voicemailEnabled?: boolean;
|
|
333
365
|
/** This is the unique identifier for the assistant. */
|
|
334
366
|
id: string;
|
|
@@ -348,7 +380,7 @@ export interface Assistant {
|
|
|
348
380
|
|
|
349
381
|
export interface UpdateAssistantDTO {
|
|
350
382
|
/** This is the OpenAI model that will be used. */
|
|
351
|
-
model?: "gpt-4
|
|
383
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
352
384
|
/**
|
|
353
385
|
* This is the voice that will be used.
|
|
354
386
|
*
|
|
@@ -401,18 +433,30 @@ export interface UpdateAssistantDTO {
|
|
|
401
433
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
402
434
|
*/
|
|
403
435
|
callbackUrl?: string;
|
|
436
|
+
/**
|
|
437
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
438
|
+
*
|
|
439
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
440
|
+
*
|
|
441
|
+
* ```
|
|
442
|
+
* { message: "Oh hey! How are..." }
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
customLlmUrl?: string;
|
|
404
446
|
/** This is the number to forward to if assistant runs into issues. */
|
|
405
447
|
forwardingPhoneNumber?: string;
|
|
406
448
|
/**
|
|
407
449
|
* This is the first message that the assistant will say.
|
|
408
450
|
*
|
|
409
451
|
* If unspecified, it will wait for the user to speak.
|
|
410
|
-
* @maxLength
|
|
452
|
+
* @maxLength 400
|
|
411
453
|
*/
|
|
412
454
|
firstMessage?: string;
|
|
413
|
-
/** This sets whether
|
|
455
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
456
|
+
interruptionsEnabled?: boolean;
|
|
457
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
414
458
|
recordingEnabled?: boolean;
|
|
415
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
459
|
+
/** This sets whether assistant leaves voicemails when call is not picked up. Defaults to true. */
|
|
416
460
|
voicemailEnabled?: boolean;
|
|
417
461
|
}
|
|
418
462
|
|
|
@@ -544,7 +588,7 @@ export enum ContentType {
|
|
|
544
588
|
}
|
|
545
589
|
|
|
546
590
|
export class HttpClient<SecurityDataType = unknown> {
|
|
547
|
-
public baseUrl: string = "";
|
|
591
|
+
public baseUrl: string = "https://api.vapi.ai";
|
|
548
592
|
private securityData: SecurityDataType | null = null;
|
|
549
593
|
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
|
|
550
594
|
private abortControllers = new Map<CancelToken, AbortController>();
|
|
@@ -711,9 +755,10 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
711
755
|
/**
|
|
712
756
|
* @title Vapi API
|
|
713
757
|
* @version 1.0
|
|
758
|
+
* @baseUrl https://api.vapi.ai
|
|
714
759
|
* @contact
|
|
715
760
|
*
|
|
716
|
-
* API for
|
|
761
|
+
* API for building voice assistants
|
|
717
762
|
*/
|
|
718
763
|
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
719
764
|
call = {
|
package/dist/api.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
type: string;
|
|
3
|
-
|
|
1
|
+
export interface OpenAIFunctionParameterProperty {
|
|
2
|
+
type: "string" | "number" | "boolean";
|
|
3
|
+
enum?: string[];
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface OpenAIFunctionParameters {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: Record<string, OpenAIFunctionParameterProperty>;
|
|
4
9
|
required?: string[];
|
|
5
10
|
}
|
|
6
11
|
export interface OpenAIFunction {
|
|
@@ -11,6 +16,8 @@ export interface OpenAIFunction {
|
|
|
11
16
|
* @maxLength 64
|
|
12
17
|
*/
|
|
13
18
|
name: string;
|
|
19
|
+
/** Setting async: true will cause the function to be called asynchronously, meaning that the Assistant will not wait for the function to return before continuing. */
|
|
20
|
+
async?: boolean;
|
|
14
21
|
/** This is the description of what the function does, used by the AI to choose when and how to call the function. */
|
|
15
22
|
description?: string;
|
|
16
23
|
/**
|
|
@@ -20,11 +27,11 @@ export interface OpenAIFunction {
|
|
|
20
27
|
*
|
|
21
28
|
* To describe a function that accepts no parameters, provide the value {"type": "object", "properties": {}}.
|
|
22
29
|
*/
|
|
23
|
-
parameters:
|
|
30
|
+
parameters: OpenAIFunctionParameters;
|
|
24
31
|
}
|
|
25
32
|
export interface CreateAssistantDTO {
|
|
26
33
|
/** This is the OpenAI model that will be used. */
|
|
27
|
-
model?: "gpt-4
|
|
34
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
28
35
|
/**
|
|
29
36
|
* This is the voice that will be used.
|
|
30
37
|
*
|
|
@@ -48,18 +55,30 @@ export interface CreateAssistantDTO {
|
|
|
48
55
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
49
56
|
*/
|
|
50
57
|
callbackUrl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
60
|
+
*
|
|
61
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
62
|
+
*
|
|
63
|
+
* ```
|
|
64
|
+
* { message: "Oh hey! How are..." }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
customLlmUrl?: string;
|
|
51
68
|
/** This is the number to forward to if assistant runs into issues. */
|
|
52
69
|
forwardingPhoneNumber?: string;
|
|
53
70
|
/**
|
|
54
71
|
* This is the first message that the assistant will say.
|
|
55
72
|
*
|
|
56
73
|
* If unspecified, it will wait for the user to speak.
|
|
57
|
-
* @maxLength
|
|
74
|
+
* @maxLength 400
|
|
58
75
|
*/
|
|
59
76
|
firstMessage?: string;
|
|
60
|
-
/** This sets whether
|
|
77
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
78
|
+
interruptionsEnabled?: boolean;
|
|
79
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
61
80
|
recordingEnabled?: boolean;
|
|
62
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
81
|
+
/** This sets whether assistant leaves voicemails when call is not picked up. Defaults to true. */
|
|
63
82
|
voicemailEnabled?: boolean;
|
|
64
83
|
}
|
|
65
84
|
export interface CreateCustomerDTO {
|
|
@@ -216,7 +235,7 @@ export interface CreateWebCallDTO {
|
|
|
216
235
|
}
|
|
217
236
|
export interface Assistant {
|
|
218
237
|
/** This is the OpenAI model that will be used. */
|
|
219
|
-
model?: "gpt-4
|
|
238
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
220
239
|
/**
|
|
221
240
|
* This is the voice that will be used.
|
|
222
241
|
*
|
|
@@ -240,18 +259,30 @@ export interface Assistant {
|
|
|
240
259
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
241
260
|
*/
|
|
242
261
|
callbackUrl?: string;
|
|
262
|
+
/**
|
|
263
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
264
|
+
*
|
|
265
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
266
|
+
*
|
|
267
|
+
* ```
|
|
268
|
+
* { message: "Oh hey! How are..." }
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
customLlmUrl?: string;
|
|
243
272
|
/** This is the number to forward to if assistant runs into issues. */
|
|
244
273
|
forwardingPhoneNumber?: string;
|
|
245
274
|
/**
|
|
246
275
|
* This is the first message that the assistant will say.
|
|
247
276
|
*
|
|
248
277
|
* If unspecified, it will wait for the user to speak.
|
|
249
|
-
* @maxLength
|
|
278
|
+
* @maxLength 400
|
|
250
279
|
*/
|
|
251
280
|
firstMessage?: string;
|
|
252
|
-
/** This sets whether
|
|
281
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
282
|
+
interruptionsEnabled?: boolean;
|
|
283
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
253
284
|
recordingEnabled?: boolean;
|
|
254
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
285
|
+
/** This sets whether assistant leaves voicemails when call is not picked up. Defaults to true. */
|
|
255
286
|
voicemailEnabled?: boolean;
|
|
256
287
|
/** This is the unique identifier for the assistant. */
|
|
257
288
|
id: string;
|
|
@@ -270,7 +301,7 @@ export interface Assistant {
|
|
|
270
301
|
}
|
|
271
302
|
export interface UpdateAssistantDTO {
|
|
272
303
|
/** This is the OpenAI model that will be used. */
|
|
273
|
-
model?: "gpt-4
|
|
304
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
274
305
|
/**
|
|
275
306
|
* This is the voice that will be used.
|
|
276
307
|
*
|
|
@@ -294,18 +325,30 @@ export interface UpdateAssistantDTO {
|
|
|
294
325
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
295
326
|
*/
|
|
296
327
|
callbackUrl?: string;
|
|
328
|
+
/**
|
|
329
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
330
|
+
*
|
|
331
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
332
|
+
*
|
|
333
|
+
* ```
|
|
334
|
+
* { message: "Oh hey! How are..." }
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
customLlmUrl?: string;
|
|
297
338
|
/** This is the number to forward to if assistant runs into issues. */
|
|
298
339
|
forwardingPhoneNumber?: string;
|
|
299
340
|
/**
|
|
300
341
|
* This is the first message that the assistant will say.
|
|
301
342
|
*
|
|
302
343
|
* If unspecified, it will wait for the user to speak.
|
|
303
|
-
* @maxLength
|
|
344
|
+
* @maxLength 400
|
|
304
345
|
*/
|
|
305
346
|
firstMessage?: string;
|
|
306
|
-
/** This sets whether
|
|
347
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
348
|
+
interruptionsEnabled?: boolean;
|
|
349
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
307
350
|
recordingEnabled?: boolean;
|
|
308
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
351
|
+
/** This sets whether assistant leaves voicemails when call is not picked up. Defaults to true. */
|
|
309
352
|
voicemailEnabled?: boolean;
|
|
310
353
|
}
|
|
311
354
|
export interface BuyPhoneNumberDTO {
|
|
@@ -448,9 +491,10 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
448
491
|
/**
|
|
449
492
|
* @title Vapi API
|
|
450
493
|
* @version 1.0
|
|
494
|
+
* @baseUrl https://api.vapi.ai
|
|
451
495
|
* @contact
|
|
452
496
|
*
|
|
453
|
-
* API for
|
|
497
|
+
* API for building voice assistants
|
|
454
498
|
*/
|
|
455
499
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
456
500
|
call: {
|
package/dist/api.js
CHANGED
|
@@ -40,7 +40,7 @@ var ContentType;
|
|
|
40
40
|
})(ContentType || (exports.ContentType = ContentType = {}));
|
|
41
41
|
class HttpClient {
|
|
42
42
|
constructor(apiConfig = {}) {
|
|
43
|
-
this.baseUrl = "";
|
|
43
|
+
this.baseUrl = "https://api.vapi.ai";
|
|
44
44
|
this.securityData = null;
|
|
45
45
|
this.abortControllers = new Map();
|
|
46
46
|
this.customFetch = (...fetchParams) => fetch(...fetchParams);
|
|
@@ -156,9 +156,10 @@ exports.HttpClient = HttpClient;
|
|
|
156
156
|
/**
|
|
157
157
|
* @title Vapi API
|
|
158
158
|
* @version 1.0
|
|
159
|
+
* @baseUrl https://api.vapi.ai
|
|
159
160
|
* @contact
|
|
160
161
|
*
|
|
161
|
-
* API for
|
|
162
|
+
* API for building voice assistants
|
|
162
163
|
*/
|
|
163
164
|
class Api extends HttpClient {
|
|
164
165
|
constructor() {
|