@deepgram/sdk 3.9.0-beta.1 → 3.10.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 +68 -68
- package/dist/main/lib/enums/AgentEvents.d.ts +51 -1
- package/dist/main/lib/enums/AgentEvents.d.ts.map +1 -1
- package/dist/main/lib/enums/AgentEvents.js +51 -1
- package/dist/main/lib/enums/AgentEvents.js.map +1 -1
- package/dist/main/lib/fetch.js +1 -1
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/types/AgentLiveSchema.d.ts +10 -20
- package/dist/main/lib/types/AgentLiveSchema.d.ts.map +1 -1
- package/dist/main/lib/types/FunctionCallResponse.d.ts +14 -0
- package/dist/main/lib/types/FunctionCallResponse.d.ts.map +1 -0
- package/dist/main/lib/types/FunctionCallResponse.js +3 -0
- package/dist/main/lib/types/FunctionCallResponse.js.map +1 -0
- package/dist/main/lib/types/LiveTranscriptionEvent.d.ts +2 -0
- package/dist/main/lib/types/LiveTranscriptionEvent.d.ts.map +1 -1
- package/dist/main/lib/types/index.d.ts +1 -0
- package/dist/main/lib/types/index.d.ts.map +1 -1
- package/dist/main/lib/types/index.js +1 -0
- package/dist/main/lib/types/index.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/packages/AbstractLiveClient.d.ts +1 -1
- package/dist/main/packages/AbstractLiveClient.js +11 -0
- package/dist/main/packages/AbstractLiveClient.js.map +1 -1
- package/dist/main/packages/AgentLiveClient.d.ts +8 -1
- package/dist/main/packages/AgentLiveClient.d.ts.map +1 -1
- package/dist/main/packages/AgentLiveClient.js +17 -1
- package/dist/main/packages/AgentLiveClient.js.map +1 -1
- package/dist/main/packages/ListenRestClient.d.ts.map +1 -1
- package/dist/main/packages/ListenRestClient.js.map +1 -1
- package/dist/main/packages/ReadRestClient.d.ts.map +1 -1
- package/dist/main/packages/ReadRestClient.js.map +1 -1
- package/dist/main/packages/SpeakRestClient.d.ts.map +1 -1
- package/dist/main/packages/SpeakRestClient.js +10 -15
- package/dist/main/packages/SpeakRestClient.js.map +1 -1
- package/dist/module/lib/enums/AgentEvents.d.ts +51 -1
- package/dist/module/lib/enums/AgentEvents.d.ts.map +1 -1
- package/dist/module/lib/enums/AgentEvents.js +51 -1
- package/dist/module/lib/enums/AgentEvents.js.map +1 -1
- package/dist/module/lib/fetch.js +1 -1
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/types/AgentLiveSchema.d.ts +10 -20
- package/dist/module/lib/types/AgentLiveSchema.d.ts.map +1 -1
- package/dist/module/lib/types/FunctionCallResponse.d.ts +14 -0
- package/dist/module/lib/types/FunctionCallResponse.d.ts.map +1 -0
- package/dist/module/lib/types/FunctionCallResponse.js +2 -0
- package/dist/module/lib/types/FunctionCallResponse.js.map +1 -0
- package/dist/module/lib/types/LiveTranscriptionEvent.d.ts +2 -0
- package/dist/module/lib/types/LiveTranscriptionEvent.d.ts.map +1 -1
- package/dist/module/lib/types/index.d.ts +1 -0
- package/dist/module/lib/types/index.d.ts.map +1 -1
- package/dist/module/lib/types/index.js +1 -0
- package/dist/module/lib/types/index.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/packages/AbstractLiveClient.d.ts +1 -1
- package/dist/module/packages/AbstractLiveClient.js +11 -0
- package/dist/module/packages/AbstractLiveClient.js.map +1 -1
- package/dist/module/packages/AgentLiveClient.d.ts +8 -1
- package/dist/module/packages/AgentLiveClient.d.ts.map +1 -1
- package/dist/module/packages/AgentLiveClient.js +17 -1
- package/dist/module/packages/AgentLiveClient.js.map +1 -1
- package/dist/module/packages/ListenRestClient.d.ts.map +1 -1
- package/dist/module/packages/ListenRestClient.js.map +1 -1
- package/dist/module/packages/ReadRestClient.d.ts.map +1 -1
- package/dist/module/packages/ReadRestClient.js.map +1 -1
- package/dist/module/packages/SpeakRestClient.d.ts.map +1 -1
- package/dist/module/packages/SpeakRestClient.js +10 -15
- package/dist/module/packages/SpeakRestClient.js.map +1 -1
- package/dist/umd/deepgram.js +1 -1
- package/package.json +14 -3
- package/src/lib/enums/AgentEvents.ts +51 -1
- package/src/lib/fetch.ts +1 -1
- package/src/lib/types/AgentLiveSchema.ts +19 -25
- package/src/lib/types/FunctionCallResponse.ts +13 -0
- package/src/lib/types/LiveTranscriptionEvent.ts +2 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/version.ts +1 -1
- package/src/packages/AbstractLiveClient.ts +6 -6
- package/src/packages/AgentLiveClient.ts +23 -2
- package/src/packages/ListenRestClient.ts +0 -1
- package/src/packages/ReadRestClient.ts +1 -1
- package/src/packages/SpeakRestClient.ts +15 -19
package/README.md
CHANGED
|
@@ -72,17 +72,17 @@ Official JavaScript SDK for [Deepgram](https://www.deepgram.com/). Power your ap
|
|
|
72
72
|
- [Debugging and making changes locally](#debugging-and-making-changes-locally)
|
|
73
73
|
- [Getting Help](#getting-help)
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
## Migrating from earlier versions
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
### V2 to V3
|
|
78
78
|
|
|
79
79
|
We have published [a migration guide on our docs](https://developers.deepgram.com/docs/js-sdk-v2-to-v3-migration-guide), showing how to move from v2 to v3.
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
### V3.\* to V3.4
|
|
82
82
|
|
|
83
83
|
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.
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
## Installation
|
|
86
86
|
|
|
87
87
|
You can install this SDK directly from [npm](https://www.npmjs.com/package/@deepgram/sdk).
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@ npm install @deepgram/sdk
|
|
|
92
92
|
# yarn add @deepgram/sdk
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
### UMD
|
|
96
96
|
|
|
97
97
|
You can now use plain `<script>`s to import deepgram from CDNs, like:
|
|
98
98
|
|
|
@@ -118,7 +118,7 @@ Then you can use it from a global deepgram variable:
|
|
|
118
118
|
</script>
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
### ESM
|
|
122
122
|
|
|
123
123
|
You can now use type="module" `<script>`s to import deepgram from CDNs, like:
|
|
124
124
|
|
|
@@ -132,7 +132,7 @@ You can now use type="module" `<script>`s to import deepgram from CDNs, like:
|
|
|
132
132
|
</script>
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
## Initialization
|
|
136
136
|
|
|
137
137
|
```js
|
|
138
138
|
import { createClient } from "@deepgram/sdk";
|
|
@@ -142,26 +142,26 @@ import { createClient } from "@deepgram/sdk";
|
|
|
142
142
|
const deepgram = createClient(DEEPGRAM_API_KEY);
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
### Getting an API Key
|
|
146
146
|
|
|
147
147
|
🔑 To access the Deepgram API you will need a [free Deepgram API Key](https://console.deepgram.com/signup?jump=keys).
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
## Scoped Configuration
|
|
150
150
|
|
|
151
151
|
The SDK supports scoped configuration. You'll be able to configure various aspects of each namespace of the SDK from the initialization. Below outlines a flexible and customizable configuration system for the Deepgram SDK. Here’s how the namespace configuration works:
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
### 1. Global Defaults
|
|
154
154
|
|
|
155
155
|
- The `global` namespace serves as the foundational configuration applicable across all other namespaces unless overridden.
|
|
156
156
|
- Includes general settings like URL and headers applicable for all API calls.
|
|
157
157
|
- If no specific configurations are provided for other namespaces, the `global` defaults are used.
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
### 2. Namespace-specific Configurations
|
|
160
160
|
|
|
161
161
|
- Each namespace (`listen`, `manage`, `onprem`, `read`, `speak`) can have its specific configurations which override the `global` settings within their respective scopes.
|
|
162
162
|
- Allows for detailed control over different parts of the application interacting with various Deepgram API endpoints.
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
### 3. Transport Options
|
|
165
165
|
|
|
166
166
|
- Configurations for both `fetch` and `websocket` can be specified under each namespace, allowing different transport mechanisms for different operations.
|
|
167
167
|
- For example, the `fetch` configuration can have its own URL and proxy settings distinct from the `websocket`.
|
|
@@ -169,9 +169,9 @@ The SDK supports scoped configuration. You'll be able to configure various aspec
|
|
|
169
169
|
|
|
170
170
|
This configuration system enables robust customization where defaults provide a foundation, but every aspect of the client's interaction with the API can be finely controlled and tailored to specific needs through namespace-specific settings. This enhances the maintainability and scalability of the application by localizing configurations to their relevant contexts.
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
### 4. Examples
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
#### Change the API url used for all SDK methods
|
|
175
175
|
|
|
176
176
|
Useful for using different API environments (for e.g. beta).
|
|
177
177
|
|
|
@@ -185,7 +185,7 @@ const deepgram = createClient(DEEPGRAM_API_KEY, {
|
|
|
185
185
|
});
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
#### Change the API url used for transcription only
|
|
189
189
|
|
|
190
190
|
Useful for on-prem installations. Only affects requests to `/listen` endpoints.
|
|
191
191
|
|
|
@@ -199,7 +199,7 @@ const deepgram = createClient(DEEPGRAM_API_KEY, {
|
|
|
199
199
|
});
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
#### Override fetch transmitter
|
|
203
203
|
|
|
204
204
|
Useful for providing a custom http client.
|
|
205
205
|
|
|
@@ -217,7 +217,7 @@ const deepgram = createClient(DEEPGRAM_API_KEY, {
|
|
|
217
217
|
});
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
#### Proxy requests in the browser
|
|
221
221
|
|
|
222
222
|
This SDK now works in the browser. If you'd like to make REST-based requests (pre-recorded transcription, on-premise, and management requests), then you'll need to use a proxy as we do not support custom CORS origins on our API. To set up your proxy, you configure the SDK like so:
|
|
223
223
|
|
|
@@ -235,7 +235,7 @@ Your proxy service should replace the Authorization header with `Authorization:
|
|
|
235
235
|
|
|
236
236
|
Check out our example Node-based proxy here: [Deepgram Node Proxy](https://github.com/deepgram-devs/deepgram-node-proxy).
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
#### Set custom headers for fetch
|
|
239
239
|
|
|
240
240
|
Useful for many things.
|
|
241
241
|
|
|
@@ -247,9 +247,9 @@ const deepgram = createClient("proxy", {
|
|
|
247
247
|
});
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
## Transcription (Synchronous)
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
### Remote Files
|
|
253
253
|
|
|
254
254
|
```js
|
|
255
255
|
const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
|
|
@@ -264,7 +264,7 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
|
|
|
264
264
|
|
|
265
265
|
[See our API reference for more info](https://developers.deepgram.com/reference/pre-recorded).
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
### Local Files
|
|
268
268
|
|
|
269
269
|
```js
|
|
270
270
|
const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
|
|
@@ -288,9 +288,9 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeFile(
|
|
|
288
288
|
|
|
289
289
|
[See our API reference for more info](https://developers.deepgram.com/reference/pre-recorded).
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
## Transcription (Asynchronous / Callbacks)
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
### Remote Files
|
|
294
294
|
|
|
295
295
|
```js
|
|
296
296
|
import { CallbackUrl } from "@deepgram/sdk";
|
|
@@ -308,7 +308,7 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeUrlCallbac
|
|
|
308
308
|
|
|
309
309
|
[See our API reference for more info](https://developers.deepgram.com/reference/pre-recorded).
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
### Local Files
|
|
312
312
|
|
|
313
313
|
```js
|
|
314
314
|
import { CallbackUrl } from "@deepgram/sdk";
|
|
@@ -338,9 +338,9 @@ const { result, error } = await deepgram.listen.prerecorded.transcribeFileCallba
|
|
|
338
338
|
|
|
339
339
|
[See our API reference for more info](https://developers.deepgram.com/reference/pre-recorded).
|
|
340
340
|
|
|
341
|
-
|
|
341
|
+
## Transcription (Live / Streaming)
|
|
342
342
|
|
|
343
|
-
|
|
343
|
+
### Live Audio
|
|
344
344
|
|
|
345
345
|
```js
|
|
346
346
|
const dgConnection = deepgram.listen.live({ model: "nova" });
|
|
@@ -360,7 +360,7 @@ To see an example, [check out our Node.js example](https://github.com/deepgram-d
|
|
|
360
360
|
|
|
361
361
|
[See our API reference for more info](https://developers.deepgram.com/reference/streaming).
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
## Transcribing to captions
|
|
364
364
|
|
|
365
365
|
```js
|
|
366
366
|
import { webvtt /* , srt */ } from "@deepgram/captions";
|
|
@@ -380,15 +380,15 @@ const vttOutput = webvtt(result);
|
|
|
380
380
|
|
|
381
381
|
[See our standalone captions library for more information](https://github.com/deepgram/deepgram-node-captions).
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
## Text to Speech
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
### Rest
|
|
386
386
|
|
|
387
387
|
```js
|
|
388
388
|
const { result } = await deepgram.speak.request({ text }, { model: "aura-asteria-en" });
|
|
389
389
|
```
|
|
390
390
|
|
|
391
|
-
|
|
391
|
+
### Websocket
|
|
392
392
|
|
|
393
393
|
```js
|
|
394
394
|
const dgConnection = deepgram.speak.live({ model: "aura-asteria-en" });
|
|
@@ -410,7 +410,7 @@ dgConnection.on(LiveTTSEvents.Open, () => {
|
|
|
410
410
|
|
|
411
411
|
[See our API reference for more info](https://developers.deepgram.com/reference/text-to-speech-api).
|
|
412
412
|
|
|
413
|
-
|
|
413
|
+
## Text Intelligence
|
|
414
414
|
|
|
415
415
|
```js
|
|
416
416
|
const text = `The history of the phrase 'The quick brown fox jumps over the
|
|
@@ -434,9 +434,9 @@ const { result, error } = await deepgram.read.analyzeText(
|
|
|
434
434
|
|
|
435
435
|
[See our API reference for more info](https://developers.deepgram.com/reference/analyze-text).
|
|
436
436
|
|
|
437
|
-
|
|
437
|
+
## Projects
|
|
438
438
|
|
|
439
|
-
|
|
439
|
+
### Get Projects
|
|
440
440
|
|
|
441
441
|
Returns all projects accessible by the API key.
|
|
442
442
|
|
|
@@ -446,7 +446,7 @@ const { result, error } = await deepgram.manage.getProjects();
|
|
|
446
446
|
|
|
447
447
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-projects).
|
|
448
448
|
|
|
449
|
-
|
|
449
|
+
### Get Project
|
|
450
450
|
|
|
451
451
|
Retrieves a specific project based on the provided project_id.
|
|
452
452
|
|
|
@@ -456,7 +456,7 @@ const { result, error } = await deepgram.manage.getProject(projectId);
|
|
|
456
456
|
|
|
457
457
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-project).
|
|
458
458
|
|
|
459
|
-
|
|
459
|
+
### Update Project
|
|
460
460
|
|
|
461
461
|
Update a project.
|
|
462
462
|
|
|
@@ -476,9 +476,9 @@ const { error } = await deepgram.manage.deleteProject(projectId);
|
|
|
476
476
|
|
|
477
477
|
[See our API reference for more info](https://developers.deepgram.com/reference/delete-project).
|
|
478
478
|
|
|
479
|
-
|
|
479
|
+
## Keys
|
|
480
480
|
|
|
481
|
-
|
|
481
|
+
### List Keys
|
|
482
482
|
|
|
483
483
|
Retrieves all keys associated with the provided project_id.
|
|
484
484
|
|
|
@@ -488,7 +488,7 @@ const { result, error } = await deepgram.manage.getProjectKeys(projectId);
|
|
|
488
488
|
|
|
489
489
|
[See our API reference for more info](https://developers.deepgram.com/reference/list-keys).
|
|
490
490
|
|
|
491
|
-
|
|
491
|
+
### Get Key
|
|
492
492
|
|
|
493
493
|
Retrieves a specific key associated with the provided project_id.
|
|
494
494
|
|
|
@@ -498,7 +498,7 @@ const { result, error } = await deepgram.manage.getProjectKey(projectId, project
|
|
|
498
498
|
|
|
499
499
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-key).
|
|
500
500
|
|
|
501
|
-
|
|
501
|
+
### Create Key
|
|
502
502
|
|
|
503
503
|
Creates an API key with the provided scopes.
|
|
504
504
|
|
|
@@ -508,7 +508,7 @@ const { result, error } = await deepgram.manage.createProjectKey(projectId, opti
|
|
|
508
508
|
|
|
509
509
|
[See our API reference for more info](https://developers.deepgram.com/reference/create-key).
|
|
510
510
|
|
|
511
|
-
|
|
511
|
+
### Delete Key
|
|
512
512
|
|
|
513
513
|
Deletes a specific key associated with the provided project_id.
|
|
514
514
|
|
|
@@ -518,9 +518,9 @@ const { error } = await deepgram.manage.deleteProjectKey(projectId, projectKeyId
|
|
|
518
518
|
|
|
519
519
|
[See our API reference for more info](https://developers.deepgram.com/reference/delete-key).
|
|
520
520
|
|
|
521
|
-
|
|
521
|
+
## Members
|
|
522
522
|
|
|
523
|
-
|
|
523
|
+
### Get Members
|
|
524
524
|
|
|
525
525
|
Retrieves account objects for all of the accounts in the specified project_id.
|
|
526
526
|
|
|
@@ -530,7 +530,7 @@ const { result, error } = await deepgram.manage.getProjectMembers(projectId);
|
|
|
530
530
|
|
|
531
531
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-members).
|
|
532
532
|
|
|
533
|
-
|
|
533
|
+
### Remove Member
|
|
534
534
|
|
|
535
535
|
Removes member account for specified member_id.
|
|
536
536
|
|
|
@@ -540,9 +540,9 @@ const { error } = await deepgram.manage.removeProjectMember(projectId, projectMe
|
|
|
540
540
|
|
|
541
541
|
[See our API reference for more info](https://developers.deepgram.com/reference/remove-member).
|
|
542
542
|
|
|
543
|
-
|
|
543
|
+
## Scopes
|
|
544
544
|
|
|
545
|
-
|
|
545
|
+
### Get Member Scopes
|
|
546
546
|
|
|
547
547
|
Retrieves scopes of the specified member in the specified project.
|
|
548
548
|
|
|
@@ -552,7 +552,7 @@ const { result, error } = await deepgram.manage.getProjectMemberScopes(projectId
|
|
|
552
552
|
|
|
553
553
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-member-scopes).
|
|
554
554
|
|
|
555
|
-
|
|
555
|
+
### Update Scope
|
|
556
556
|
|
|
557
557
|
Updates the scope for the specified member in the specified project.
|
|
558
558
|
|
|
@@ -566,9 +566,9 @@ const { result, error } = await deepgram.manage.updateProjectMemberScope(
|
|
|
566
566
|
|
|
567
567
|
[See our API reference for more info](https://developers.deepgram.com/reference/update-scope).
|
|
568
568
|
|
|
569
|
-
|
|
569
|
+
## Invitations
|
|
570
570
|
|
|
571
|
-
|
|
571
|
+
### List Invites
|
|
572
572
|
|
|
573
573
|
Retrieves all invitations associated with the provided project_id.
|
|
574
574
|
|
|
@@ -578,7 +578,7 @@ const { result, error } = await deepgram.manage.getProjectInvites(projectId);
|
|
|
578
578
|
|
|
579
579
|
[See our API reference for more info](https://developers.deepgram.com/reference/list-invites).
|
|
580
580
|
|
|
581
|
-
|
|
581
|
+
### Send Invite
|
|
582
582
|
|
|
583
583
|
Sends an invitation to the provided email address.
|
|
584
584
|
|
|
@@ -588,7 +588,7 @@ const { result, error } = await deepgram.manage.sendProjectInvite(projectId, opt
|
|
|
588
588
|
|
|
589
589
|
[See our API reference for more info](https://developers.deepgram.com/reference/send-invites).
|
|
590
590
|
|
|
591
|
-
|
|
591
|
+
### Delete Invite
|
|
592
592
|
|
|
593
593
|
Removes the specified invitation from the project.
|
|
594
594
|
|
|
@@ -598,7 +598,7 @@ const { error } = await deepgram.manage.deleteProjectInvite(projectId, email);
|
|
|
598
598
|
|
|
599
599
|
[See our API reference for more info](https://developers.deepgram.com/reference/delete-invite).
|
|
600
600
|
|
|
601
|
-
|
|
601
|
+
### Leave Project
|
|
602
602
|
|
|
603
603
|
Removes the authenticated user from the project.
|
|
604
604
|
|
|
@@ -608,9 +608,9 @@ const { result, error } = await deepgram.manage.leaveProject(projectId);
|
|
|
608
608
|
|
|
609
609
|
[See our API reference for more info](https://developers.deepgram.com/reference/leave-project).
|
|
610
610
|
|
|
611
|
-
|
|
611
|
+
## Usage
|
|
612
612
|
|
|
613
|
-
|
|
613
|
+
### Get All Requests
|
|
614
614
|
|
|
615
615
|
Retrieves all requests associated with the provided project_id based on the provided options.
|
|
616
616
|
|
|
@@ -620,7 +620,7 @@ const { result, error } = await deepgram.manage.getProjectUsageRequest(projectId
|
|
|
620
620
|
|
|
621
621
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-all-requests).
|
|
622
622
|
|
|
623
|
-
|
|
623
|
+
### Get Request
|
|
624
624
|
|
|
625
625
|
Retrieves a specific request associated with the provided project_id.
|
|
626
626
|
|
|
@@ -630,7 +630,7 @@ const { result, error } = await deepgram.manage.getProjectUsageRequest(projectId
|
|
|
630
630
|
|
|
631
631
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-request).
|
|
632
632
|
|
|
633
|
-
|
|
633
|
+
### Summarize Usage
|
|
634
634
|
|
|
635
635
|
Retrieves usage associated with the provided project_id based on the provided options.
|
|
636
636
|
|
|
@@ -640,7 +640,7 @@ const { result, error } = await deepgram.manage.getProjectUsageSummary(projectId
|
|
|
640
640
|
|
|
641
641
|
[See our API reference for more info](https://developers.deepgram.com/reference/summarize-usage).
|
|
642
642
|
|
|
643
|
-
|
|
643
|
+
### Get Fields
|
|
644
644
|
|
|
645
645
|
Lists the features, models, tags, languages, and processing method used for requests in the specified project.
|
|
646
646
|
|
|
@@ -650,9 +650,9 @@ const { result, error } = await deepgram.manage.getProjectUsageFields(projectId,
|
|
|
650
650
|
|
|
651
651
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-fields).
|
|
652
652
|
|
|
653
|
-
|
|
653
|
+
## Billing
|
|
654
654
|
|
|
655
|
-
|
|
655
|
+
### Get All Balances
|
|
656
656
|
|
|
657
657
|
Retrieves the list of balance info for the specified project.
|
|
658
658
|
|
|
@@ -662,7 +662,7 @@ const { result, error } = await deepgram.manage.getProjectBalances(projectId);
|
|
|
662
662
|
|
|
663
663
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-all-balances).
|
|
664
664
|
|
|
665
|
-
|
|
665
|
+
### Get Balance
|
|
666
666
|
|
|
667
667
|
Retrieves the balance info for the specified project and balance_id.
|
|
668
668
|
|
|
@@ -672,39 +672,39 @@ const { result, error } = await deepgram.manage.getProjectBalance(projectId, bal
|
|
|
672
672
|
|
|
673
673
|
[See our API reference for more info](https://developers.deepgram.com/reference/get-balance).
|
|
674
674
|
|
|
675
|
-
|
|
675
|
+
## On-Prem APIs
|
|
676
676
|
|
|
677
|
-
|
|
677
|
+
### List On-Prem credentials
|
|
678
678
|
|
|
679
679
|
```js
|
|
680
680
|
const { result, error } = await deepgram.onprem.listCredentials(projectId);
|
|
681
681
|
```
|
|
682
682
|
|
|
683
|
-
|
|
683
|
+
### Get On-Prem credentials
|
|
684
684
|
|
|
685
685
|
```js
|
|
686
686
|
const { result, error } = await deepgram.onprem.getCredentials(projectId, credentialId);
|
|
687
687
|
```
|
|
688
688
|
|
|
689
|
-
|
|
689
|
+
### Create On-Prem credentials
|
|
690
690
|
|
|
691
691
|
```js
|
|
692
692
|
const { result, error } = await deepgram.onprem.createCredentials(projectId, options);
|
|
693
693
|
```
|
|
694
694
|
|
|
695
|
-
|
|
695
|
+
### Delete On-Prem credentials
|
|
696
696
|
|
|
697
697
|
```js
|
|
698
698
|
const { result, error } = await deepgram.onprem.deleteCredentials(projectId, credentialId);
|
|
699
699
|
```
|
|
700
700
|
|
|
701
|
-
|
|
701
|
+
## Backwards Compatibility
|
|
702
702
|
|
|
703
703
|
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.
|
|
704
704
|
|
|
705
705
|
We strictly follow semver, and will not introduce breaking changes to the publicly documented interfaces of the SDK. **Use internal and undocumented interfaces without pinning your version, at your own risk.**
|
|
706
706
|
|
|
707
|
-
|
|
707
|
+
## Development and Contributing
|
|
708
708
|
|
|
709
709
|
Interested in contributing? We ❤️ pull requests!
|
|
710
710
|
|
|
@@ -712,11 +712,11 @@ To make sure our community is safe for all, be sure to review and agree to our
|
|
|
712
712
|
[Code of Conduct](./CODE_OF_CONDUCT.md). Then see the
|
|
713
713
|
[Contribution](./CONTRIBUTING.md) guidelines for more information.
|
|
714
714
|
|
|
715
|
-
|
|
715
|
+
### Debugging and making changes locally
|
|
716
716
|
|
|
717
717
|
If you want to make local changes to the SDK and run the [`examples/`](./examples/), you'll need to `npm run build` first, to ensure that your changes are included in the examples that are running.
|
|
718
718
|
|
|
719
|
-
|
|
719
|
+
## Getting Help
|
|
720
720
|
|
|
721
721
|
We love to hear from you so if you have questions, comments or find a bug in the
|
|
722
722
|
project, let us know! You can either:
|
|
@@ -10,16 +10,66 @@ export declare enum AgentEvents {
|
|
|
10
10
|
*/
|
|
11
11
|
Audio = "Audio",
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Confirms the successful connection to the websocket.
|
|
14
|
+
* { type: "Welcome", session_id: "String"}
|
|
14
15
|
*/
|
|
15
16
|
Welcome = "Welcome",
|
|
17
|
+
/**
|
|
18
|
+
* Confirms that your `configure` request was successful.
|
|
19
|
+
* { type: "SettingsApplied" }
|
|
20
|
+
*/
|
|
21
|
+
SettingsApplied = "SettingsApplied",
|
|
22
|
+
/**
|
|
23
|
+
* Triggered when the agent "hears" the user say something.
|
|
24
|
+
* { type: "ConversationText", role: string, content: string }
|
|
25
|
+
*/
|
|
16
26
|
ConversationText = "ConversationText",
|
|
27
|
+
/**
|
|
28
|
+
* Triggered when the agent begins receiving user audio.
|
|
29
|
+
* { type: "UserStartedSpeaking" }
|
|
30
|
+
*/
|
|
17
31
|
UserStartedSpeaking = "UserStartedSpeaking",
|
|
32
|
+
/**
|
|
33
|
+
* Triggered when the user has stopped speaking and the agent is processing the audio.
|
|
34
|
+
* { type: "AgentThinking", content: string }
|
|
35
|
+
*/
|
|
18
36
|
AgentThinking = "AgentThinking",
|
|
37
|
+
/**
|
|
38
|
+
* A request to call client-side functions.
|
|
39
|
+
* { type: "FunctionCallRequest", function_call_id: string, function_name: string, input: Record<string, any> }
|
|
40
|
+
*/
|
|
41
|
+
FunctionCallRequest = "FunctionCallRequest",
|
|
42
|
+
/**
|
|
43
|
+
* Debug message triggered when the agent is calling a function.
|
|
44
|
+
* { type: "FunctionCalling" }
|
|
45
|
+
*/
|
|
19
46
|
FunctionCalling = "FunctionCalling",
|
|
47
|
+
/**
|
|
48
|
+
* Triggered when the agent begins streaming an audio response.
|
|
49
|
+
* { type: "AgentStartedSpeaking", total_latency: number, tts_latency: number, ttt_latency: number }
|
|
50
|
+
*/
|
|
20
51
|
AgentStartedSpeaking = "AgentStartedSpeaking",
|
|
52
|
+
/**
|
|
53
|
+
* Triggered when the agent has finished streaming an audio response.
|
|
54
|
+
* { type: "AgentAudioDone" }
|
|
55
|
+
*/
|
|
21
56
|
AgentAudioDone = "AgentAudioDone",
|
|
57
|
+
/**
|
|
58
|
+
* This event is only emitted when you send an `InjectAgentMessage` request while
|
|
59
|
+
* the user is currently speaking or the server is processing user audio.
|
|
60
|
+
* { type: "InjectionRefused" }
|
|
61
|
+
*/
|
|
22
62
|
InjectionRefused = "InjectionRefused",
|
|
63
|
+
/**
|
|
64
|
+
* A successful response to the `UpdateInstructions` request.
|
|
65
|
+
* { type: "InstructionsUpdated" }
|
|
66
|
+
*/
|
|
67
|
+
InstructionsUpdated = "InstructionsUpdated",
|
|
68
|
+
/**
|
|
69
|
+
* A successful response to the `UpdateSpeak` request.
|
|
70
|
+
* { type: "SpeakUpdated" }
|
|
71
|
+
*/
|
|
72
|
+
SpeakUpdated = "SpeakUpdated",
|
|
23
73
|
/**
|
|
24
74
|
* Catch all for any other message event
|
|
25
75
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentEvents.d.ts","sourceRoot":"","sources":["../../../../src/lib/enums/AgentEvents.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB;;OAEG;IACH,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;IACf;;OAEG;IACH,KAAK,UAAU;IACf
|
|
1
|
+
{"version":3,"file":"AgentEvents.d.ts","sourceRoot":"","sources":["../../../../src/lib/enums/AgentEvents.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB;;OAEG;IACH,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;IACf;;OAEG;IACH,KAAK,UAAU;IACf;;;OAGG;IACH,OAAO,YAAY;IACnB;;;OAGG;IACH,eAAe,oBAAoB;IACnC;;;OAGG;IACH,gBAAgB,qBAAqB;IACrC;;;OAGG;IACH,mBAAmB,wBAAwB;IAC3C;;;OAGG;IACH,aAAa,kBAAkB;IAC/B;;;OAGG;IACH,mBAAmB,wBAAwB;IAC3C;;;OAGG;IACH,eAAe,oBAAoB;IACnC;;;OAGG;IACH,oBAAoB,yBAAyB;IAC7C;;;OAGG;IACH,cAAc,mBAAmB;IACjC;;;;OAIG;IACH,gBAAgB,qBAAqB;IACrC;;;OAGG;IACH,mBAAmB,wBAAwB;IAC3C;;;OAGG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,SAAS,cAAc;CACxB"}
|
|
@@ -14,16 +14,66 @@ var AgentEvents;
|
|
|
14
14
|
*/
|
|
15
15
|
AgentEvents["Audio"] = "Audio";
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Confirms the successful connection to the websocket.
|
|
18
|
+
* { type: "Welcome", session_id: "String"}
|
|
18
19
|
*/
|
|
19
20
|
AgentEvents["Welcome"] = "Welcome";
|
|
21
|
+
/**
|
|
22
|
+
* Confirms that your `configure` request was successful.
|
|
23
|
+
* { type: "SettingsApplied" }
|
|
24
|
+
*/
|
|
25
|
+
AgentEvents["SettingsApplied"] = "SettingsApplied";
|
|
26
|
+
/**
|
|
27
|
+
* Triggered when the agent "hears" the user say something.
|
|
28
|
+
* { type: "ConversationText", role: string, content: string }
|
|
29
|
+
*/
|
|
20
30
|
AgentEvents["ConversationText"] = "ConversationText";
|
|
31
|
+
/**
|
|
32
|
+
* Triggered when the agent begins receiving user audio.
|
|
33
|
+
* { type: "UserStartedSpeaking" }
|
|
34
|
+
*/
|
|
21
35
|
AgentEvents["UserStartedSpeaking"] = "UserStartedSpeaking";
|
|
36
|
+
/**
|
|
37
|
+
* Triggered when the user has stopped speaking and the agent is processing the audio.
|
|
38
|
+
* { type: "AgentThinking", content: string }
|
|
39
|
+
*/
|
|
22
40
|
AgentEvents["AgentThinking"] = "AgentThinking";
|
|
41
|
+
/**
|
|
42
|
+
* A request to call client-side functions.
|
|
43
|
+
* { type: "FunctionCallRequest", function_call_id: string, function_name: string, input: Record<string, any> }
|
|
44
|
+
*/
|
|
45
|
+
AgentEvents["FunctionCallRequest"] = "FunctionCallRequest";
|
|
46
|
+
/**
|
|
47
|
+
* Debug message triggered when the agent is calling a function.
|
|
48
|
+
* { type: "FunctionCalling" }
|
|
49
|
+
*/
|
|
23
50
|
AgentEvents["FunctionCalling"] = "FunctionCalling";
|
|
51
|
+
/**
|
|
52
|
+
* Triggered when the agent begins streaming an audio response.
|
|
53
|
+
* { type: "AgentStartedSpeaking", total_latency: number, tts_latency: number, ttt_latency: number }
|
|
54
|
+
*/
|
|
24
55
|
AgentEvents["AgentStartedSpeaking"] = "AgentStartedSpeaking";
|
|
56
|
+
/**
|
|
57
|
+
* Triggered when the agent has finished streaming an audio response.
|
|
58
|
+
* { type: "AgentAudioDone" }
|
|
59
|
+
*/
|
|
25
60
|
AgentEvents["AgentAudioDone"] = "AgentAudioDone";
|
|
61
|
+
/**
|
|
62
|
+
* This event is only emitted when you send an `InjectAgentMessage` request while
|
|
63
|
+
* the user is currently speaking or the server is processing user audio.
|
|
64
|
+
* { type: "InjectionRefused" }
|
|
65
|
+
*/
|
|
26
66
|
AgentEvents["InjectionRefused"] = "InjectionRefused";
|
|
67
|
+
/**
|
|
68
|
+
* A successful response to the `UpdateInstructions` request.
|
|
69
|
+
* { type: "InstructionsUpdated" }
|
|
70
|
+
*/
|
|
71
|
+
AgentEvents["InstructionsUpdated"] = "InstructionsUpdated";
|
|
72
|
+
/**
|
|
73
|
+
* A successful response to the `UpdateSpeak` request.
|
|
74
|
+
* { type: "SpeakUpdated" }
|
|
75
|
+
*/
|
|
76
|
+
AgentEvents["SpeakUpdated"] = "SpeakUpdated";
|
|
27
77
|
/**
|
|
28
78
|
* Catch all for any other message event
|
|
29
79
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentEvents.js","sourceRoot":"","sources":["../../../../src/lib/enums/AgentEvents.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"AgentEvents.js","sourceRoot":"","sources":["../../../../src/lib/enums/AgentEvents.ts"],"names":[],"mappings":";;;AAAA,IAAY,WA6EX;AA7ED,WAAY,WAAW;IACrB;;OAEG;IACH,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf;;OAEG;IACH,8BAAe,CAAA;IACf;;;OAGG;IACH,kCAAmB,CAAA;IACnB;;;OAGG;IACH,kDAAmC,CAAA;IACnC;;;OAGG;IACH,oDAAqC,CAAA;IACrC;;;OAGG;IACH,0DAA2C,CAAA;IAC3C;;;OAGG;IACH,8CAA+B,CAAA;IAC/B;;;OAGG;IACH,0DAA2C,CAAA;IAC3C;;;OAGG;IACH,kDAAmC,CAAA;IACnC;;;OAGG;IACH,4DAA6C,CAAA;IAC7C;;;OAGG;IACH,gDAAiC,CAAA;IACjC;;;;OAIG;IACH,oDAAqC,CAAA;IACrC;;;OAGG;IACH,0DAA2C,CAAA;IAC3C;;;OAGG;IACH,4CAA6B,CAAA;IAE7B;;OAEG;IACH,sCAAuB,CAAA;AACzB,CAAC,EA7EW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QA6EtB"}
|
package/dist/main/lib/fetch.js
CHANGED
|
@@ -69,7 +69,7 @@ const fetchWithAuth = (apiKey, customFetch) => {
|
|
|
69
69
|
const fetch = (0, exports.resolveFetch)(customFetch);
|
|
70
70
|
const HeadersConstructor = (0, helpers_1.resolveHeadersConstructor)();
|
|
71
71
|
return (input, init) => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
|
|
72
|
+
const headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
|
|
73
73
|
if (!headers.has("Authorization")) {
|
|
74
74
|
headers.set("Authorization", `Token ${apiKey}`);
|
|
75
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAsD;AACtD,8DAAqC;AAGrC;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAC;IAElB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAC;KACtB;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACvC,MAAM,GAAG,qBAA8B,CAAC;KACzC;SAAM;QACL,MAAM,GAAG,KAAK,CAAC;KAChB;IAED,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAZW,QAAA,YAAY,gBAYvB;AAEF;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAS,EAAE;IAC1E,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,WAAW,CAAC,CAAC;IACxC,MAAM,kBAAkB,GAAG,IAAA,mCAAyB,GAAE,CAAC;IAEvD,OAAO,CAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QAC3B,
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/lib/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAsD;AACtD,8DAAqC;AAGrC;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAC;IAElB,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,WAAW,CAAC;KACtB;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QACvC,MAAM,GAAG,qBAA8B,CAAC;KACzC;SAAM;QACL,MAAM,GAAG,KAAK,CAAC;KAChB;IAED,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAZW,QAAA,YAAY,gBAYvB;AAEF;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAS,EAAE;IAC1E,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,WAAW,CAAC,CAAC;IACxC,MAAM,kBAAkB,GAAG,IAAA,mCAAyB,GAAE,CAAC;IAEvD,OAAO,CAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAI,kBAAkB,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;SACjD;QAED,OAAO,KAAK,CAAC,KAAK,kCAAO,IAAI,KAAE,OAAO,IAAG,CAAC;IAC5C,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,aAAa,iBAaxB;AAEF;;;;GAIG;AACI,MAAM,eAAe,GAAG,GAAS,EAAE;IACxC,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnC,OAAO,CAAC,wDAAa,aAAa,GAAC,CAAC,CAAC,QAAQ,CAAC;KAC/C;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AANW,QAAA,eAAe,mBAM1B"}
|