@vapi-ai/web 1.0.253 → 1.0.256
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/README.md +21 -3
- package/api.ts +681 -229
- package/dist/api.d.ts +590 -212
- package/dist/api.js +470 -326
- package/dist/client.js +2 -11
- package/dist/vapi.js +90 -108
- package/package.json +2 -2
- package/tsconfig.json +1 -1
- package/vapi.ts +3 -1
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ First, import the Vapi class from the package:
|
|
|
18
18
|
import Vapi from '@vapi-ai/web';
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Then, create a new instance of the Vapi class, passing your
|
|
21
|
+
Then, create a new instance of the Vapi class, passing your Public Key as a parameter to the constructor:
|
|
22
22
|
|
|
23
23
|
```javascript
|
|
24
|
-
const vapi = new Vapi('your-
|
|
24
|
+
const vapi = new Vapi('your-public-key');
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
You can start a new call by calling the `start` method and passing an `assistant` object or `assistantId`:
|
|
@@ -33,7 +33,10 @@ vapi.start({
|
|
|
33
33
|
model: "gpt-3.5-turbo",
|
|
34
34
|
systemPrompt: "You're an assistant..."
|
|
35
35
|
},
|
|
36
|
-
|
|
36
|
+
voice: {
|
|
37
|
+
provider: "11labs",
|
|
38
|
+
voiceId: "burt",
|
|
39
|
+
},
|
|
37
40
|
...
|
|
38
41
|
});
|
|
39
42
|
```
|
|
@@ -43,6 +46,21 @@ vapi.start('your-assistant-id');
|
|
|
43
46
|
|
|
44
47
|
The `start` method will initiate a new call.
|
|
45
48
|
|
|
49
|
+
You can also send text messages to the assistant aside from the audio input using the `send` method and passing appropriate `role` and `content`.
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
vapi.send({
|
|
53
|
+
type: "add-message",
|
|
54
|
+
message: {
|
|
55
|
+
role: "system",
|
|
56
|
+
content: "The user has pressed the button, say peanuts",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Possible values for the role are `system`, `user`, `assistant`, `tool` or `function`.
|
|
63
|
+
|
|
46
64
|
You can stop the session by calling the `stop` method:
|
|
47
65
|
|
|
48
66
|
```javascript
|