@vapi-ai/web 1.0.222 → 1.0.224
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 +81 -21
- package/dist/api.d.ts +79 -20
- 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,19 +98,36 @@ 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
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* This is the message that the assistant will say if the call is forwarded to voicemail.
|
|
122
|
+
*
|
|
123
|
+
* If unspecified, it will hang up.
|
|
124
|
+
* @maxLength 400
|
|
125
|
+
*/
|
|
126
|
+
voicemailMessage?: string;
|
|
127
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
128
|
+
interruptionsEnabled?: boolean;
|
|
129
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
103
130
|
recordingEnabled?: boolean;
|
|
104
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
105
|
-
voicemailEnabled?: boolean;
|
|
106
131
|
}
|
|
107
132
|
|
|
108
133
|
export interface CreateCustomerDTO {
|
|
@@ -264,7 +289,7 @@ export interface CreateWebCallDTO {
|
|
|
264
289
|
|
|
265
290
|
export interface Assistant {
|
|
266
291
|
/** This is the OpenAI model that will be used. */
|
|
267
|
-
model?: "gpt-4
|
|
292
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
268
293
|
/**
|
|
269
294
|
* This is the voice that will be used.
|
|
270
295
|
*
|
|
@@ -317,19 +342,36 @@ export interface Assistant {
|
|
|
317
342
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
318
343
|
*/
|
|
319
344
|
callbackUrl?: string;
|
|
345
|
+
/**
|
|
346
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
347
|
+
*
|
|
348
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
349
|
+
*
|
|
350
|
+
* ```
|
|
351
|
+
* { message: "Oh hey! How are..." }
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
customLlmUrl?: string;
|
|
320
355
|
/** This is the number to forward to if assistant runs into issues. */
|
|
321
356
|
forwardingPhoneNumber?: string;
|
|
322
357
|
/**
|
|
323
358
|
* This is the first message that the assistant will say.
|
|
324
359
|
*
|
|
325
360
|
* If unspecified, it will wait for the user to speak.
|
|
326
|
-
* @maxLength
|
|
361
|
+
* @maxLength 400
|
|
327
362
|
*/
|
|
328
363
|
firstMessage?: string;
|
|
329
|
-
/**
|
|
364
|
+
/**
|
|
365
|
+
* This is the message that the assistant will say if the call is forwarded to voicemail.
|
|
366
|
+
*
|
|
367
|
+
* If unspecified, it will hang up.
|
|
368
|
+
* @maxLength 400
|
|
369
|
+
*/
|
|
370
|
+
voicemailMessage?: string;
|
|
371
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
372
|
+
interruptionsEnabled?: boolean;
|
|
373
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
330
374
|
recordingEnabled?: boolean;
|
|
331
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
332
|
-
voicemailEnabled?: boolean;
|
|
333
375
|
/** This is the unique identifier for the assistant. */
|
|
334
376
|
id: string;
|
|
335
377
|
/** This is the unique identifier for the org that this assistant belongs to. */
|
|
@@ -348,7 +390,7 @@ export interface Assistant {
|
|
|
348
390
|
|
|
349
391
|
export interface UpdateAssistantDTO {
|
|
350
392
|
/** This is the OpenAI model that will be used. */
|
|
351
|
-
model?: "gpt-4
|
|
393
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
352
394
|
/**
|
|
353
395
|
* This is the voice that will be used.
|
|
354
396
|
*
|
|
@@ -401,19 +443,36 @@ export interface UpdateAssistantDTO {
|
|
|
401
443
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
402
444
|
*/
|
|
403
445
|
callbackUrl?: string;
|
|
446
|
+
/**
|
|
447
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
448
|
+
*
|
|
449
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
450
|
+
*
|
|
451
|
+
* ```
|
|
452
|
+
* { message: "Oh hey! How are..." }
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
customLlmUrl?: string;
|
|
404
456
|
/** This is the number to forward to if assistant runs into issues. */
|
|
405
457
|
forwardingPhoneNumber?: string;
|
|
406
458
|
/**
|
|
407
459
|
* This is the first message that the assistant will say.
|
|
408
460
|
*
|
|
409
461
|
* If unspecified, it will wait for the user to speak.
|
|
410
|
-
* @maxLength
|
|
462
|
+
* @maxLength 400
|
|
411
463
|
*/
|
|
412
464
|
firstMessage?: string;
|
|
413
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* This is the message that the assistant will say if the call is forwarded to voicemail.
|
|
467
|
+
*
|
|
468
|
+
* If unspecified, it will hang up.
|
|
469
|
+
* @maxLength 400
|
|
470
|
+
*/
|
|
471
|
+
voicemailMessage?: string;
|
|
472
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
473
|
+
interruptionsEnabled?: boolean;
|
|
474
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
414
475
|
recordingEnabled?: boolean;
|
|
415
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
416
|
-
voicemailEnabled?: boolean;
|
|
417
476
|
}
|
|
418
477
|
|
|
419
478
|
export interface BuyPhoneNumberDTO {
|
|
@@ -544,7 +603,7 @@ export enum ContentType {
|
|
|
544
603
|
}
|
|
545
604
|
|
|
546
605
|
export class HttpClient<SecurityDataType = unknown> {
|
|
547
|
-
public baseUrl: string = "";
|
|
606
|
+
public baseUrl: string = "https://api.vapi.ai";
|
|
548
607
|
private securityData: SecurityDataType | null = null;
|
|
549
608
|
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
|
|
550
609
|
private abortControllers = new Map<CancelToken, AbortController>();
|
|
@@ -711,9 +770,10 @@ export class HttpClient<SecurityDataType = unknown> {
|
|
|
711
770
|
/**
|
|
712
771
|
* @title Vapi API
|
|
713
772
|
* @version 1.0
|
|
773
|
+
* @baseUrl https://api.vapi.ai
|
|
714
774
|
* @contact
|
|
715
775
|
*
|
|
716
|
-
* API for
|
|
776
|
+
* API for building voice assistants
|
|
717
777
|
*/
|
|
718
778
|
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
719
779
|
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,19 +55,36 @@ 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
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* This is the message that the assistant will say if the call is forwarded to voicemail.
|
|
79
|
+
*
|
|
80
|
+
* If unspecified, it will hang up.
|
|
81
|
+
* @maxLength 400
|
|
82
|
+
*/
|
|
83
|
+
voicemailMessage?: string;
|
|
84
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
85
|
+
interruptionsEnabled?: boolean;
|
|
86
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
61
87
|
recordingEnabled?: boolean;
|
|
62
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
63
|
-
voicemailEnabled?: boolean;
|
|
64
88
|
}
|
|
65
89
|
export interface CreateCustomerDTO {
|
|
66
90
|
/** This is the number of the customer. */
|
|
@@ -216,7 +240,7 @@ export interface CreateWebCallDTO {
|
|
|
216
240
|
}
|
|
217
241
|
export interface Assistant {
|
|
218
242
|
/** This is the OpenAI model that will be used. */
|
|
219
|
-
model?: "gpt-4
|
|
243
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
220
244
|
/**
|
|
221
245
|
* This is the voice that will be used.
|
|
222
246
|
*
|
|
@@ -240,19 +264,36 @@ export interface Assistant {
|
|
|
240
264
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
241
265
|
*/
|
|
242
266
|
callbackUrl?: string;
|
|
267
|
+
/**
|
|
268
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
269
|
+
*
|
|
270
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
271
|
+
*
|
|
272
|
+
* ```
|
|
273
|
+
* { message: "Oh hey! How are..." }
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
customLlmUrl?: string;
|
|
243
277
|
/** This is the number to forward to if assistant runs into issues. */
|
|
244
278
|
forwardingPhoneNumber?: string;
|
|
245
279
|
/**
|
|
246
280
|
* This is the first message that the assistant will say.
|
|
247
281
|
*
|
|
248
282
|
* If unspecified, it will wait for the user to speak.
|
|
249
|
-
* @maxLength
|
|
283
|
+
* @maxLength 400
|
|
250
284
|
*/
|
|
251
285
|
firstMessage?: string;
|
|
252
|
-
/**
|
|
286
|
+
/**
|
|
287
|
+
* This is the message that the assistant will say if the call is forwarded to voicemail.
|
|
288
|
+
*
|
|
289
|
+
* If unspecified, it will hang up.
|
|
290
|
+
* @maxLength 400
|
|
291
|
+
*/
|
|
292
|
+
voicemailMessage?: string;
|
|
293
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
294
|
+
interruptionsEnabled?: boolean;
|
|
295
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
253
296
|
recordingEnabled?: boolean;
|
|
254
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
255
|
-
voicemailEnabled?: boolean;
|
|
256
297
|
/** This is the unique identifier for the assistant. */
|
|
257
298
|
id: string;
|
|
258
299
|
/** This is the unique identifier for the org that this assistant belongs to. */
|
|
@@ -270,7 +311,7 @@ export interface Assistant {
|
|
|
270
311
|
}
|
|
271
312
|
export interface UpdateAssistantDTO {
|
|
272
313
|
/** This is the OpenAI model that will be used. */
|
|
273
|
-
model?: "gpt-4
|
|
314
|
+
model?: "gpt-4" | "gpt-3.5-turbo";
|
|
274
315
|
/**
|
|
275
316
|
* This is the voice that will be used.
|
|
276
317
|
*
|
|
@@ -294,19 +335,36 @@ export interface UpdateAssistantDTO {
|
|
|
294
335
|
* All requests will be sent with customerPhoneNumber and all the assistant parameters. You can find more details in the Function Calling documentation.
|
|
295
336
|
*/
|
|
296
337
|
callbackUrl?: string;
|
|
338
|
+
/**
|
|
339
|
+
* If you are using a custom LLM, this is the URL Vapi will use instead of hitting OpenAI.
|
|
340
|
+
*
|
|
341
|
+
* A POST request will be sent with an array of messages, and the response should be like so:
|
|
342
|
+
*
|
|
343
|
+
* ```
|
|
344
|
+
* { message: "Oh hey! How are..." }
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
customLlmUrl?: string;
|
|
297
348
|
/** This is the number to forward to if assistant runs into issues. */
|
|
298
349
|
forwardingPhoneNumber?: string;
|
|
299
350
|
/**
|
|
300
351
|
* This is the first message that the assistant will say.
|
|
301
352
|
*
|
|
302
353
|
* If unspecified, it will wait for the user to speak.
|
|
303
|
-
* @maxLength
|
|
354
|
+
* @maxLength 400
|
|
304
355
|
*/
|
|
305
356
|
firstMessage?: string;
|
|
306
|
-
/**
|
|
357
|
+
/**
|
|
358
|
+
* This is the message that the assistant will say if the call is forwarded to voicemail.
|
|
359
|
+
*
|
|
360
|
+
* If unspecified, it will hang up.
|
|
361
|
+
* @maxLength 400
|
|
362
|
+
*/
|
|
363
|
+
voicemailMessage?: string;
|
|
364
|
+
/** This sets whether the user can interrupt the assistant while it's speaking. Defaults to true. */
|
|
365
|
+
interruptionsEnabled?: boolean;
|
|
366
|
+
/** This sets whether calls are recorded for the assistant. Defaults to true. */
|
|
307
367
|
recordingEnabled?: boolean;
|
|
308
|
-
/** This sets whether assistant leaves voicemails when call is not picked up. */
|
|
309
|
-
voicemailEnabled?: boolean;
|
|
310
368
|
}
|
|
311
369
|
export interface BuyPhoneNumberDTO {
|
|
312
370
|
/**
|
|
@@ -448,9 +506,10 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
448
506
|
/**
|
|
449
507
|
* @title Vapi API
|
|
450
508
|
* @version 1.0
|
|
509
|
+
* @baseUrl https://api.vapi.ai
|
|
451
510
|
* @contact
|
|
452
511
|
*
|
|
453
|
-
* API for
|
|
512
|
+
* API for building voice assistants
|
|
454
513
|
*/
|
|
455
514
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
456
515
|
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() {
|