@ai-sdk/deepgram 3.0.0-beta.2 → 3.0.0-beta.20
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/CHANGELOG.md +146 -4
- package/README.md +2 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.js +90 -105
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/src/deepgram-provider.ts +8 -8
- package/src/deepgram-speech-model.ts +7 -7
- package/src/deepgram-transcription-model.ts +7 -7
- package/dist/index.d.mts +0 -128
- package/dist/index.mjs +0 -650
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
1
|
# @ai-sdk/deepgram
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.20
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ef992f8]
|
|
12
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
14
|
+
|
|
15
|
+
## 3.0.0-beta.19
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [90e2d8a]
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
21
|
+
|
|
22
|
+
## 3.0.0-beta.18
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [3ae1786]
|
|
27
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
28
|
+
|
|
29
|
+
## 3.0.0-beta.17
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [176466a]
|
|
34
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
35
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
36
|
+
|
|
37
|
+
## 3.0.0-beta.16
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [e311194]
|
|
42
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
43
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
44
|
+
|
|
45
|
+
## 3.0.0-beta.15
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [34bd95d]
|
|
50
|
+
- Updated dependencies [008271d]
|
|
51
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
52
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
53
|
+
|
|
54
|
+
## 3.0.0-beta.14
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [b0c2869]
|
|
59
|
+
- Updated dependencies [7e26e81]
|
|
60
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
61
|
+
|
|
62
|
+
## 3.0.0-beta.13
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [46d1149]
|
|
67
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
68
|
+
|
|
69
|
+
## 3.0.0-beta.12
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [6fd51c0]
|
|
74
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
75
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
76
|
+
|
|
77
|
+
## 3.0.0-beta.11
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [c29a26f]
|
|
82
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
83
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
84
|
+
|
|
85
|
+
## 3.0.0-beta.10
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
90
|
+
|
|
91
|
+
## 3.0.0-beta.9
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [2e17091]
|
|
96
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
97
|
+
|
|
98
|
+
## 3.0.0-beta.8
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [986c6fd]
|
|
103
|
+
- Updated dependencies [493295c]
|
|
104
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
105
|
+
|
|
106
|
+
## 3.0.0-beta.7
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [1f509d4]
|
|
111
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
112
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
113
|
+
|
|
114
|
+
## 3.0.0-beta.6
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [3887c70]
|
|
119
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
120
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
121
|
+
|
|
122
|
+
## 3.0.0-beta.5
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [776b617]
|
|
127
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
128
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
129
|
+
|
|
130
|
+
## 3.0.0-beta.4
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [61753c3]
|
|
135
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
136
|
+
|
|
137
|
+
## 3.0.0-beta.3
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [f7d4f01]
|
|
142
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
143
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
144
|
+
|
|
3
145
|
## 3.0.0-beta.2
|
|
4
146
|
|
|
5
147
|
### Patch Changes
|
|
@@ -218,13 +360,13 @@
|
|
|
218
360
|
Before
|
|
219
361
|
|
|
220
362
|
```ts
|
|
221
|
-
model.textEmbeddingModel(
|
|
363
|
+
model.textEmbeddingModel("my-model-id");
|
|
222
364
|
```
|
|
223
365
|
|
|
224
366
|
After
|
|
225
367
|
|
|
226
368
|
```ts
|
|
227
|
-
model.embeddingModel(
|
|
369
|
+
model.embeddingModel("my-model-id");
|
|
228
370
|
```
|
|
229
371
|
|
|
230
372
|
- 7f91f36: feat(deepgram): add language detection support
|
|
@@ -440,13 +582,13 @@
|
|
|
440
582
|
Before
|
|
441
583
|
|
|
442
584
|
```ts
|
|
443
|
-
model.textEmbeddingModel(
|
|
585
|
+
model.textEmbeddingModel("my-model-id");
|
|
444
586
|
```
|
|
445
587
|
|
|
446
588
|
After
|
|
447
589
|
|
|
448
590
|
```ts
|
|
449
|
-
model.embeddingModel(
|
|
591
|
+
model.embeddingModel("my-model-id");
|
|
450
592
|
```
|
|
451
593
|
|
|
452
594
|
- Updated dependencies [8d9e8ad]
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
The **[Deepgram provider](https://ai-sdk.dev/providers/ai-sdk-providers/deepgram)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
4
|
contains transcription model support for the Deepgram transcription API and speech model support for the Deepgram text-to-speech API.
|
|
5
5
|
|
|
6
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access Deepgram (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
7
|
+
|
|
6
8
|
## Setup
|
|
7
9
|
|
|
8
10
|
The Deepgram provider is available in the `@ai-sdk/deepgram` module. You can install it with
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TranscriptionModelV4, ProviderV4, SpeechModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
@@ -41,30 +41,30 @@ interface DeepgramTranscriptionModelConfig extends DeepgramConfig {
|
|
|
41
41
|
currentDate?: () => Date;
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
declare class DeepgramTranscriptionModel implements
|
|
44
|
+
declare class DeepgramTranscriptionModel implements TranscriptionModelV4 {
|
|
45
45
|
readonly modelId: DeepgramTranscriptionModelId;
|
|
46
46
|
private readonly config;
|
|
47
|
-
readonly specificationVersion = "
|
|
47
|
+
readonly specificationVersion = "v4";
|
|
48
48
|
get provider(): string;
|
|
49
49
|
constructor(modelId: DeepgramTranscriptionModelId, config: DeepgramTranscriptionModelConfig);
|
|
50
50
|
private getArgs;
|
|
51
|
-
doGenerate(options: Parameters<
|
|
51
|
+
doGenerate(options: Parameters<TranscriptionModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>>;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
type DeepgramSpeechModelId = 'aura-asteria-en' | 'aura-2-asteria-en' | 'aura-2-thalia-en' | 'aura-2-helena-en' | 'aura-2-orpheus-en' | 'aura-2-zeus-en' | 'aura-luna-en' | 'aura-stella-en' | (string & {});
|
|
55
55
|
|
|
56
|
-
interface DeepgramProvider extends
|
|
56
|
+
interface DeepgramProvider extends ProviderV4 {
|
|
57
57
|
(modelId: 'nova-3', settings?: {}): {
|
|
58
58
|
transcription: DeepgramTranscriptionModel;
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
61
|
* Creates a model for transcription.
|
|
62
62
|
*/
|
|
63
|
-
transcription(modelId: DeepgramTranscriptionModelId):
|
|
63
|
+
transcription(modelId: DeepgramTranscriptionModelId): TranscriptionModelV4;
|
|
64
64
|
/**
|
|
65
65
|
* Creates a model for speech generation.
|
|
66
66
|
*/
|
|
67
|
-
speech(modelId: DeepgramSpeechModelId):
|
|
67
|
+
speech(modelId: DeepgramSpeechModelId): SpeechModelV4;
|
|
68
68
|
/**
|
|
69
69
|
* @deprecated Use `embeddingModel` instead.
|
|
70
70
|
*/
|
|
@@ -113,14 +113,14 @@ interface DeepgramSpeechModelConfig extends DeepgramConfig {
|
|
|
113
113
|
currentDate?: () => Date;
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
declare class DeepgramSpeechModel implements
|
|
116
|
+
declare class DeepgramSpeechModel implements SpeechModelV4 {
|
|
117
117
|
readonly modelId: DeepgramSpeechModelId;
|
|
118
118
|
private readonly config;
|
|
119
|
-
readonly specificationVersion = "
|
|
119
|
+
readonly specificationVersion = "v4";
|
|
120
120
|
get provider(): string;
|
|
121
121
|
constructor(modelId: DeepgramSpeechModelId, config: DeepgramSpeechModelConfig);
|
|
122
122
|
private getArgs;
|
|
123
|
-
doGenerate(options: Parameters<
|
|
123
|
+
doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
declare const VERSION: string;
|
package/dist/index.js
CHANGED
|
@@ -1,98 +1,79 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
DeepgramSpeechModel: () => DeepgramSpeechModel,
|
|
24
|
-
VERSION: () => VERSION,
|
|
25
|
-
createDeepgram: () => createDeepgram,
|
|
26
|
-
deepgram: () => deepgram
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
|
|
30
1
|
// src/deepgram-provider.ts
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
loadApiKey,
|
|
7
|
+
withUserAgentSuffix
|
|
8
|
+
} from "@ai-sdk/provider-utils";
|
|
33
9
|
|
|
34
10
|
// src/deepgram-transcription-model.ts
|
|
35
|
-
|
|
36
|
-
|
|
11
|
+
import {
|
|
12
|
+
combineHeaders,
|
|
13
|
+
createJsonResponseHandler,
|
|
14
|
+
parseProviderOptions,
|
|
15
|
+
postToApi
|
|
16
|
+
} from "@ai-sdk/provider-utils";
|
|
17
|
+
import { z as z2 } from "zod/v4";
|
|
37
18
|
|
|
38
19
|
// src/deepgram-error.ts
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var deepgramErrorDataSchema =
|
|
42
|
-
error:
|
|
43
|
-
message:
|
|
44
|
-
code:
|
|
20
|
+
import { z } from "zod/v4";
|
|
21
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
22
|
+
var deepgramErrorDataSchema = z.object({
|
|
23
|
+
error: z.object({
|
|
24
|
+
message: z.string(),
|
|
25
|
+
code: z.number()
|
|
45
26
|
})
|
|
46
27
|
});
|
|
47
|
-
var deepgramFailedResponseHandler =
|
|
28
|
+
var deepgramFailedResponseHandler = createJsonErrorResponseHandler({
|
|
48
29
|
errorSchema: deepgramErrorDataSchema,
|
|
49
30
|
errorToMessage: (data) => data.error.message
|
|
50
31
|
});
|
|
51
32
|
|
|
52
33
|
// src/deepgram-transcription-model.ts
|
|
53
|
-
var deepgramTranscriptionModelOptionsSchema =
|
|
34
|
+
var deepgramTranscriptionModelOptionsSchema = z2.object({
|
|
54
35
|
/** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */
|
|
55
|
-
language:
|
|
36
|
+
language: z2.string().nullish(),
|
|
56
37
|
/** Whether to enable automatic language detection. When true, Deepgram will detect the language of the audio. */
|
|
57
|
-
detectLanguage:
|
|
38
|
+
detectLanguage: z2.boolean().nullish(),
|
|
58
39
|
/** Whether to use smart formatting, which formats written-out numbers, dates, times, etc. */
|
|
59
|
-
smartFormat:
|
|
40
|
+
smartFormat: z2.boolean().nullish(),
|
|
60
41
|
/** Whether to add punctuation to the transcript. */
|
|
61
|
-
punctuate:
|
|
42
|
+
punctuate: z2.boolean().nullish(),
|
|
62
43
|
/** Whether to format the transcript into paragraphs. */
|
|
63
|
-
paragraphs:
|
|
44
|
+
paragraphs: z2.boolean().nullish(),
|
|
64
45
|
/** Whether to generate a summary of the transcript. Use 'v2' for the latest version or false to disable. */
|
|
65
|
-
summarize:
|
|
46
|
+
summarize: z2.union([z2.literal("v2"), z2.literal(false)]).nullish(),
|
|
66
47
|
/** Whether to identify topics in the transcript. */
|
|
67
|
-
topics:
|
|
48
|
+
topics: z2.boolean().nullish(),
|
|
68
49
|
/** Whether to identify intents in the transcript. */
|
|
69
|
-
intents:
|
|
50
|
+
intents: z2.boolean().nullish(),
|
|
70
51
|
/** Whether to analyze sentiment in the transcript. */
|
|
71
|
-
sentiment:
|
|
52
|
+
sentiment: z2.boolean().nullish(),
|
|
72
53
|
/** Whether to detect and tag named entities in the transcript. */
|
|
73
|
-
detectEntities:
|
|
54
|
+
detectEntities: z2.boolean().nullish(),
|
|
74
55
|
/** Specify terms or patterns to redact from the transcript. Can be a string or array of strings. */
|
|
75
|
-
redact:
|
|
56
|
+
redact: z2.union([z2.string(), z2.array(z2.string())]).nullish(),
|
|
76
57
|
/** String to replace redacted content with. */
|
|
77
|
-
replace:
|
|
58
|
+
replace: z2.string().nullish(),
|
|
78
59
|
/** Term or phrase to search for in the transcript. */
|
|
79
|
-
search:
|
|
60
|
+
search: z2.string().nullish(),
|
|
80
61
|
/** Key term to identify in the transcript. */
|
|
81
|
-
keyterm:
|
|
62
|
+
keyterm: z2.string().nullish(),
|
|
82
63
|
/** Whether to identify different speakers in the audio. */
|
|
83
|
-
diarize:
|
|
64
|
+
diarize: z2.boolean().nullish(),
|
|
84
65
|
/** Whether to segment the transcript into utterances. */
|
|
85
|
-
utterances:
|
|
66
|
+
utterances: z2.boolean().nullish(),
|
|
86
67
|
/** Minimum duration of silence (in seconds) to trigger a new utterance. */
|
|
87
|
-
uttSplit:
|
|
68
|
+
uttSplit: z2.number().nullish(),
|
|
88
69
|
/** Whether to include filler words (um, uh, etc.) in the transcript. */
|
|
89
|
-
fillerWords:
|
|
70
|
+
fillerWords: z2.boolean().nullish()
|
|
90
71
|
});
|
|
91
72
|
var DeepgramTranscriptionModel = class {
|
|
92
73
|
constructor(modelId, config) {
|
|
93
74
|
this.modelId = modelId;
|
|
94
75
|
this.config = config;
|
|
95
|
-
this.specificationVersion = "
|
|
76
|
+
this.specificationVersion = "v4";
|
|
96
77
|
}
|
|
97
78
|
get provider() {
|
|
98
79
|
return this.config.provider;
|
|
@@ -102,7 +83,7 @@ var DeepgramTranscriptionModel = class {
|
|
|
102
83
|
}) {
|
|
103
84
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
104
85
|
const warnings = [];
|
|
105
|
-
const deepgramOptions = await
|
|
86
|
+
const deepgramOptions = await parseProviderOptions({
|
|
106
87
|
provider: "deepgram",
|
|
107
88
|
providerOptions,
|
|
108
89
|
schema: deepgramTranscriptionModelOptionsSchema
|
|
@@ -147,13 +128,13 @@ var DeepgramTranscriptionModel = class {
|
|
|
147
128
|
value: response,
|
|
148
129
|
responseHeaders,
|
|
149
130
|
rawValue: rawResponse
|
|
150
|
-
} = await
|
|
131
|
+
} = await postToApi({
|
|
151
132
|
url: this.config.url({
|
|
152
133
|
path: "/v1/listen",
|
|
153
134
|
modelId: this.modelId
|
|
154
135
|
}) + "?" + queryParams.toString(),
|
|
155
136
|
headers: {
|
|
156
|
-
...
|
|
137
|
+
...combineHeaders(this.config.headers(), options.headers),
|
|
157
138
|
"Content-Type": options.mediaType
|
|
158
139
|
},
|
|
159
140
|
body: {
|
|
@@ -161,7 +142,7 @@ var DeepgramTranscriptionModel = class {
|
|
|
161
142
|
values: options.audio
|
|
162
143
|
},
|
|
163
144
|
failedResponseHandler: deepgramFailedResponseHandler,
|
|
164
|
-
successfulResponseHandler:
|
|
145
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
165
146
|
deepgramTranscriptionResponseSchema
|
|
166
147
|
),
|
|
167
148
|
abortSignal: options.abortSignal,
|
|
@@ -186,22 +167,22 @@ var DeepgramTranscriptionModel = class {
|
|
|
186
167
|
};
|
|
187
168
|
}
|
|
188
169
|
};
|
|
189
|
-
var deepgramTranscriptionResponseSchema =
|
|
190
|
-
metadata:
|
|
191
|
-
duration:
|
|
170
|
+
var deepgramTranscriptionResponseSchema = z2.object({
|
|
171
|
+
metadata: z2.object({
|
|
172
|
+
duration: z2.number()
|
|
192
173
|
}).nullish(),
|
|
193
|
-
results:
|
|
194
|
-
channels:
|
|
195
|
-
|
|
196
|
-
detected_language:
|
|
197
|
-
alternatives:
|
|
198
|
-
|
|
199
|
-
transcript:
|
|
200
|
-
words:
|
|
201
|
-
|
|
202
|
-
word:
|
|
203
|
-
start:
|
|
204
|
-
end:
|
|
174
|
+
results: z2.object({
|
|
175
|
+
channels: z2.array(
|
|
176
|
+
z2.object({
|
|
177
|
+
detected_language: z2.string().nullish(),
|
|
178
|
+
alternatives: z2.array(
|
|
179
|
+
z2.object({
|
|
180
|
+
transcript: z2.string(),
|
|
181
|
+
words: z2.array(
|
|
182
|
+
z2.object({
|
|
183
|
+
word: z2.string(),
|
|
184
|
+
start: z2.number(),
|
|
185
|
+
end: z2.number()
|
|
205
186
|
})
|
|
206
187
|
)
|
|
207
188
|
})
|
|
@@ -212,31 +193,36 @@ var deepgramTranscriptionResponseSchema = import_v42.z.object({
|
|
|
212
193
|
});
|
|
213
194
|
|
|
214
195
|
// src/deepgram-speech-model.ts
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
196
|
+
import {
|
|
197
|
+
combineHeaders as combineHeaders2,
|
|
198
|
+
createBinaryResponseHandler,
|
|
199
|
+
parseProviderOptions as parseProviderOptions2,
|
|
200
|
+
postJsonToApi
|
|
201
|
+
} from "@ai-sdk/provider-utils";
|
|
202
|
+
import { z as z3 } from "zod/v4";
|
|
203
|
+
var deepgramSpeechModelOptionsSchema = z3.object({
|
|
218
204
|
/** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */
|
|
219
|
-
bitRate:
|
|
205
|
+
bitRate: z3.union([z3.number(), z3.string()]).nullish(),
|
|
220
206
|
/** Container format for the output audio (mp3, wav, etc.). */
|
|
221
|
-
container:
|
|
207
|
+
container: z3.string().nullish(),
|
|
222
208
|
/** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */
|
|
223
|
-
encoding:
|
|
209
|
+
encoding: z3.string().nullish(),
|
|
224
210
|
/** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */
|
|
225
|
-
sampleRate:
|
|
211
|
+
sampleRate: z3.number().nullish(),
|
|
226
212
|
/** URL to which we'll make the callback request. */
|
|
227
|
-
callback:
|
|
213
|
+
callback: z3.string().url().nullish(),
|
|
228
214
|
/** HTTP method by which the callback request will be made (POST or PUT). */
|
|
229
|
-
callbackMethod:
|
|
215
|
+
callbackMethod: z3.enum(["POST", "PUT"]).nullish(),
|
|
230
216
|
/** Opts out requests from the Deepgram Model Improvement Program. */
|
|
231
|
-
mipOptOut:
|
|
217
|
+
mipOptOut: z3.boolean().nullish(),
|
|
232
218
|
/** Label your requests for the purpose of identification during usage reporting. */
|
|
233
|
-
tag:
|
|
219
|
+
tag: z3.union([z3.string(), z3.array(z3.string())]).nullish()
|
|
234
220
|
});
|
|
235
221
|
var DeepgramSpeechModel = class {
|
|
236
222
|
constructor(modelId, config) {
|
|
237
223
|
this.modelId = modelId;
|
|
238
224
|
this.config = config;
|
|
239
|
-
this.specificationVersion = "
|
|
225
|
+
this.specificationVersion = "v4";
|
|
240
226
|
}
|
|
241
227
|
get provider() {
|
|
242
228
|
return this.config.provider;
|
|
@@ -252,7 +238,7 @@ var DeepgramSpeechModel = class {
|
|
|
252
238
|
}) {
|
|
253
239
|
var _a, _b, _c;
|
|
254
240
|
const warnings = [];
|
|
255
|
-
const deepgramOptions = await (
|
|
241
|
+
const deepgramOptions = await parseProviderOptions2({
|
|
256
242
|
provider: "deepgram",
|
|
257
243
|
providerOptions,
|
|
258
244
|
schema: deepgramSpeechModelOptionsSchema
|
|
@@ -560,7 +546,7 @@ var DeepgramSpeechModel = class {
|
|
|
560
546
|
value: audio,
|
|
561
547
|
responseHeaders,
|
|
562
548
|
rawValue: rawResponse
|
|
563
|
-
} = await
|
|
549
|
+
} = await postJsonToApi({
|
|
564
550
|
url: (() => {
|
|
565
551
|
const baseUrl = this.config.url({
|
|
566
552
|
path: "/v1/speak",
|
|
@@ -569,10 +555,10 @@ var DeepgramSpeechModel = class {
|
|
|
569
555
|
const queryString = new URLSearchParams(queryParams).toString();
|
|
570
556
|
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
571
557
|
})(),
|
|
572
|
-
headers: (
|
|
558
|
+
headers: combineHeaders2(this.config.headers(), options.headers),
|
|
573
559
|
body: requestBody,
|
|
574
560
|
failedResponseHandler: deepgramFailedResponseHandler,
|
|
575
|
-
successfulResponseHandler:
|
|
561
|
+
successfulResponseHandler: createBinaryResponseHandler(),
|
|
576
562
|
abortSignal: options.abortSignal,
|
|
577
563
|
fetch: this.config.fetch
|
|
578
564
|
});
|
|
@@ -593,13 +579,13 @@ var DeepgramSpeechModel = class {
|
|
|
593
579
|
};
|
|
594
580
|
|
|
595
581
|
// src/version.ts
|
|
596
|
-
var VERSION = true ? "3.0.0-beta.
|
|
582
|
+
var VERSION = true ? "3.0.0-beta.20" : "0.0.0-test";
|
|
597
583
|
|
|
598
584
|
// src/deepgram-provider.ts
|
|
599
585
|
function createDeepgram(options = {}) {
|
|
600
|
-
const getHeaders = () =>
|
|
586
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
601
587
|
{
|
|
602
|
-
authorization: `Token ${
|
|
588
|
+
authorization: `Token ${loadApiKey({
|
|
603
589
|
apiKey: options.apiKey,
|
|
604
590
|
environmentVariableName: "DEEPGRAM_API_KEY",
|
|
605
591
|
description: "Deepgram"
|
|
@@ -625,20 +611,20 @@ function createDeepgram(options = {}) {
|
|
|
625
611
|
transcription: createTranscriptionModel(modelId)
|
|
626
612
|
};
|
|
627
613
|
};
|
|
628
|
-
provider.specificationVersion = "
|
|
614
|
+
provider.specificationVersion = "v4";
|
|
629
615
|
provider.transcription = createTranscriptionModel;
|
|
630
616
|
provider.transcriptionModel = createTranscriptionModel;
|
|
631
617
|
provider.speech = createSpeechModel;
|
|
632
618
|
provider.speechModel = createSpeechModel;
|
|
633
619
|
provider.languageModel = (modelId) => {
|
|
634
|
-
throw new
|
|
620
|
+
throw new NoSuchModelError({
|
|
635
621
|
modelId,
|
|
636
622
|
modelType: "languageModel",
|
|
637
623
|
message: "Deepgram does not provide language models"
|
|
638
624
|
});
|
|
639
625
|
};
|
|
640
626
|
provider.embeddingModel = (modelId) => {
|
|
641
|
-
throw new
|
|
627
|
+
throw new NoSuchModelError({
|
|
642
628
|
modelId,
|
|
643
629
|
modelType: "embeddingModel",
|
|
644
630
|
message: "Deepgram does not provide text embedding models"
|
|
@@ -646,7 +632,7 @@ function createDeepgram(options = {}) {
|
|
|
646
632
|
};
|
|
647
633
|
provider.textEmbeddingModel = provider.embeddingModel;
|
|
648
634
|
provider.imageModel = (modelId) => {
|
|
649
|
-
throw new
|
|
635
|
+
throw new NoSuchModelError({
|
|
650
636
|
modelId,
|
|
651
637
|
modelType: "imageModel",
|
|
652
638
|
message: "Deepgram does not provide image models"
|
|
@@ -655,11 +641,10 @@ function createDeepgram(options = {}) {
|
|
|
655
641
|
return provider;
|
|
656
642
|
}
|
|
657
643
|
var deepgram = createDeepgram();
|
|
658
|
-
|
|
659
|
-
0 && (module.exports = {
|
|
644
|
+
export {
|
|
660
645
|
DeepgramSpeechModel,
|
|
661
646
|
VERSION,
|
|
662
647
|
createDeepgram,
|
|
663
648
|
deepgram
|
|
664
|
-
}
|
|
649
|
+
};
|
|
665
650
|
//# sourceMappingURL=index.js.map
|