@deepgram/sdk 4.2.0 → 4.4.0
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 +180 -39
- package/dist/main/lib/types/AgentLiveSchema.d.ts +9 -51
- package/dist/main/lib/types/AgentLiveSchema.d.ts.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/packages/AgentLiveClient.d.ts.map +1 -1
- package/dist/main/packages/AgentLiveClient.js +0 -6
- package/dist/main/packages/AgentLiveClient.js.map +1 -1
- package/dist/module/lib/types/AgentLiveSchema.d.ts +9 -51
- package/dist/module/lib/types/AgentLiveSchema.d.ts.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/packages/AgentLiveClient.d.ts.map +1 -1
- package/dist/module/packages/AgentLiveClient.js +0 -6
- package/dist/module/packages/AgentLiveClient.js.map +1 -1
- package/dist/umd/deepgram.js +1 -1
- package/package.json +1 -1
- package/src/lib/types/AgentLiveSchema.ts +7 -150
- package/src/lib/version.ts +1 -1
- package/src/packages/AgentLiveClient.ts +0 -7
package/README.md
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your apps with world-class speech and Language AI models.
|
|
6
6
|
|
|
7
|
+
- [Documentation](#documentation)
|
|
7
8
|
- [Migrating from earlier versions](#migrating-from-earlier-versions)
|
|
8
9
|
- [V2 to V3](#v2-to-v3)
|
|
9
10
|
- [V3.\* to V3.4](#v3-to-v34)
|
|
11
|
+
- [V3.\* to V4](#v3-to-v4)
|
|
10
12
|
- [Installation](#installation)
|
|
11
13
|
- [UMD](#umd)
|
|
12
14
|
- [ESM](#esm)
|
|
@@ -23,17 +25,19 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
23
25
|
- [Override fetch transmitter](#override-fetch-transmitter)
|
|
24
26
|
- [Proxy requests in the browser](#proxy-requests-in-the-browser)
|
|
25
27
|
- [Set custom headers for fetch](#set-custom-headers-for-fetch)
|
|
26
|
-
- [
|
|
28
|
+
- [Pre-Recorded (Synchronous)](#pre-recorded-synchronous)
|
|
27
29
|
- [Remote Files](#remote-files)
|
|
28
30
|
- [Local Files](#local-files)
|
|
29
|
-
- [
|
|
31
|
+
- [Browser](#browser)
|
|
32
|
+
- [Pre-Recorded (Asynchronous / Callbacks)](#pre-recorded-asynchronous--callbacks)
|
|
30
33
|
- [Remote Files](#remote-files-1)
|
|
31
34
|
- [Local Files](#local-files-1)
|
|
32
|
-
- [
|
|
33
|
-
|
|
35
|
+
- [Browser](#browser-1)
|
|
36
|
+
- [Streaming Audio](#streaming-audio)
|
|
34
37
|
- [Transcribing to captions](#transcribing-to-captions)
|
|
35
38
|
- [Voice Agent](#voice-agent)
|
|
36
|
-
- [Text to Speech](#text-to-speech)
|
|
39
|
+
- [Text to Speech Rest](#text-to-speech-rest)
|
|
40
|
+
- [Text to Speech Streaming](#text-to-speech-streaming)
|
|
37
41
|
- [Text Intelligence](#text-intelligence)
|
|
38
42
|
- [Authentication](#authentication)
|
|
39
43
|
- [Get Token Details](#get-token-details)
|
|
@@ -67,7 +71,7 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
67
71
|
- [Get All Balances](#get-all-balances)
|
|
68
72
|
- [Get Balance](#get-balance)
|
|
69
73
|
- [Models](#models)
|
|
70
|
-
- [Get All Models](#get-all-models)
|
|
74
|
+
- [Get All Project Models](#get-all-project-models)
|
|
71
75
|
- [Get Model](#get-model)
|
|
72
76
|
- [On-Prem APIs](#on-prem-apis)
|
|
73
77
|
- [List On-Prem credentials](#list-on-prem-credentials)
|
|
@@ -79,6 +83,10 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
79
83
|
- [Debugging and making changes locally](#debugging-and-making-changes-locally)
|
|
80
84
|
- [Getting Help](#getting-help)
|
|
81
85
|
|
|
86
|
+
## Documentation
|
|
87
|
+
|
|
88
|
+
You can learn more about the Deepgram API at [developers.deepgram.com](https://developers.deepgram.com/docs).
|
|
89
|
+
|
|
82
90
|
## Migrating from earlier versions
|
|
83
91
|
|
|
84
92
|
### V2 to V3
|
|
@@ -89,7 +97,9 @@ We have published [a migration guide on our docs](https://developers.deepgram.co
|
|
|
89
97
|
|
|
90
98
|
We recommend using only documented interfaces, as we strictly follow semantic versioning (semver) and breaking changes may occur for undocumented interfaces. To ensure compatibility, consider pinning your versions if you need to use undocumented interfaces.
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
### V3.\* to V4
|
|
101
|
+
|
|
102
|
+
The Voice Agent interfaces have been updated to use the new Voice Agent V1 API. Please refer to our [Documentation](https://developers.deepgram.com/docs/voice-agent-v1-migration) on Migration to new V1 Agent API.
|
|
93
103
|
|
|
94
104
|
## Installation
|
|
95
105
|
|
|
@@ -143,6 +153,8 @@ You can now use type="module" `<script>`s to import deepgram from CDNs, like:
|
|
|
143
153
|
|
|
144
154
|
## Initialization
|
|
145
155
|
|
|
156
|
+
All of the examples below will require createClient.
|
|
157
|
+
|
|
146
158
|
```js
|
|
147
159
|
import { createClient } from "@deepgram/sdk";
|
|
148
160
|
// - or -
|
|
@@ -270,10 +282,12 @@ const deepgram = createClient("proxy", {
|
|
|
270
282
|
});
|
|
271
283
|
```
|
|
272
284
|
|
|
273
|
-
##
|
|
285
|
+
## Pre-Recorded (Synchronous)
|
|
274
286
|
|
|
275
287
|
### Remote Files
|
|
276
288
|
|
|
289
|
+
Transcribe audio from a URL.
|
|
290
|
+
|
|
277
291
|
```js
|
|
278
292
|
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
|
|
279
293
|
{
|
|
@@ -285,10 +299,12 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
|
|
|
285
299
|
);
|
|
286
300
|
```
|
|
287
301
|
|
|
288
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/
|
|
302
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
289
303
|
|
|
290
304
|
### Local Files
|
|
291
305
|
|
|
306
|
+
Transcribe audio from a file.
|
|
307
|
+
|
|
292
308
|
```js
|
|
293
309
|
const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
|
|
294
310
|
fs.createReadStream("./examples/spacewalk.wav"),
|
|
@@ -309,12 +325,33 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
|
|
|
309
325
|
);
|
|
310
326
|
```
|
|
311
327
|
|
|
312
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/
|
|
328
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
329
|
+
|
|
330
|
+
### Browser
|
|
313
331
|
|
|
314
|
-
|
|
332
|
+
Transcribe audio from a file in the browser.
|
|
333
|
+
|
|
334
|
+
```js
|
|
335
|
+
const transcribeFile = async () => {
|
|
336
|
+
const { result, error } = await _deepgram.listen.prerecorded.transcribeFile(
|
|
337
|
+
fs.readFileSync("./examples/nasa.mp4"),
|
|
338
|
+
{
|
|
339
|
+
model: "nova",
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
};
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
346
|
+
|
|
347
|
+
[See our Example for more info](./examples/browser-prerecorded/index.html).
|
|
348
|
+
|
|
349
|
+
## Pre-Recorded (Asynchronous / Callbacks)
|
|
315
350
|
|
|
316
351
|
### Remote Files
|
|
317
352
|
|
|
353
|
+
Transcribe audio from a URL.
|
|
354
|
+
|
|
318
355
|
```js
|
|
319
356
|
import { CallbackUrl } from "@deepgram/sdk";
|
|
320
357
|
|
|
@@ -329,10 +366,14 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeUrlCallbac
|
|
|
329
366
|
);
|
|
330
367
|
```
|
|
331
368
|
|
|
332
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/
|
|
369
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
370
|
+
|
|
371
|
+
[See our Example for more info](./examples/node-prerecorded/index.js).
|
|
333
372
|
|
|
334
373
|
### Local Files
|
|
335
374
|
|
|
375
|
+
Transcribe audio from a file.
|
|
376
|
+
|
|
336
377
|
```js
|
|
337
378
|
import { CallbackUrl } from "@deepgram/sdk";
|
|
338
379
|
|
|
@@ -359,11 +400,34 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeFileCallba
|
|
|
359
400
|
);
|
|
360
401
|
```
|
|
361
402
|
|
|
362
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/
|
|
403
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
363
404
|
|
|
364
|
-
|
|
405
|
+
### Browser
|
|
365
406
|
|
|
366
|
-
|
|
407
|
+
Transcribe audio from a URL in the browser.
|
|
408
|
+
|
|
409
|
+
```js
|
|
410
|
+
// browser code
|
|
411
|
+
const transcribeUrl = async () => {
|
|
412
|
+
const { result, error } = await _deepgram.listen.prerecorded.transcribeUrl(
|
|
413
|
+
{
|
|
414
|
+
url: "https://dpgr.am/spacewalk.wav",
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
model: "nova",
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
};
|
|
421
|
+
// browser code
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen).
|
|
425
|
+
|
|
426
|
+
[See our Example for more info](./examples/browser-prerecorded/index.html).
|
|
427
|
+
|
|
428
|
+
## Streaming Audio
|
|
429
|
+
|
|
430
|
+
Transcribe streaming audio.
|
|
367
431
|
|
|
368
432
|
```js
|
|
369
433
|
const dgConnection = deepgram.listen.live({ model: "nova" });
|
|
@@ -379,12 +443,38 @@ dgConnection.on(LiveTranscriptionEvents.Open, () => {
|
|
|
379
443
|
});
|
|
380
444
|
```
|
|
381
445
|
|
|
382
|
-
|
|
446
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen-streaming).
|
|
447
|
+
|
|
448
|
+
[See our Example for more info](https://github.com/deepgram-devs/node-live-example).
|
|
449
|
+
|
|
450
|
+
### Browser
|
|
451
|
+
|
|
452
|
+
Transcribe streaming audio in the browser.
|
|
453
|
+
|
|
454
|
+
```js
|
|
455
|
+
// browser code
|
|
456
|
+
|
|
457
|
+
const connection = deepgram.listen.live({
|
|
458
|
+
model: "nova-3",
|
|
459
|
+
language: "en-US",
|
|
460
|
+
smart_format: true,
|
|
461
|
+
interim_results: true,
|
|
462
|
+
utterance_end_ms: 1000,
|
|
463
|
+
vad_events: true,
|
|
464
|
+
endpointing: 300,
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
// browser code
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/speech-to-text-api/listen-streaming).
|
|
383
471
|
|
|
384
|
-
[See
|
|
472
|
+
[See Our Example for more info](https://github.com/deepgram-devs/js-live-example).
|
|
385
473
|
|
|
386
474
|
## Transcribing to captions
|
|
387
475
|
|
|
476
|
+
Transcribe audio to captions.
|
|
477
|
+
|
|
388
478
|
```js
|
|
389
479
|
import { webvtt /* , srt */ } from "@deepgram/captions";
|
|
390
480
|
|
|
@@ -405,6 +495,8 @@ const vttOutput = webvtt(result);
|
|
|
405
495
|
|
|
406
496
|
## Voice Agent
|
|
407
497
|
|
|
498
|
+
Configure a Voice Agent.
|
|
499
|
+
|
|
408
500
|
```js
|
|
409
501
|
import { createClient } from "@deepgram/sdk";
|
|
410
502
|
import { AgentEvents } from "@deepgram/sdk";
|
|
@@ -423,27 +515,36 @@ agent.on(AgentEvents.Open, () => {
|
|
|
423
515
|
audio: {
|
|
424
516
|
input: {
|
|
425
517
|
encoding: "linear16",
|
|
426
|
-
sampleRate:
|
|
518
|
+
sampleRate: 24000,
|
|
427
519
|
},
|
|
428
520
|
output: {
|
|
429
|
-
encoding: "
|
|
430
|
-
|
|
431
|
-
|
|
521
|
+
encoding: "mp3",
|
|
522
|
+
sample_rate: 24000,
|
|
523
|
+
bitrate: 48000,
|
|
524
|
+
container: "none",
|
|
432
525
|
},
|
|
433
526
|
},
|
|
434
527
|
agent: {
|
|
528
|
+
language: "en",
|
|
435
529
|
listen: {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
530
|
+
provider: {
|
|
531
|
+
type: "deepgram",
|
|
532
|
+
model: "nova-3",
|
|
533
|
+
},
|
|
440
534
|
},
|
|
441
535
|
think: {
|
|
442
536
|
provider: {
|
|
443
|
-
type: "
|
|
537
|
+
type: "open_ai",
|
|
538
|
+
model: "gpt-4-mini",
|
|
539
|
+
temperature: 0.7,
|
|
540
|
+
},
|
|
541
|
+
prompt: "You are a helpful AI assistant. Keep responses brief and friendly.",
|
|
542
|
+
},
|
|
543
|
+
speak: {
|
|
544
|
+
provider: {
|
|
545
|
+
type: "deepgram",
|
|
546
|
+
model: "aura-2-thalia-en",
|
|
444
547
|
},
|
|
445
|
-
model: "claude-3-haiku-20240307",
|
|
446
|
-
instructions: "You are a helpful AI assistant. Keep responses brief and friendly.",
|
|
447
548
|
},
|
|
448
549
|
},
|
|
449
550
|
});
|
|
@@ -496,17 +597,23 @@ For a complete implementation, you would need to:
|
|
|
496
597
|
3. Handle any function calls if your agent uses them
|
|
497
598
|
4. Add proper error handling and connection management
|
|
498
599
|
|
|
499
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/voice-agent-api/agent)
|
|
600
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/voice-agent-api/agent).
|
|
601
|
+
|
|
602
|
+
[See our Example for more info](./examples/node-agent-live/index.js).
|
|
500
603
|
|
|
501
|
-
## Text to Speech
|
|
604
|
+
## Text to Speech Rest
|
|
502
605
|
|
|
503
|
-
|
|
606
|
+
Convert text into speech using the REST API.
|
|
504
607
|
|
|
505
608
|
```js
|
|
506
609
|
const { result } = await deepgram.speak.request({ text }, { model: "aura-2-thalia-en" });
|
|
507
610
|
```
|
|
508
611
|
|
|
509
|
-
|
|
612
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api/speak).
|
|
613
|
+
|
|
614
|
+
[See our Example for info](./examples/node-speak/index.js)
|
|
615
|
+
|
|
616
|
+
## Text to Speech Streaming
|
|
510
617
|
|
|
511
618
|
```js
|
|
512
619
|
const dgConnection = deepgram.speak.live({ model: "aura-2-thalia-en" });
|
|
@@ -526,10 +633,14 @@ dgConnection.on(LiveTTSEvents.Open, () => {
|
|
|
526
633
|
});
|
|
527
634
|
```
|
|
528
635
|
|
|
529
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api).
|
|
636
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api/speak-streaming).
|
|
637
|
+
|
|
638
|
+
[See our Example for info](./examples/node-speak-live/index.js).
|
|
530
639
|
|
|
531
640
|
## Text Intelligence
|
|
532
641
|
|
|
642
|
+
Analyze Text.
|
|
643
|
+
|
|
533
644
|
```js
|
|
534
645
|
const text = `The history of the phrase 'The quick brown fox jumps over the
|
|
535
646
|
lazy dog'. The earliest known appearance of the phrase was in The Boston
|
|
@@ -550,7 +661,9 @@ const { result, error } = await deepgram.read.analyzeText(
|
|
|
550
661
|
);
|
|
551
662
|
```
|
|
552
663
|
|
|
553
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/
|
|
664
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/text-intelligence-api/text-read).
|
|
665
|
+
|
|
666
|
+
[See our Example for info](./examples/node-read/index.js).
|
|
554
667
|
|
|
555
668
|
## Authentication
|
|
556
669
|
|
|
@@ -564,6 +677,16 @@ const { result, error } = await deepgram.manage.getTokenDetails();
|
|
|
564
677
|
|
|
565
678
|
[See our API reference for more info](https://developers.deepgram.com/reference/authentication)
|
|
566
679
|
|
|
680
|
+
### Grant Token
|
|
681
|
+
|
|
682
|
+
Creates a temporary token with a 30-second TTL.
|
|
683
|
+
|
|
684
|
+
```js
|
|
685
|
+
const { result, error } = await deepgram.auth.grantToken();
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/token-based-auth-api/grant-token).
|
|
689
|
+
|
|
567
690
|
## Projects
|
|
568
691
|
|
|
569
692
|
### Get Projects
|
|
@@ -596,7 +719,7 @@ const { result, error } = await deepgram.manage.updateProject(projectId, options
|
|
|
596
719
|
|
|
597
720
|
[See our API reference for more info](https://developers.deepgram.com/reference/update-project).
|
|
598
721
|
|
|
599
|
-
|
|
722
|
+
### Delete Project
|
|
600
723
|
|
|
601
724
|
Delete a project.
|
|
602
725
|
|
|
@@ -778,6 +901,16 @@ const { result, error } = await deepgram.manage.getProjectUsageFields(projectId,
|
|
|
778
901
|
|
|
779
902
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-fields).
|
|
780
903
|
|
|
904
|
+
### Summarize Usage
|
|
905
|
+
|
|
906
|
+
`Deprecated` Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.
|
|
907
|
+
|
|
908
|
+
```js
|
|
909
|
+
const { result, error } = await deepgram.manage.getProjectUsage(projectId, options);
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/usage/get).
|
|
913
|
+
|
|
781
914
|
## Billing
|
|
782
915
|
|
|
783
916
|
### Get All Balances
|
|
@@ -802,7 +935,7 @@ const { result, error } = await deepgram.manage.getProjectBalance(projectId, bal
|
|
|
802
935
|
|
|
803
936
|
## Models
|
|
804
937
|
|
|
805
|
-
### Get All Models
|
|
938
|
+
### Get All Project Models
|
|
806
939
|
|
|
807
940
|
Retrieves all models available for a given project.
|
|
808
941
|
|
|
@@ -810,7 +943,7 @@ Retrieves all models available for a given project.
|
|
|
810
943
|
const { result, error } = await deepgram.manage.getAllModels(projectId, {});
|
|
811
944
|
```
|
|
812
945
|
|
|
813
|
-
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/
|
|
946
|
+
[See our API reference for more info](https://developers.deepgram.com/reference/management-api/projects/list-models).
|
|
814
947
|
|
|
815
948
|
### Get Model
|
|
816
949
|
|
|
@@ -826,6 +959,8 @@ const { result, error } = await deepgram.manage.getModel(projectId, modelId);
|
|
|
826
959
|
|
|
827
960
|
### List On-Prem credentials
|
|
828
961
|
|
|
962
|
+
Lists sets of distribution credentials for the specified project.
|
|
963
|
+
|
|
829
964
|
```js
|
|
830
965
|
const { result, error } = await deepgram.onprem.listCredentials(projectId);
|
|
831
966
|
```
|
|
@@ -834,6 +969,8 @@ const { result, error } = await deepgram.onprem.listCredentials(projectId);
|
|
|
834
969
|
|
|
835
970
|
### Get On-Prem credentials
|
|
836
971
|
|
|
972
|
+
Returns a set of distribution credentials for the specified project.
|
|
973
|
+
|
|
837
974
|
```js
|
|
838
975
|
const { result, error } = await deepgram.onprem.getCredentials(projectId, credentialId);
|
|
839
976
|
```
|
|
@@ -842,6 +979,8 @@ const { result, error } = await deepgram.onprem.getCredentials(projectId, creden
|
|
|
842
979
|
|
|
843
980
|
### Create On-Prem credentials
|
|
844
981
|
|
|
982
|
+
Creates a set of distribution credentials for the specified project.
|
|
983
|
+
|
|
845
984
|
```js
|
|
846
985
|
const { result, error } = await deepgram.onprem.createCredentials(projectId, options);
|
|
847
986
|
```
|
|
@@ -850,6 +989,8 @@ const { result, error } = await deepgram.onprem.createCredentials(projectId, opt
|
|
|
850
989
|
|
|
851
990
|
### Delete On-Prem credentials
|
|
852
991
|
|
|
992
|
+
Deletes a set of distribution credentials for the specified project.
|
|
993
|
+
|
|
853
994
|
```js
|
|
854
995
|
const { result, error } = await deepgram.onprem.deleteCredentials(projectId, credentialId);
|
|
855
996
|
```
|
|
@@ -858,9 +999,9 @@ const { result, error } = await deepgram.onprem.deleteCredentials(projectId, cre
|
|
|
858
999
|
|
|
859
1000
|
## Backwards Compatibility
|
|
860
1001
|
|
|
861
|
-
|
|
1002
|
+
We follow semantic versioning (semver) to ensure a smooth upgrade experience. Within a major version (like 4._), we will maintain backward compatibility so your code will continue to work without breaking changes. When we release a new major version (like moving from 3._ to 4.\*), we may introduce breaking changes to improve the SDK. We'll always document these changes clearly in our release notes to help you upgrade smoothly.
|
|
862
1003
|
|
|
863
|
-
|
|
1004
|
+
Older SDK versions will receive Priority 1 (P1) bug support only. Security issues, both in our code and dependencies, are promptly addressed. Significant bugs without clear workarounds are also given priority attention.
|
|
864
1005
|
|
|
865
1006
|
## Development and Contributing
|
|
866
1007
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare type Provider = {
|
|
2
|
+
type: string;
|
|
3
|
+
} & Record<string, unknown>;
|
|
4
4
|
/**
|
|
5
5
|
* @see https://developers.deepgram.com/reference/voicebot-api-phase-preview#settingsconfiguration
|
|
6
6
|
*/
|
|
@@ -15,7 +15,7 @@ interface AgentLiveSchema extends Record<string, unknown> {
|
|
|
15
15
|
/**
|
|
16
16
|
* @default "linear16"
|
|
17
17
|
*/
|
|
18
|
-
encoding:
|
|
18
|
+
encoding: string;
|
|
19
19
|
/**
|
|
20
20
|
* @default 16000
|
|
21
21
|
*/
|
|
@@ -41,46 +41,10 @@ interface AgentLiveSchema extends Record<string, unknown> {
|
|
|
41
41
|
*/
|
|
42
42
|
language?: string;
|
|
43
43
|
listen?: {
|
|
44
|
-
provider:
|
|
45
|
-
type: "deepgram";
|
|
46
|
-
/**
|
|
47
|
-
* @see https://developers.deepgram.com/docs/model
|
|
48
|
-
*/
|
|
49
|
-
model: ListenModel;
|
|
50
|
-
/**
|
|
51
|
-
* Only available for Nova 3.
|
|
52
|
-
* @see https://developers.deepgram.com/docs/keyterm
|
|
53
|
-
*/
|
|
54
|
-
keyterms?: string[];
|
|
55
|
-
};
|
|
44
|
+
provider: Provider;
|
|
56
45
|
};
|
|
57
46
|
speak?: {
|
|
58
|
-
provider:
|
|
59
|
-
type: "deepgram" | "eleven_labs" | "cartesia" | "open_ai" | string;
|
|
60
|
-
/**
|
|
61
|
-
* Deepgram OR OpenAI model to use.
|
|
62
|
-
*/
|
|
63
|
-
model?: SpeakModel;
|
|
64
|
-
/**
|
|
65
|
-
* Eleven Labs OR Cartesia model to use.
|
|
66
|
-
*/
|
|
67
|
-
model_id?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Cartesia voice configuration.
|
|
70
|
-
*/
|
|
71
|
-
voice?: {
|
|
72
|
-
mode: string;
|
|
73
|
-
id: string;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Optional Cartesia language.
|
|
77
|
-
*/
|
|
78
|
-
language?: string;
|
|
79
|
-
/**
|
|
80
|
-
* Optional Eleven Labs voice.
|
|
81
|
-
*/
|
|
82
|
-
language_code?: string;
|
|
83
|
-
};
|
|
47
|
+
provider: Provider;
|
|
84
48
|
endpoint?: {
|
|
85
49
|
url: string;
|
|
86
50
|
headers?: Record<string, string>;
|
|
@@ -90,14 +54,7 @@ interface AgentLiveSchema extends Record<string, unknown> {
|
|
|
90
54
|
* @see https://developers.deepgram.com/reference/voicebot-api-phase-preview#supported-llm-providers-and-models
|
|
91
55
|
*/
|
|
92
56
|
think?: {
|
|
93
|
-
provider:
|
|
94
|
-
type: "deepgram" | "open_ai" | "anthropic" | "x_ai" | string;
|
|
95
|
-
model: string;
|
|
96
|
-
/**
|
|
97
|
-
* 0-2 for OpenAI, 0-1 for Anthropic.
|
|
98
|
-
*/
|
|
99
|
-
temperature?: number;
|
|
100
|
-
};
|
|
57
|
+
provider: Provider;
|
|
101
58
|
/**
|
|
102
59
|
* Optional ONLY if LLM provider is OpenAI or Anthropic.
|
|
103
60
|
*/
|
|
@@ -116,6 +73,7 @@ interface AgentLiveSchema extends Record<string, unknown> {
|
|
|
116
73
|
};
|
|
117
74
|
}[];
|
|
118
75
|
prompt?: string;
|
|
76
|
+
context_length?: number | "max";
|
|
119
77
|
};
|
|
120
78
|
/**
|
|
121
79
|
* Optional message the agent will say at the start of the connection.
|
|
@@ -123,5 +81,5 @@ interface AgentLiveSchema extends Record<string, unknown> {
|
|
|
123
81
|
greeting?: string;
|
|
124
82
|
};
|
|
125
83
|
}
|
|
126
|
-
export type { AgentLiveSchema
|
|
84
|
+
export type { AgentLiveSchema };
|
|
127
85
|
//# sourceMappingURL=AgentLiveSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentLiveSchema.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/AgentLiveSchema.ts"],"names":[],"mappings":"AAAA,aAAK,
|
|
1
|
+
{"version":3,"file":"AgentLiveSchema.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/AgentLiveSchema.ts"],"names":[],"mappings":"AAAA,aAAK,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3D;;GAEG;AACH,UAAU,eAAgB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE;QACL,KAAK,CAAC,EAAE;YACN;;eAEG;YACH,QAAQ,EAAE,MAAM,CAAC;YACjB;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;SACrB,CAAC;QACF;;WAEG;QACH,MAAM,CAAC,EAAE;YACP,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB;;eAEG;YACH,SAAS,CAAC,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;IACF,KAAK,EAAE;QACL;;;WAGG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE;YACP,QAAQ,EAAE,QAAQ,CAAC;SACpB,CAAC;QACF,KAAK,CAAC,EAAE;YACN,QAAQ,EAAE,QAAQ,CAAC;YACnB,QAAQ,CAAC,EAAE;gBACT,GAAG,EAAE,MAAM,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aAClC,CAAC;SACH,CAAC;QACF;;WAEG;QACH,KAAK,CAAC,EAAE;YACN,QAAQ,EAAE,QAAQ,CAAC;YACnB;;eAEG;YACH,QAAQ,CAAC,EAAE;gBACT,GAAG,EAAE,MAAM,CAAC;gBACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aAClC,CAAC;YACF,SAAS,CAAC,EAAE;gBACV,IAAI,CAAC,EAAE,MAAM,CAAC;gBACd,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACrC,QAAQ,CAAC,EAAE;oBACT,GAAG,CAAC,EAAE,MAAM,CAAC;oBACb,MAAM,CAAC,EAAE,MAAM,CAAC;oBAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;iBAClC,CAAC;aACH,EAAE,CAAC;YACJ,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;SACjC,CAAC;QACF;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "4.
|
|
1
|
+
export declare const version = "4.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/main/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentLiveClient.d.ts","sourceRoot":"","sources":["../../../src/packages/AgentLiveClient.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AgentLiveClient.d.ts","sourceRoot":"","sources":["../../../src/packages/AgentLiveClient.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,kBAAkB;IAC9C,SAAS,EAAE,MAAM,CAAW;gBAEvB,OAAO,EAAE,qBAAqB,EAAE,QAAQ,GAAE,MAAmC;IAOzF;;;;;;;OAOG;IACI,eAAe,IAAI,IAAI;IAoB9B;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IA8BlD;;;OAGG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIjD;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAQ5C;;;;OAIG;IACI,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAQhD;;;OAGG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIzC;;;OAGG;IACI,WAAW,CAAC,WAAW,EAAE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI;IAI5F;;;;;;;;OAQG;IACI,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIhD;;;OAGG;IACI,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAIjE;;;;OAIG;IACI,SAAS,IAAI,IAAI;CAGzB"}
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AgentLiveClient = void 0;
|
|
4
4
|
const constants_1 = require("../lib/constants");
|
|
5
5
|
const AgentEvents_1 = require("../lib/enums/AgentEvents");
|
|
6
|
-
const errors_1 = require("../lib/errors");
|
|
7
6
|
const AbstractLiveClient_1 = require("./AbstractLiveClient");
|
|
8
7
|
class AgentLiveClient extends AbstractLiveClient_1.AbstractLiveClient {
|
|
9
8
|
constructor(options, endpoint = "/:version/agent/converse") {
|
|
@@ -100,11 +99,6 @@ class AgentLiveClient extends AbstractLiveClient_1.AbstractLiveClient {
|
|
|
100
99
|
* @param options - The SettingsConfiguration object.
|
|
101
100
|
*/
|
|
102
101
|
configure(options) {
|
|
103
|
-
var _a, _b, _c;
|
|
104
|
-
if (!((_a = options.agent.listen) === null || _a === void 0 ? void 0 : _a.provider.model.startsWith("nova-3")) &&
|
|
105
|
-
((_c = (_b = options.agent.listen) === null || _b === void 0 ? void 0 : _b.provider.keyterms) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
106
|
-
throw new errors_1.DeepgramError("Keyterms are only supported with the Nova 3 models.");
|
|
107
|
-
}
|
|
108
102
|
const string = JSON.stringify(Object.assign({ type: "Settings" }, options));
|
|
109
103
|
this.send(string);
|
|
110
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentLiveClient.js","sourceRoot":"","sources":["../../../src/packages/AgentLiveClient.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AACrD,0DAAuD;
|
|
1
|
+
{"version":3,"file":"AgentLiveClient.js","sourceRoot":"","sources":["../../../src/packages/AgentLiveClient.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AACrD,0DAAuD;AAEvD,6DAA0D;AAE1D,MAAa,eAAgB,SAAQ,uCAAkB;IAGrD,YAAY,OAA8B,EAAE,WAAmB,0BAA0B;;QACvF,KAAK,CAAC,OAAO,CAAC,CAAC;QAHV,cAAS,GAAW,OAAO,CAAC;QAIjC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAA,MAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,SAAS,0CAAE,OAAO,0CAAE,GAAG,mCAAI,6BAAiB,CAAC;QAE3E,IA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