@vapi-ai/web 1.1.0 → 1.1.3
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 +24 -8
- package/api.ts +1292 -124
- package/dist/api.d.ts +864 -105
- package/dist/api.js +79 -3
- package/dist/vapi.d.ts +2 -2
- package/dist/vapi.js +2 -1
- package/package.json +4 -4
- package/update.sh +1 -1
- package/vapi.ts +6 -2
package/README.md
CHANGED
|
@@ -45,23 +45,40 @@ vapi.start({
|
|
|
45
45
|
...
|
|
46
46
|
});
|
|
47
47
|
```
|
|
48
|
+
|
|
48
49
|
```javascript
|
|
49
50
|
vapi.start('your-assistant-id');
|
|
50
51
|
```
|
|
51
52
|
|
|
52
|
-
The `start` method will initiate a new call.
|
|
53
|
+
The `start` method will initiate a new call.
|
|
53
54
|
|
|
54
|
-
You can
|
|
55
|
+
You can override existing assistant parameters or set variables with the `assistant_overrides` parameter.
|
|
56
|
+
Assume the first message is `Hey, {{name}} how are you?` and you want to set the value of `name` to `John`:
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
const assistantOverrides = {
|
|
60
|
+
recordingEnabled: false,
|
|
61
|
+
variableValues: {
|
|
62
|
+
name: 'John',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
vapi.start({
|
|
67
|
+
assistantId: 'your-assistant-id',
|
|
68
|
+
assistantOverrides: assistantOverrides,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
You can send text messages to the assistant aside from the audio input using the `send` method and passing appropriate `role` and `content`.
|
|
55
73
|
|
|
56
74
|
```javascript
|
|
57
75
|
vapi.send({
|
|
58
|
-
type:
|
|
76
|
+
type: 'add-message',
|
|
59
77
|
message: {
|
|
60
|
-
role:
|
|
61
|
-
content:
|
|
78
|
+
role: 'system',
|
|
79
|
+
content: 'The user has pressed the button, say peanuts',
|
|
62
80
|
},
|
|
63
81
|
});
|
|
64
|
-
|
|
65
82
|
```
|
|
66
83
|
|
|
67
84
|
Possible values for the role are `system`, `user`, `assistant`, `tool` or `function`.
|
|
@@ -113,13 +130,12 @@ vapi.on('message', (message) => {
|
|
|
113
130
|
});
|
|
114
131
|
|
|
115
132
|
vapi.on('error', (e) => {
|
|
116
|
-
console.error(e)
|
|
133
|
+
console.error(e);
|
|
117
134
|
});
|
|
118
135
|
```
|
|
119
136
|
|
|
120
137
|
These events allow you to react to changes in the state of the call or speech.
|
|
121
138
|
|
|
122
|
-
|
|
123
139
|
## License
|
|
124
140
|
|
|
125
141
|
```
|