phonic 0.31.15 → 0.31.16
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 +394 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +9 -4
- package/dist/cjs/api/resources/agents/client/Client.d.ts +12 -0
- package/dist/cjs/api/resources/agents/client/Client.js +12 -0
- package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +6 -0
- package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +13 -0
- package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +4 -0
- package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +4 -0
- package/dist/cjs/api/resources/index.d.ts +2 -0
- package/dist/cjs/api/resources/index.js +3 -1
- package/dist/cjs/api/resources/tts/client/Client.d.ts +23 -0
- package/dist/cjs/api/resources/tts/client/Client.js +115 -0
- package/dist/cjs/api/resources/tts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/tts/client/index.js +17 -0
- package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.d.ts +28 -0
- package/dist/cjs/api/resources/tts/client/requests/StreamTtsRequest.js +14 -0
- package/dist/cjs/api/resources/tts/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/tts/client/requests/index.js +5 -0
- package/dist/cjs/api/resources/tts/exports.d.ts +2 -0
- package/dist/cjs/api/resources/tts/exports.js +21 -0
- package/dist/cjs/api/resources/tts/index.d.ts +1 -0
- package/dist/cjs/api/resources/tts/index.js +17 -0
- package/dist/cjs/api/types/Agent.d.ts +9 -0
- package/dist/cjs/api/types/ConfigOptions.d.ts +11 -5
- package/dist/cjs/api/types/Conversation.d.ts +9 -0
- package/dist/cjs/api/types/CreateAgentRequest.d.ts +9 -0
- package/dist/cjs/api/types/InlineWebSocketTool.d.ts +30 -0
- package/dist/cjs/api/types/InlineWebSocketTool.js +12 -0
- package/dist/cjs/api/types/OpenAiFunction.d.ts +10 -0
- package/dist/cjs/api/types/OpenAiFunction.js +3 -0
- package/dist/cjs/api/types/OpenAiFunctionParameters.d.ts +4 -0
- package/dist/cjs/api/types/OpenAiFunctionParameters.js +3 -0
- package/dist/cjs/api/types/OpenAiTool.d.ts +8 -0
- package/dist/cjs/api/types/OpenAiTool.js +3 -0
- package/dist/cjs/api/types/OutboundCallConfig.d.ts +9 -0
- package/dist/cjs/api/types/ToolDefinition.d.ts +2 -0
- package/dist/cjs/api/types/ToolDefinition.js +3 -0
- package/dist/cjs/api/types/ToolName.d.ts +4 -0
- package/dist/cjs/api/types/ToolName.js +3 -0
- package/dist/cjs/api/types/index.d.ts +6 -0
- package/dist/cjs/api/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- package/dist/esm/api/resources/agents/client/Client.d.mts +12 -0
- package/dist/esm/api/resources/agents/client/Client.mjs +12 -0
- package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +6 -0
- package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +13 -0
- package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +4 -0
- package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +4 -0
- package/dist/esm/api/resources/index.d.mts +2 -0
- package/dist/esm/api/resources/index.mjs +2 -0
- package/dist/esm/api/resources/tts/client/Client.d.mts +23 -0
- package/dist/esm/api/resources/tts/client/Client.mjs +78 -0
- package/dist/esm/api/resources/tts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/tts/client/index.mjs +1 -0
- package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.d.mts +28 -0
- package/dist/esm/api/resources/tts/client/requests/StreamTtsRequest.mjs +11 -0
- package/dist/esm/api/resources/tts/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/tts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/tts/exports.d.mts +2 -0
- package/dist/esm/api/resources/tts/exports.mjs +3 -0
- package/dist/esm/api/resources/tts/index.d.mts +1 -0
- package/dist/esm/api/resources/tts/index.mjs +1 -0
- package/dist/esm/api/types/Agent.d.mts +9 -0
- package/dist/esm/api/types/ConfigOptions.d.mts +11 -5
- package/dist/esm/api/types/Conversation.d.mts +9 -0
- package/dist/esm/api/types/CreateAgentRequest.d.mts +9 -0
- package/dist/esm/api/types/InlineWebSocketTool.d.mts +30 -0
- package/dist/esm/api/types/InlineWebSocketTool.mjs +9 -0
- package/dist/esm/api/types/OpenAiFunction.d.mts +10 -0
- package/dist/esm/api/types/OpenAiFunction.mjs +2 -0
- package/dist/esm/api/types/OpenAiFunctionParameters.d.mts +4 -0
- package/dist/esm/api/types/OpenAiFunctionParameters.mjs +2 -0
- package/dist/esm/api/types/OpenAiTool.d.mts +8 -0
- package/dist/esm/api/types/OpenAiTool.mjs +2 -0
- package/dist/esm/api/types/OutboundCallConfig.d.mts +9 -0
- package/dist/esm/api/types/ToolDefinition.d.mts +2 -0
- package/dist/esm/api/types/ToolDefinition.mjs +2 -0
- package/dist/esm/api/types/ToolName.d.mts +4 -0
- package/dist/esm/api/types/ToolName.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +6 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +19 -8
- package/reference.md +82 -0
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ The Phonic TypeScript library provides convenient access to the Phonic APIs from
|
|
|
12
12
|
- [Usage](#usage)
|
|
13
13
|
- [Request and Response Types](#request-and-response-types)
|
|
14
14
|
- [Exception Handling](#exception-handling)
|
|
15
|
+
- [Binary Response](#binary-response)
|
|
15
16
|
- [Advanced](#advanced)
|
|
16
17
|
- [Subpackage Exports](#subpackage-exports)
|
|
17
18
|
- [Additional Headers](#additional-headers)
|
|
@@ -72,6 +73,10 @@ await client.agents.create({
|
|
|
72
73
|
multilingual_mode: "request",
|
|
73
74
|
push_to_talk: false,
|
|
74
75
|
boosted_keywords: ["Load ID", "dispatch"],
|
|
76
|
+
pronunciation_dictionary: [{
|
|
77
|
+
word: "Phuket",
|
|
78
|
+
pronunciation: "Poo-ket"
|
|
79
|
+
}],
|
|
75
80
|
min_words_to_interrupt: 1,
|
|
76
81
|
configuration_endpoint: {
|
|
77
82
|
url: "https://api.example.com/config",
|
|
@@ -116,6 +121,395 @@ try {
|
|
|
116
121
|
}
|
|
117
122
|
```
|
|
118
123
|
|
|
124
|
+
## Binary Response
|
|
125
|
+
|
|
126
|
+
You can consume binary data from endpoints using the `BinaryResponse` type which lets you choose how to consume the data:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
const response = await client.tts.stream(...);
|
|
130
|
+
const stream: ReadableStream<Uint8Array> = response.stream();
|
|
131
|
+
// const arrayBuffer: ArrayBuffer = await response.arrayBuffer();
|
|
132
|
+
// const blob: Blob = response.blob();
|
|
133
|
+
// const bytes: Uint8Array = response.bytes();
|
|
134
|
+
// You can only use the response body once, so you must choose one of the above methods.
|
|
135
|
+
// If you want to check if the response body has been used, you can use the following property.
|
|
136
|
+
const bodyUsed = response.bodyUsed;
|
|
137
|
+
```
|
|
138
|
+
<details>
|
|
139
|
+
<summary>Save binary response to a file</summary>
|
|
140
|
+
|
|
141
|
+
<blockquote>
|
|
142
|
+
<details>
|
|
143
|
+
<summary>Node.js</summary>
|
|
144
|
+
|
|
145
|
+
<blockquote>
|
|
146
|
+
<details>
|
|
147
|
+
<summary>ReadableStream (most-efficient)</summary>
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
import { createWriteStream } from 'fs';
|
|
151
|
+
import { Readable } from 'stream';
|
|
152
|
+
import { pipeline } from 'stream/promises';
|
|
153
|
+
|
|
154
|
+
const response = await client.tts.stream(...);
|
|
155
|
+
|
|
156
|
+
const stream = response.stream();
|
|
157
|
+
const nodeStream = Readable.fromWeb(stream);
|
|
158
|
+
const writeStream = createWriteStream('path/to/file');
|
|
159
|
+
|
|
160
|
+
await pipeline(nodeStream, writeStream);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
</details>
|
|
164
|
+
</blockquote>
|
|
165
|
+
|
|
166
|
+
<blockquote>
|
|
167
|
+
<details>
|
|
168
|
+
<summary>ArrayBuffer</summary>
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import { writeFile } from 'fs/promises';
|
|
172
|
+
|
|
173
|
+
const response = await client.tts.stream(...);
|
|
174
|
+
|
|
175
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
176
|
+
await writeFile('path/to/file', Buffer.from(arrayBuffer));
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
</details>
|
|
180
|
+
</blockquote>
|
|
181
|
+
|
|
182
|
+
<blockquote>
|
|
183
|
+
<details>
|
|
184
|
+
<summary>Blob</summary>
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import { writeFile } from 'fs/promises';
|
|
188
|
+
|
|
189
|
+
const response = await client.tts.stream(...);
|
|
190
|
+
|
|
191
|
+
const blob = await response.blob();
|
|
192
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
193
|
+
await writeFile('output.bin', Buffer.from(arrayBuffer));
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
</details>
|
|
197
|
+
</blockquote>
|
|
198
|
+
|
|
199
|
+
<blockquote>
|
|
200
|
+
<details>
|
|
201
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import { writeFile } from 'fs/promises';
|
|
205
|
+
|
|
206
|
+
const response = await client.tts.stream(...);
|
|
207
|
+
|
|
208
|
+
const bytes = await response.bytes();
|
|
209
|
+
await writeFile('path/to/file', bytes);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
</details>
|
|
213
|
+
</blockquote>
|
|
214
|
+
|
|
215
|
+
</details>
|
|
216
|
+
</blockquote>
|
|
217
|
+
|
|
218
|
+
<blockquote>
|
|
219
|
+
<details>
|
|
220
|
+
<summary>Bun</summary>
|
|
221
|
+
|
|
222
|
+
<blockquote>
|
|
223
|
+
<details>
|
|
224
|
+
<summary>ReadableStream (most-efficient)</summary>
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
const response = await client.tts.stream(...);
|
|
228
|
+
|
|
229
|
+
const stream = response.stream();
|
|
230
|
+
await Bun.write('path/to/file', stream);
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
</details>
|
|
234
|
+
</blockquote>
|
|
235
|
+
|
|
236
|
+
<blockquote>
|
|
237
|
+
<details>
|
|
238
|
+
<summary>ArrayBuffer</summary>
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
const response = await client.tts.stream(...);
|
|
242
|
+
|
|
243
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
244
|
+
await Bun.write('path/to/file', arrayBuffer);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
</details>
|
|
248
|
+
</blockquote>
|
|
249
|
+
|
|
250
|
+
<blockquote>
|
|
251
|
+
<details>
|
|
252
|
+
<summary>Blob</summary>
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
const response = await client.tts.stream(...);
|
|
256
|
+
|
|
257
|
+
const blob = await response.blob();
|
|
258
|
+
await Bun.write('path/to/file', blob);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
</details>
|
|
262
|
+
</blockquote>
|
|
263
|
+
|
|
264
|
+
<blockquote>
|
|
265
|
+
<details>
|
|
266
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
const response = await client.tts.stream(...);
|
|
270
|
+
|
|
271
|
+
const bytes = await response.bytes();
|
|
272
|
+
await Bun.write('path/to/file', bytes);
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
</details>
|
|
276
|
+
</blockquote>
|
|
277
|
+
|
|
278
|
+
</details>
|
|
279
|
+
</blockquote>
|
|
280
|
+
|
|
281
|
+
<blockquote>
|
|
282
|
+
<details>
|
|
283
|
+
<summary>Deno</summary>
|
|
284
|
+
|
|
285
|
+
<blockquote>
|
|
286
|
+
<details>
|
|
287
|
+
<summary>ReadableStream (most-efficient)</summary>
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
const response = await client.tts.stream(...);
|
|
291
|
+
|
|
292
|
+
const stream = response.stream();
|
|
293
|
+
const file = await Deno.open('path/to/file', { write: true, create: true });
|
|
294
|
+
await stream.pipeTo(file.writable);
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
</details>
|
|
298
|
+
</blockquote>
|
|
299
|
+
|
|
300
|
+
<blockquote>
|
|
301
|
+
<details>
|
|
302
|
+
<summary>ArrayBuffer</summary>
|
|
303
|
+
|
|
304
|
+
```ts
|
|
305
|
+
const response = await client.tts.stream(...);
|
|
306
|
+
|
|
307
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
308
|
+
await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
</details>
|
|
312
|
+
</blockquote>
|
|
313
|
+
|
|
314
|
+
<blockquote>
|
|
315
|
+
<details>
|
|
316
|
+
<summary>Blob</summary>
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
const response = await client.tts.stream(...);
|
|
320
|
+
|
|
321
|
+
const blob = await response.blob();
|
|
322
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
323
|
+
await Deno.writeFile('path/to/file', new Uint8Array(arrayBuffer));
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
</details>
|
|
327
|
+
</blockquote>
|
|
328
|
+
|
|
329
|
+
<blockquote>
|
|
330
|
+
<details>
|
|
331
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
const response = await client.tts.stream(...);
|
|
335
|
+
|
|
336
|
+
const bytes = await response.bytes();
|
|
337
|
+
await Deno.writeFile('path/to/file', bytes);
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
</details>
|
|
341
|
+
</blockquote>
|
|
342
|
+
|
|
343
|
+
</details>
|
|
344
|
+
</blockquote>
|
|
345
|
+
|
|
346
|
+
<blockquote>
|
|
347
|
+
<details>
|
|
348
|
+
<summary>Browser</summary>
|
|
349
|
+
|
|
350
|
+
<blockquote>
|
|
351
|
+
<details>
|
|
352
|
+
<summary>Blob (most-efficient)</summary>
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
const response = await client.tts.stream(...);
|
|
356
|
+
|
|
357
|
+
const blob = await response.blob();
|
|
358
|
+
const url = URL.createObjectURL(blob);
|
|
359
|
+
|
|
360
|
+
// trigger download
|
|
361
|
+
const a = document.createElement('a');
|
|
362
|
+
a.href = url;
|
|
363
|
+
a.download = 'filename';
|
|
364
|
+
a.click();
|
|
365
|
+
URL.revokeObjectURL(url);
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
</details>
|
|
369
|
+
</blockquote>
|
|
370
|
+
|
|
371
|
+
<blockquote>
|
|
372
|
+
<details>
|
|
373
|
+
<summary>ReadableStream</summary>
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
const response = await client.tts.stream(...);
|
|
377
|
+
|
|
378
|
+
const stream = response.stream();
|
|
379
|
+
const reader = stream.getReader();
|
|
380
|
+
const chunks = [];
|
|
381
|
+
|
|
382
|
+
while (true) {
|
|
383
|
+
const { done, value } = await reader.read();
|
|
384
|
+
if (done) break;
|
|
385
|
+
chunks.push(value);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const blob = new Blob(chunks);
|
|
389
|
+
const url = URL.createObjectURL(blob);
|
|
390
|
+
|
|
391
|
+
// trigger download
|
|
392
|
+
const a = document.createElement('a');
|
|
393
|
+
a.href = url;
|
|
394
|
+
a.download = 'filename';
|
|
395
|
+
a.click();
|
|
396
|
+
URL.revokeObjectURL(url);
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
</details>
|
|
400
|
+
</blockquote>
|
|
401
|
+
|
|
402
|
+
<blockquote>
|
|
403
|
+
<details>
|
|
404
|
+
<summary>ArrayBuffer</summary>
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
const response = await client.tts.stream(...);
|
|
408
|
+
|
|
409
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
410
|
+
const blob = new Blob([arrayBuffer]);
|
|
411
|
+
const url = URL.createObjectURL(blob);
|
|
412
|
+
|
|
413
|
+
// trigger download
|
|
414
|
+
const a = document.createElement('a');
|
|
415
|
+
a.href = url;
|
|
416
|
+
a.download = 'filename';
|
|
417
|
+
a.click();
|
|
418
|
+
URL.revokeObjectURL(url);
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
</details>
|
|
422
|
+
</blockquote>
|
|
423
|
+
|
|
424
|
+
<blockquote>
|
|
425
|
+
<details>
|
|
426
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
427
|
+
|
|
428
|
+
```ts
|
|
429
|
+
const response = await client.tts.stream(...);
|
|
430
|
+
|
|
431
|
+
const bytes = await response.bytes();
|
|
432
|
+
const blob = new Blob([bytes]);
|
|
433
|
+
const url = URL.createObjectURL(blob);
|
|
434
|
+
|
|
435
|
+
// trigger download
|
|
436
|
+
const a = document.createElement('a');
|
|
437
|
+
a.href = url;
|
|
438
|
+
a.download = 'filename';
|
|
439
|
+
a.click();
|
|
440
|
+
URL.revokeObjectURL(url);
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
</details>
|
|
444
|
+
</blockquote>
|
|
445
|
+
|
|
446
|
+
</details>
|
|
447
|
+
</blockquote>
|
|
448
|
+
|
|
449
|
+
</details>
|
|
450
|
+
</blockquote>
|
|
451
|
+
|
|
452
|
+
<details>
|
|
453
|
+
<summary>Convert binary response to text</summary>
|
|
454
|
+
|
|
455
|
+
<blockquote>
|
|
456
|
+
<details>
|
|
457
|
+
<summary>ReadableStream</summary>
|
|
458
|
+
|
|
459
|
+
```ts
|
|
460
|
+
const response = await client.tts.stream(...);
|
|
461
|
+
|
|
462
|
+
const stream = response.stream();
|
|
463
|
+
const text = await new Response(stream).text();
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
</details>
|
|
467
|
+
</blockquote>
|
|
468
|
+
|
|
469
|
+
<blockquote>
|
|
470
|
+
<details>
|
|
471
|
+
<summary>ArrayBuffer</summary>
|
|
472
|
+
|
|
473
|
+
```ts
|
|
474
|
+
const response = await client.tts.stream(...);
|
|
475
|
+
|
|
476
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
477
|
+
const text = new TextDecoder().decode(arrayBuffer);
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
</details>
|
|
481
|
+
</blockquote>
|
|
482
|
+
|
|
483
|
+
<blockquote>
|
|
484
|
+
<details>
|
|
485
|
+
<summary>Blob</summary>
|
|
486
|
+
|
|
487
|
+
```ts
|
|
488
|
+
const response = await client.tts.stream(...);
|
|
489
|
+
|
|
490
|
+
const blob = await response.blob();
|
|
491
|
+
const text = await blob.text();
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
</details>
|
|
495
|
+
</blockquote>
|
|
496
|
+
|
|
497
|
+
<blockquote>
|
|
498
|
+
<details>
|
|
499
|
+
<summary>Bytes (UIntArray8)</summary>
|
|
500
|
+
|
|
501
|
+
```ts
|
|
502
|
+
const response = await client.tts.stream(...);
|
|
503
|
+
|
|
504
|
+
const bytes = await response.bytes();
|
|
505
|
+
const text = new TextDecoder().decode(bytes);
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
</details>
|
|
509
|
+
</blockquote>
|
|
510
|
+
|
|
511
|
+
</details>
|
|
512
|
+
|
|
119
513
|
## Advanced
|
|
120
514
|
|
|
121
515
|
### Subpackage Exports
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "phonic",
|
|
46
|
-
"X-Fern-SDK-Version": "0.31.
|
|
47
|
-
"User-Agent": "phonic/0.31.
|
|
46
|
+
"X-Fern-SDK-Version": "0.31.16",
|
|
47
|
+
"User-Agent": "phonic/0.31.16",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
package/dist/cjs/Client.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ConversationsClient } from "./api/resources/conversations/client/Client
|
|
|
5
5
|
import { ExtractionSchemasClient } from "./api/resources/extractionSchemas/client/Client.js";
|
|
6
6
|
import { ProjectsClient } from "./api/resources/projects/client/Client.js";
|
|
7
7
|
import { ToolsClient } from "./api/resources/tools/client/Client.js";
|
|
8
|
+
import { TtsClient } from "./api/resources/tts/client/Client.js";
|
|
8
9
|
import { VoicesClient } from "./api/resources/voices/client/Client.js";
|
|
9
10
|
import { WorkspaceClient } from "./api/resources/workspace/client/Client.js";
|
|
10
11
|
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
@@ -28,6 +29,7 @@ export declare class PhonicClient {
|
|
|
28
29
|
protected _agents: AgentsClient | undefined;
|
|
29
30
|
protected _tools: ToolsClient | undefined;
|
|
30
31
|
protected _extractionSchemas: ExtractionSchemasClient | undefined;
|
|
32
|
+
protected _tts: TtsClient | undefined;
|
|
31
33
|
protected _voices: VoicesClient | undefined;
|
|
32
34
|
protected _conversations: ConversationsClient | undefined;
|
|
33
35
|
protected _conversationItems: ConversationItemsClient | undefined;
|
|
@@ -38,6 +40,7 @@ export declare class PhonicClient {
|
|
|
38
40
|
get agents(): AgentsClient;
|
|
39
41
|
get tools(): ToolsClient;
|
|
40
42
|
get extractionSchemas(): ExtractionSchemasClient;
|
|
43
|
+
get tts(): TtsClient;
|
|
41
44
|
get voices(): VoicesClient;
|
|
42
45
|
get conversations(): ConversationsClient;
|
|
43
46
|
get conversationItems(): ConversationItemsClient;
|
package/dist/cjs/Client.js
CHANGED
|
@@ -51,8 +51,9 @@ const Client_js_4 = require("./api/resources/conversations/client/Client.js");
|
|
|
51
51
|
const Client_js_5 = require("./api/resources/extractionSchemas/client/Client.js");
|
|
52
52
|
const Client_js_6 = require("./api/resources/projects/client/Client.js");
|
|
53
53
|
const Client_js_7 = require("./api/resources/tools/client/Client.js");
|
|
54
|
-
const Client_js_8 = require("./api/resources/
|
|
55
|
-
const Client_js_9 = require("./api/resources/
|
|
54
|
+
const Client_js_8 = require("./api/resources/tts/client/Client.js");
|
|
55
|
+
const Client_js_9 = require("./api/resources/voices/client/Client.js");
|
|
56
|
+
const Client_js_10 = require("./api/resources/workspace/client/Client.js");
|
|
56
57
|
const BaseClient_js_1 = require("./BaseClient.js");
|
|
57
58
|
const core = __importStar(require("./core/index.js"));
|
|
58
59
|
const environments = __importStar(require("./environments.js"));
|
|
@@ -72,9 +73,13 @@ class PhonicClient {
|
|
|
72
73
|
var _a;
|
|
73
74
|
return ((_a = this._extractionSchemas) !== null && _a !== void 0 ? _a : (this._extractionSchemas = new Client_js_5.ExtractionSchemasClient(this._options)));
|
|
74
75
|
}
|
|
76
|
+
get tts() {
|
|
77
|
+
var _a;
|
|
78
|
+
return ((_a = this._tts) !== null && _a !== void 0 ? _a : (this._tts = new Client_js_8.TtsClient(this._options)));
|
|
79
|
+
}
|
|
75
80
|
get voices() {
|
|
76
81
|
var _a;
|
|
77
|
-
return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new
|
|
82
|
+
return ((_a = this._voices) !== null && _a !== void 0 ? _a : (this._voices = new Client_js_9.VoicesClient(this._options)));
|
|
78
83
|
}
|
|
79
84
|
get conversations() {
|
|
80
85
|
var _a;
|
|
@@ -94,7 +99,7 @@ class PhonicClient {
|
|
|
94
99
|
}
|
|
95
100
|
get workspace() {
|
|
96
101
|
var _a;
|
|
97
|
-
return ((_a = this._workspace) !== null && _a !== void 0 ? _a : (this._workspace = new
|
|
102
|
+
return ((_a = this._workspace) !== null && _a !== void 0 ? _a : (this._workspace = new Client_js_10.WorkspaceClient(this._options)));
|
|
98
103
|
}
|
|
99
104
|
/**
|
|
100
105
|
* Make a passthrough request using the SDK's configured auth, retry, logging, etc.
|
|
@@ -64,6 +64,10 @@ export declare class AgentsClient {
|
|
|
64
64
|
* multilingual_mode: "request",
|
|
65
65
|
* push_to_talk: false,
|
|
66
66
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
67
|
+
* pronunciation_dictionary: [{
|
|
68
|
+
* word: "Phuket",
|
|
69
|
+
* pronunciation: "Poo-ket"
|
|
70
|
+
* }],
|
|
67
71
|
* min_words_to_interrupt: 1,
|
|
68
72
|
* configuration_endpoint: {
|
|
69
73
|
* url: "https://api.example.com/config",
|
|
@@ -114,6 +118,10 @@ export declare class AgentsClient {
|
|
|
114
118
|
* multilingual_mode: "request",
|
|
115
119
|
* push_to_talk: false,
|
|
116
120
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
121
|
+
* pronunciation_dictionary: [{
|
|
122
|
+
* word: "Phuket",
|
|
123
|
+
* pronunciation: "Poo-ket"
|
|
124
|
+
* }],
|
|
117
125
|
* min_words_to_interrupt: 1,
|
|
118
126
|
* configuration_endpoint: {
|
|
119
127
|
* url: "https://api.example.com/config",
|
|
@@ -200,6 +208,10 @@ export declare class AgentsClient {
|
|
|
200
208
|
* multilingual_mode: "request",
|
|
201
209
|
* push_to_talk: false,
|
|
202
210
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
211
|
+
* pronunciation_dictionary: [{
|
|
212
|
+
* word: "Phuket",
|
|
213
|
+
* pronunciation: "Poo-ket"
|
|
214
|
+
* }],
|
|
203
215
|
* min_words_to_interrupt: 1,
|
|
204
216
|
* configuration_endpoint: {
|
|
205
217
|
* url: "https://api.example.com/config",
|
|
@@ -162,6 +162,10 @@ class AgentsClient {
|
|
|
162
162
|
* multilingual_mode: "request",
|
|
163
163
|
* push_to_talk: false,
|
|
164
164
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
165
|
+
* pronunciation_dictionary: [{
|
|
166
|
+
* word: "Phuket",
|
|
167
|
+
* pronunciation: "Poo-ket"
|
|
168
|
+
* }],
|
|
165
169
|
* min_words_to_interrupt: 1,
|
|
166
170
|
* configuration_endpoint: {
|
|
167
171
|
* url: "https://api.example.com/config",
|
|
@@ -261,6 +265,10 @@ class AgentsClient {
|
|
|
261
265
|
* multilingual_mode: "request",
|
|
262
266
|
* push_to_talk: false,
|
|
263
267
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
268
|
+
* pronunciation_dictionary: [{
|
|
269
|
+
* word: "Phuket",
|
|
270
|
+
* pronunciation: "Poo-ket"
|
|
271
|
+
* }],
|
|
264
272
|
* min_words_to_interrupt: 1,
|
|
265
273
|
* configuration_endpoint: {
|
|
266
274
|
* url: "https://api.example.com/config",
|
|
@@ -476,6 +484,10 @@ class AgentsClient {
|
|
|
476
484
|
* multilingual_mode: "request",
|
|
477
485
|
* push_to_talk: false,
|
|
478
486
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
487
|
+
* pronunciation_dictionary: [{
|
|
488
|
+
* word: "Phuket",
|
|
489
|
+
* pronunciation: "Poo-ket"
|
|
490
|
+
* }],
|
|
479
491
|
* min_words_to_interrupt: 1,
|
|
480
492
|
* configuration_endpoint: {
|
|
481
493
|
* url: "https://api.example.com/config",
|
|
@@ -29,6 +29,10 @@ import type * as Phonic from "../../../../index.js";
|
|
|
29
29
|
* multilingual_mode: "request",
|
|
30
30
|
* push_to_talk: false,
|
|
31
31
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
32
|
+
* pronunciation_dictionary: [{
|
|
33
|
+
* word: "Phuket",
|
|
34
|
+
* pronunciation: "Poo-ket"
|
|
35
|
+
* }],
|
|
32
36
|
* min_words_to_interrupt: 1,
|
|
33
37
|
* configuration_endpoint: {
|
|
34
38
|
* url: "https://api.example.com/config",
|
|
@@ -94,6 +98,8 @@ export interface AgentsCreateRequest {
|
|
|
94
98
|
push_to_talk?: boolean;
|
|
95
99
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
96
100
|
boosted_keywords?: string[];
|
|
101
|
+
/** Array of `{ word, pronunciation }` entries. Words must be unique. */
|
|
102
|
+
pronunciation_dictionary?: Phonic.CreateAgentRequest.PronunciationDictionary.Item[];
|
|
97
103
|
/** Minimum number of words required to interrupt the assistant. */
|
|
98
104
|
min_words_to_interrupt?: number;
|
|
99
105
|
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
@@ -29,6 +29,10 @@ import type * as Phonic from "../../../../index.js";
|
|
|
29
29
|
* multilingual_mode: "request",
|
|
30
30
|
* push_to_talk: false,
|
|
31
31
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
32
|
+
* pronunciation_dictionary: [{
|
|
33
|
+
* word: "Phuket",
|
|
34
|
+
* pronunciation: "Poo-ket"
|
|
35
|
+
* }],
|
|
32
36
|
* min_words_to_interrupt: 1,
|
|
33
37
|
* configuration_endpoint: {
|
|
34
38
|
* url: "https://api.example.com/config",
|
|
@@ -94,6 +98,8 @@ export interface UpdateAgentRequest {
|
|
|
94
98
|
push_to_talk?: boolean;
|
|
95
99
|
/** These words, or short phrases, will be more accurately recognized by the agent. */
|
|
96
100
|
boosted_keywords?: string[];
|
|
101
|
+
/** Array of `{ word, pronunciation }` entries. Words must be unique. */
|
|
102
|
+
pronunciation_dictionary?: UpdateAgentRequest.PronunciationDictionary.Item[];
|
|
97
103
|
/** Minimum number of words required to interrupt the assistant. */
|
|
98
104
|
min_words_to_interrupt?: number;
|
|
99
105
|
/** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
|
|
@@ -151,6 +157,13 @@ export declare namespace UpdateAgentRequest {
|
|
|
151
157
|
readonly Request: "request";
|
|
152
158
|
};
|
|
153
159
|
type MultilingualMode = (typeof MultilingualMode)[keyof typeof MultilingualMode];
|
|
160
|
+
type PronunciationDictionary = PronunciationDictionary.Item[];
|
|
161
|
+
namespace PronunciationDictionary {
|
|
162
|
+
interface Item {
|
|
163
|
+
word: string;
|
|
164
|
+
pronunciation: string;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
154
167
|
/**
|
|
155
168
|
* When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options.
|
|
156
169
|
*/
|
|
@@ -29,6 +29,10 @@ import type * as Phonic from "../../../../index.js";
|
|
|
29
29
|
* multilingual_mode: "request",
|
|
30
30
|
* push_to_talk: false,
|
|
31
31
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
32
|
+
* pronunciation_dictionary: [{
|
|
33
|
+
* word: "Phuket",
|
|
34
|
+
* pronunciation: "Poo-ket"
|
|
35
|
+
* }],
|
|
32
36
|
* min_words_to_interrupt: 1,
|
|
33
37
|
* configuration_endpoint: {
|
|
34
38
|
* url: "https://api.example.com/config",
|
|
@@ -21,6 +21,10 @@ import type * as Phonic from "../../../../index.js";
|
|
|
21
21
|
* multilingual_mode: "request",
|
|
22
22
|
* push_to_talk: false,
|
|
23
23
|
* boosted_keywords: ["Load ID", "dispatch"],
|
|
24
|
+
* pronunciation_dictionary: [{
|
|
25
|
+
* word: "Phuket",
|
|
26
|
+
* pronunciation: "Poo-ket"
|
|
27
|
+
* }],
|
|
24
28
|
* min_words_to_interrupt: 1,
|
|
25
29
|
* tools: ["keypad_input"]
|
|
26
30
|
* },
|
|
@@ -18,6 +18,8 @@ export * from "./projects/types/index.js";
|
|
|
18
18
|
export * from "./tools/client/requests/index.js";
|
|
19
19
|
export * as tools from "./tools/index.js";
|
|
20
20
|
export * from "./tools/types/index.js";
|
|
21
|
+
export * from "./tts/client/requests/index.js";
|
|
22
|
+
export * as tts from "./tts/index.js";
|
|
21
23
|
export * from "./voices/client/requests/index.js";
|
|
22
24
|
export * as voices from "./voices/index.js";
|
|
23
25
|
export * from "./voices/types/index.js";
|
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.workspace = exports.voices = exports.tools = exports.projects = exports.extractionSchemas = exports.conversations = exports.conversationItems = exports.auth = exports.agents = void 0;
|
|
39
|
+
exports.workspace = exports.voices = exports.tts = exports.tools = exports.projects = exports.extractionSchemas = exports.conversations = exports.conversationItems = exports.auth = exports.agents = void 0;
|
|
40
40
|
__exportStar(require("./agents/client/requests/index.js"), exports);
|
|
41
41
|
exports.agents = __importStar(require("./agents/index.js"));
|
|
42
42
|
__exportStar(require("./agents/types/index.js"), exports);
|
|
@@ -57,6 +57,8 @@ __exportStar(require("./projects/types/index.js"), exports);
|
|
|
57
57
|
__exportStar(require("./tools/client/requests/index.js"), exports);
|
|
58
58
|
exports.tools = __importStar(require("./tools/index.js"));
|
|
59
59
|
__exportStar(require("./tools/types/index.js"), exports);
|
|
60
|
+
__exportStar(require("./tts/client/requests/index.js"), exports);
|
|
61
|
+
exports.tts = __importStar(require("./tts/index.js"));
|
|
60
62
|
__exportStar(require("./voices/client/requests/index.js"), exports);
|
|
61
63
|
exports.voices = __importStar(require("./voices/index.js"));
|
|
62
64
|
__exportStar(require("./voices/types/index.js"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../core/index.js";
|
|
4
|
+
import * as Phonic from "../../../index.js";
|
|
5
|
+
export declare namespace TtsClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class TtsClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<TtsClient.Options>;
|
|
12
|
+
constructor(options?: TtsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Streams generated speech audio for the provided text.
|
|
15
|
+
*
|
|
16
|
+
* @throws {@link Phonic.BadRequestError}
|
|
17
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
18
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
19
|
+
* @throws {@link Phonic.InternalServerError}
|
|
20
|
+
*/
|
|
21
|
+
stream(request: Phonic.StreamTtsRequest, requestOptions?: TtsClient.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
|
|
22
|
+
private __stream;
|
|
23
|
+
}
|