@voice-ai-labs/web-sdk 0.9.0 → 0.9.1
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 +62 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,30 +54,13 @@ await voiceai.connect({
|
|
|
54
54
|
|
|
55
55
|
// Test mode: preview paused agents before deploying
|
|
56
56
|
await voiceai.connect({ agentId: 'agent-123', testMode: true });
|
|
57
|
-
|
|
58
|
-
// Apply safe per-call overrides to a saved agent
|
|
59
|
-
await voiceai.connect({
|
|
60
|
-
agentId: 'agent-123',
|
|
61
|
-
agentOverrides: {
|
|
62
|
-
prompt: 'You are helping with premium support only.',
|
|
63
|
-
greeting: 'Thanks for calling premium support.',
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
57
|
```
|
|
67
58
|
|
|
68
59
|
`connect()` supports these top-level request shapes:
|
|
69
60
|
|
|
70
61
|
- `agentId` for a saved agent
|
|
71
|
-
- `agentConfig` for an inline agent configuration
|
|
72
|
-
- `agentOverrides` for safe per-call overrides on a saved agent
|
|
73
62
|
- `dynamicVariables` for optional runtime variables passed at call start
|
|
74
|
-
|
|
75
|
-
These connection shapes are mutually exclusive where noted:
|
|
76
|
-
|
|
77
|
-
- Use `agentId` with optional `agentOverrides` and `dynamicVariables` for a saved agent
|
|
78
|
-
- Use `agentConfig` with optional `dynamicVariables` for an inline agent configuration
|
|
79
|
-
- Do not combine `agentId` with `agentConfig`
|
|
80
|
-
- Do not combine `agentConfig` with `agentOverrides`
|
|
63
|
+
- `testMode` to preview paused agents before deploying
|
|
81
64
|
|
|
82
65
|
### Events
|
|
83
66
|
|
|
@@ -166,6 +149,18 @@ const reader = response.body!.getReader();
|
|
|
166
149
|
// Read chunks: reader.read()
|
|
167
150
|
```
|
|
168
151
|
|
|
152
|
+
Managed pronunciation dictionaries can be attached to direct TTS requests and saved agent configs with:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
const audio = await voiceai.tts.synthesize({
|
|
156
|
+
text: 'Schedule a follow-up for Thailand.',
|
|
157
|
+
voice_id: 'voice-123',
|
|
158
|
+
language: 'en',
|
|
159
|
+
dictionary_id: 'dict-123',
|
|
160
|
+
dictionary_version: 2,
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
169
164
|
### Voice Management
|
|
170
165
|
|
|
171
166
|
```typescript
|
|
@@ -190,6 +185,55 @@ await voiceai.tts.updateVoice('voice-123', { name: 'Renamed', voice_visibility:
|
|
|
190
185
|
await voiceai.tts.deleteVoice('voice-123');
|
|
191
186
|
```
|
|
192
187
|
|
|
188
|
+
### Pronunciation Dictionaries
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
// List dictionaries
|
|
192
|
+
const dictionaries = await voiceai.tts.listPronunciationDictionaries();
|
|
193
|
+
|
|
194
|
+
// Get one dictionary
|
|
195
|
+
const dictionary = await voiceai.tts.getPronunciationDictionary('dict-123');
|
|
196
|
+
|
|
197
|
+
// Create from rules
|
|
198
|
+
const created = await voiceai.tts.createPronunciationDictionaryFromRules({
|
|
199
|
+
name: 'Medical Terms',
|
|
200
|
+
language: 'en',
|
|
201
|
+
rules: [
|
|
202
|
+
{ word: 'Thailand', replacement: 'tie-land' },
|
|
203
|
+
{ word: 'router', replacement: 'row-ter', ipa: 'ˈraʊtɚ', case_sensitive: false },
|
|
204
|
+
],
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// Create from a .pls file
|
|
208
|
+
await voiceai.tts.createPronunciationDictionaryFromFile({
|
|
209
|
+
file: dictionaryFile,
|
|
210
|
+
name: 'Imported Dictionary',
|
|
211
|
+
language: 'en',
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Rename
|
|
215
|
+
await voiceai.tts.updatePronunciationDictionary('dict-123', { name: 'Medical Terms v2' });
|
|
216
|
+
|
|
217
|
+
// Replace all rules
|
|
218
|
+
await voiceai.tts.setPronunciationDictionaryRules('dict-123', [
|
|
219
|
+
{ word: 'SQL', replacement: 'sequel', case_sensitive: false },
|
|
220
|
+
]);
|
|
221
|
+
|
|
222
|
+
// Add rules
|
|
223
|
+
await voiceai.tts.addPronunciationDictionaryRules('dict-123', [
|
|
224
|
+
{ word: 'gif', replacement: 'jif', case_sensitive: false },
|
|
225
|
+
]);
|
|
226
|
+
|
|
227
|
+
// Remove rules by stable rule ID
|
|
228
|
+
await voiceai.tts.removePronunciationDictionaryRules('dict-123', ['rule-1', 'rule-2']);
|
|
229
|
+
|
|
230
|
+
// Download a specific version as a Blob
|
|
231
|
+
const plsBlob = await voiceai.tts.downloadPronunciationDictionaryVersion('dict-123', 3);
|
|
232
|
+
|
|
233
|
+
// Delete
|
|
234
|
+
await voiceai.tts.deletePronunciationDictionary('dict-123');
|
|
235
|
+
```
|
|
236
|
+
|
|
193
237
|
## Agent Management
|
|
194
238
|
|
|
195
239
|
```typescript
|
|
@@ -539,7 +583,6 @@ Your endpoint should respond with:
|
|
|
539
583
|
```typescript
|
|
540
584
|
interface InboundCallWebhookResponse {
|
|
541
585
|
dynamic_variables?: Record<string, string | number | boolean>;
|
|
542
|
-
agent_overrides?: Record<string, unknown>;
|
|
543
586
|
}
|
|
544
587
|
```
|
|
545
588
|
|