@ai-sdk/deepgram 2.0.67 → 2.0.68
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 +9 -0
- package/dist/index.d.mts +34 -37
- package/dist/index.d.ts +34 -37
- package/dist/index.js +97 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/deepgram-error.ts +17 -8
- package/src/deepgram-speech-model.ts +27 -20
- package/src/deepgram-transcription-model.ts +73 -62
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @ai-sdk/deepgram
|
|
2
2
|
|
|
3
|
+
## 2.0.68
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4581b06: Defer validation schema construction until first use to reduce provider import time.
|
|
8
|
+
- Updated dependencies [1183cc4]
|
|
9
|
+
- Updated dependencies [d726591]
|
|
10
|
+
- @ai-sdk/provider-utils@4.0.62
|
|
11
|
+
|
|
3
12
|
## 2.0.67
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TranscriptionModelV3, ProviderV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
+
import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
5
|
type DeepgramConfig = {
|
|
6
6
|
provider: string;
|
|
@@ -15,27 +15,27 @@ type DeepgramConfig = {
|
|
|
15
15
|
|
|
16
16
|
type DeepgramTranscriptionModelId = 'base' | 'base-general' | 'base-meeting' | 'base-phonecall' | 'base-finance' | 'base-conversationalai' | 'base-voicemail' | 'base-video' | 'enhanced' | 'enhanced-general' | 'enhanced-meeting' | 'enhanced-phonecall' | 'enhanced-finance' | 'nova' | 'nova-general' | 'nova-phonecall' | 'nova-medical' | 'nova-2' | 'nova-2-general' | 'nova-2-meeting' | 'nova-2-phonecall' | 'nova-2-finance' | 'nova-2-conversationalai' | 'nova-2-voicemail' | 'nova-2-video' | 'nova-2-medical' | 'nova-2-drivethru' | 'nova-2-automotive' | 'nova-2-atc' | 'nova-3' | 'nova-3-general' | 'nova-3-medical' | (string & {});
|
|
17
17
|
|
|
18
|
-
declare const deepgramTranscriptionModelOptionsSchema:
|
|
19
|
-
language
|
|
20
|
-
detectLanguage
|
|
21
|
-
smartFormat
|
|
22
|
-
punctuate
|
|
23
|
-
paragraphs
|
|
24
|
-
summarize
|
|
25
|
-
topics
|
|
26
|
-
intents
|
|
27
|
-
sentiment
|
|
28
|
-
detectEntities
|
|
29
|
-
redact
|
|
30
|
-
replace
|
|
31
|
-
search
|
|
32
|
-
keyterm
|
|
33
|
-
diarize
|
|
34
|
-
utterances
|
|
35
|
-
uttSplit
|
|
36
|
-
fillerWords
|
|
37
|
-
}
|
|
38
|
-
type DeepgramTranscriptionModelOptions =
|
|
18
|
+
declare const deepgramTranscriptionModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
19
|
+
language?: string | null | undefined;
|
|
20
|
+
detectLanguage?: boolean | null | undefined;
|
|
21
|
+
smartFormat?: boolean | null | undefined;
|
|
22
|
+
punctuate?: boolean | null | undefined;
|
|
23
|
+
paragraphs?: boolean | null | undefined;
|
|
24
|
+
summarize?: false | "v2" | null | undefined;
|
|
25
|
+
topics?: boolean | null | undefined;
|
|
26
|
+
intents?: boolean | null | undefined;
|
|
27
|
+
sentiment?: boolean | null | undefined;
|
|
28
|
+
detectEntities?: boolean | null | undefined;
|
|
29
|
+
redact?: string | string[] | null | undefined;
|
|
30
|
+
replace?: string | null | undefined;
|
|
31
|
+
search?: string | null | undefined;
|
|
32
|
+
keyterm?: string | null | undefined;
|
|
33
|
+
diarize?: boolean | null | undefined;
|
|
34
|
+
utterances?: boolean | null | undefined;
|
|
35
|
+
uttSplit?: number | null | undefined;
|
|
36
|
+
fillerWords?: boolean | null | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
type DeepgramTranscriptionModelOptions = InferSchema<typeof deepgramTranscriptionModelOptionsSchema>;
|
|
39
39
|
interface DeepgramTranscriptionModelConfig extends DeepgramConfig {
|
|
40
40
|
_internal?: {
|
|
41
41
|
currentDate?: () => Date;
|
|
@@ -94,20 +94,17 @@ declare function createDeepgram(options?: DeepgramProviderSettings): DeepgramPro
|
|
|
94
94
|
*/
|
|
95
95
|
declare const deepgram: DeepgramProvider;
|
|
96
96
|
|
|
97
|
-
declare const deepgramSpeechModelOptionsSchema:
|
|
98
|
-
bitRate
|
|
99
|
-
container
|
|
100
|
-
encoding
|
|
101
|
-
sampleRate
|
|
102
|
-
callback
|
|
103
|
-
callbackMethod
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
tag: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
109
|
-
}, z.core.$strip>;
|
|
110
|
-
type DeepgramSpeechModelOptions = z.infer<typeof deepgramSpeechModelOptionsSchema>;
|
|
97
|
+
declare const deepgramSpeechModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
98
|
+
bitRate?: string | number | null | undefined;
|
|
99
|
+
container?: string | null | undefined;
|
|
100
|
+
encoding?: string | null | undefined;
|
|
101
|
+
sampleRate?: number | null | undefined;
|
|
102
|
+
callback?: string | null | undefined;
|
|
103
|
+
callbackMethod?: "POST" | "PUT" | null | undefined;
|
|
104
|
+
mipOptOut?: boolean | null | undefined;
|
|
105
|
+
tag?: string | string[] | null | undefined;
|
|
106
|
+
}>;
|
|
107
|
+
type DeepgramSpeechModelOptions = InferSchema<typeof deepgramSpeechModelOptionsSchema>;
|
|
111
108
|
interface DeepgramSpeechModelConfig extends DeepgramConfig {
|
|
112
109
|
_internal?: {
|
|
113
110
|
currentDate?: () => Date;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TranscriptionModelV3, ProviderV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
+
import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
5
|
type DeepgramConfig = {
|
|
6
6
|
provider: string;
|
|
@@ -15,27 +15,27 @@ type DeepgramConfig = {
|
|
|
15
15
|
|
|
16
16
|
type DeepgramTranscriptionModelId = 'base' | 'base-general' | 'base-meeting' | 'base-phonecall' | 'base-finance' | 'base-conversationalai' | 'base-voicemail' | 'base-video' | 'enhanced' | 'enhanced-general' | 'enhanced-meeting' | 'enhanced-phonecall' | 'enhanced-finance' | 'nova' | 'nova-general' | 'nova-phonecall' | 'nova-medical' | 'nova-2' | 'nova-2-general' | 'nova-2-meeting' | 'nova-2-phonecall' | 'nova-2-finance' | 'nova-2-conversationalai' | 'nova-2-voicemail' | 'nova-2-video' | 'nova-2-medical' | 'nova-2-drivethru' | 'nova-2-automotive' | 'nova-2-atc' | 'nova-3' | 'nova-3-general' | 'nova-3-medical' | (string & {});
|
|
17
17
|
|
|
18
|
-
declare const deepgramTranscriptionModelOptionsSchema:
|
|
19
|
-
language
|
|
20
|
-
detectLanguage
|
|
21
|
-
smartFormat
|
|
22
|
-
punctuate
|
|
23
|
-
paragraphs
|
|
24
|
-
summarize
|
|
25
|
-
topics
|
|
26
|
-
intents
|
|
27
|
-
sentiment
|
|
28
|
-
detectEntities
|
|
29
|
-
redact
|
|
30
|
-
replace
|
|
31
|
-
search
|
|
32
|
-
keyterm
|
|
33
|
-
diarize
|
|
34
|
-
utterances
|
|
35
|
-
uttSplit
|
|
36
|
-
fillerWords
|
|
37
|
-
}
|
|
38
|
-
type DeepgramTranscriptionModelOptions =
|
|
18
|
+
declare const deepgramTranscriptionModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
19
|
+
language?: string | null | undefined;
|
|
20
|
+
detectLanguage?: boolean | null | undefined;
|
|
21
|
+
smartFormat?: boolean | null | undefined;
|
|
22
|
+
punctuate?: boolean | null | undefined;
|
|
23
|
+
paragraphs?: boolean | null | undefined;
|
|
24
|
+
summarize?: false | "v2" | null | undefined;
|
|
25
|
+
topics?: boolean | null | undefined;
|
|
26
|
+
intents?: boolean | null | undefined;
|
|
27
|
+
sentiment?: boolean | null | undefined;
|
|
28
|
+
detectEntities?: boolean | null | undefined;
|
|
29
|
+
redact?: string | string[] | null | undefined;
|
|
30
|
+
replace?: string | null | undefined;
|
|
31
|
+
search?: string | null | undefined;
|
|
32
|
+
keyterm?: string | null | undefined;
|
|
33
|
+
diarize?: boolean | null | undefined;
|
|
34
|
+
utterances?: boolean | null | undefined;
|
|
35
|
+
uttSplit?: number | null | undefined;
|
|
36
|
+
fillerWords?: boolean | null | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
type DeepgramTranscriptionModelOptions = InferSchema<typeof deepgramTranscriptionModelOptionsSchema>;
|
|
39
39
|
interface DeepgramTranscriptionModelConfig extends DeepgramConfig {
|
|
40
40
|
_internal?: {
|
|
41
41
|
currentDate?: () => Date;
|
|
@@ -94,20 +94,17 @@ declare function createDeepgram(options?: DeepgramProviderSettings): DeepgramPro
|
|
|
94
94
|
*/
|
|
95
95
|
declare const deepgram: DeepgramProvider;
|
|
96
96
|
|
|
97
|
-
declare const deepgramSpeechModelOptionsSchema:
|
|
98
|
-
bitRate
|
|
99
|
-
container
|
|
100
|
-
encoding
|
|
101
|
-
sampleRate
|
|
102
|
-
callback
|
|
103
|
-
callbackMethod
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
tag: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
|
|
109
|
-
}, z.core.$strip>;
|
|
110
|
-
type DeepgramSpeechModelOptions = z.infer<typeof deepgramSpeechModelOptionsSchema>;
|
|
97
|
+
declare const deepgramSpeechModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
98
|
+
bitRate?: string | number | null | undefined;
|
|
99
|
+
container?: string | null | undefined;
|
|
100
|
+
encoding?: string | null | undefined;
|
|
101
|
+
sampleRate?: number | null | undefined;
|
|
102
|
+
callback?: string | null | undefined;
|
|
103
|
+
callbackMethod?: "POST" | "PUT" | null | undefined;
|
|
104
|
+
mipOptOut?: boolean | null | undefined;
|
|
105
|
+
tag?: string | string[] | null | undefined;
|
|
106
|
+
}>;
|
|
107
|
+
type DeepgramSpeechModelOptions = InferSchema<typeof deepgramSpeechModelOptionsSchema>;
|
|
111
108
|
interface DeepgramSpeechModelConfig extends DeepgramConfig {
|
|
112
109
|
_internal?: {
|
|
113
110
|
currentDate?: () => Date;
|
package/dist/index.js
CHANGED
|
@@ -38,56 +38,64 @@ var import_v42 = require("zod/v4");
|
|
|
38
38
|
// src/deepgram-error.ts
|
|
39
39
|
var import_v4 = require("zod/v4");
|
|
40
40
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
41
|
-
var deepgramErrorDataSchema =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
var deepgramErrorDataSchema = (0, import_provider_utils.lazySchema)(
|
|
42
|
+
() => (0, import_provider_utils.zodSchema)(
|
|
43
|
+
import_v4.z.object({
|
|
44
|
+
error: import_v4.z.object({
|
|
45
|
+
message: import_v4.z.string(),
|
|
46
|
+
code: import_v4.z.number()
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
)
|
|
50
|
+
);
|
|
47
51
|
var deepgramFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
|
|
48
52
|
errorSchema: deepgramErrorDataSchema,
|
|
49
53
|
errorToMessage: (data) => data.error.message
|
|
50
54
|
});
|
|
51
55
|
|
|
52
56
|
// src/deepgram-transcription-model.ts
|
|
53
|
-
var deepgramTranscriptionModelOptionsSchema =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
57
|
+
var deepgramTranscriptionModelOptionsSchema = (0, import_provider_utils2.lazySchema)(
|
|
58
|
+
() => (0, import_provider_utils2.zodSchema)(
|
|
59
|
+
import_v42.z.object({
|
|
60
|
+
/** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */
|
|
61
|
+
language: import_v42.z.string().nullish(),
|
|
62
|
+
/** Whether to enable automatic language detection. When true, Deepgram will detect the language of the audio. */
|
|
63
|
+
detectLanguage: import_v42.z.boolean().nullish(),
|
|
64
|
+
/** Whether to use smart formatting, which formats written-out numbers, dates, times, etc. */
|
|
65
|
+
smartFormat: import_v42.z.boolean().nullish(),
|
|
66
|
+
/** Whether to add punctuation to the transcript. */
|
|
67
|
+
punctuate: import_v42.z.boolean().nullish(),
|
|
68
|
+
/** Whether to format the transcript into paragraphs. */
|
|
69
|
+
paragraphs: import_v42.z.boolean().nullish(),
|
|
70
|
+
/** Whether to generate a summary of the transcript. Use 'v2' for the latest version or false to disable. */
|
|
71
|
+
summarize: import_v42.z.union([import_v42.z.literal("v2"), import_v42.z.literal(false)]).nullish(),
|
|
72
|
+
/** Whether to identify topics in the transcript. */
|
|
73
|
+
topics: import_v42.z.boolean().nullish(),
|
|
74
|
+
/** Whether to identify intents in the transcript. */
|
|
75
|
+
intents: import_v42.z.boolean().nullish(),
|
|
76
|
+
/** Whether to analyze sentiment in the transcript. */
|
|
77
|
+
sentiment: import_v42.z.boolean().nullish(),
|
|
78
|
+
/** Whether to detect and tag named entities in the transcript. */
|
|
79
|
+
detectEntities: import_v42.z.boolean().nullish(),
|
|
80
|
+
/** Specify terms or patterns to redact from the transcript. Can be a string or array of strings. */
|
|
81
|
+
redact: import_v42.z.union([import_v42.z.string(), import_v42.z.array(import_v42.z.string())]).nullish(),
|
|
82
|
+
/** String to replace redacted content with. */
|
|
83
|
+
replace: import_v42.z.string().nullish(),
|
|
84
|
+
/** Term or phrase to search for in the transcript. */
|
|
85
|
+
search: import_v42.z.string().nullish(),
|
|
86
|
+
/** Key term to identify in the transcript. */
|
|
87
|
+
keyterm: import_v42.z.string().nullish(),
|
|
88
|
+
/** Whether to identify different speakers in the audio. */
|
|
89
|
+
diarize: import_v42.z.boolean().nullish(),
|
|
90
|
+
/** Whether to segment the transcript into utterances. */
|
|
91
|
+
utterances: import_v42.z.boolean().nullish(),
|
|
92
|
+
/** Minimum duration of silence (in seconds) to trigger a new utterance. */
|
|
93
|
+
uttSplit: import_v42.z.number().nullish(),
|
|
94
|
+
/** Whether to include filler words (um, uh, etc.) in the transcript. */
|
|
95
|
+
fillerWords: import_v42.z.boolean().nullish()
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
);
|
|
91
99
|
var DeepgramTranscriptionModel = class {
|
|
92
100
|
constructor(modelId, config) {
|
|
93
101
|
this.modelId = modelId;
|
|
@@ -186,52 +194,60 @@ var DeepgramTranscriptionModel = class {
|
|
|
186
194
|
};
|
|
187
195
|
}
|
|
188
196
|
};
|
|
189
|
-
var deepgramTranscriptionResponseSchema =
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
import_v42.z.object({
|
|
196
|
-
|
|
197
|
-
alternatives: import_v42.z.array(
|
|
197
|
+
var deepgramTranscriptionResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
198
|
+
() => (0, import_provider_utils2.zodSchema)(
|
|
199
|
+
import_v42.z.object({
|
|
200
|
+
metadata: import_v42.z.object({
|
|
201
|
+
duration: import_v42.z.number()
|
|
202
|
+
}).nullish(),
|
|
203
|
+
results: import_v42.z.object({
|
|
204
|
+
channels: import_v42.z.array(
|
|
198
205
|
import_v42.z.object({
|
|
199
|
-
|
|
200
|
-
|
|
206
|
+
detected_language: import_v42.z.string().nullish(),
|
|
207
|
+
alternatives: import_v42.z.array(
|
|
201
208
|
import_v42.z.object({
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
transcript: import_v42.z.string(),
|
|
210
|
+
words: import_v42.z.array(
|
|
211
|
+
import_v42.z.object({
|
|
212
|
+
word: import_v42.z.string(),
|
|
213
|
+
start: import_v42.z.number(),
|
|
214
|
+
end: import_v42.z.number()
|
|
215
|
+
})
|
|
216
|
+
)
|
|
205
217
|
})
|
|
206
218
|
)
|
|
207
219
|
})
|
|
208
220
|
)
|
|
209
|
-
})
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
|
|
221
|
+
}).nullish()
|
|
222
|
+
})
|
|
223
|
+
)
|
|
224
|
+
);
|
|
213
225
|
|
|
214
226
|
// src/deepgram-speech-model.ts
|
|
215
227
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
216
228
|
var import_v43 = require("zod/v4");
|
|
217
|
-
var deepgramSpeechModelOptionsSchema =
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
var deepgramSpeechModelOptionsSchema = (0, import_provider_utils3.lazySchema)(
|
|
230
|
+
() => (0, import_provider_utils3.zodSchema)(
|
|
231
|
+
import_v43.z.object({
|
|
232
|
+
/** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */
|
|
233
|
+
bitRate: import_v43.z.union([import_v43.z.number(), import_v43.z.string()]).nullish(),
|
|
234
|
+
/** Container format for the output audio (mp3, wav, etc.). */
|
|
235
|
+
container: import_v43.z.string().nullish(),
|
|
236
|
+
/** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */
|
|
237
|
+
encoding: import_v43.z.string().nullish(),
|
|
238
|
+
/** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */
|
|
239
|
+
sampleRate: import_v43.z.number().nullish(),
|
|
240
|
+
/** URL to which we'll make the callback request. */
|
|
241
|
+
callback: import_v43.z.string().url().nullish(),
|
|
242
|
+
/** HTTP method by which the callback request will be made (POST or PUT). */
|
|
243
|
+
callbackMethod: import_v43.z.enum(["POST", "PUT"]).nullish(),
|
|
244
|
+
/** Opts out requests from the Deepgram Model Improvement Program. */
|
|
245
|
+
mipOptOut: import_v43.z.boolean().nullish(),
|
|
246
|
+
/** Label your requests for the purpose of identification during usage reporting. */
|
|
247
|
+
tag: import_v43.z.union([import_v43.z.string(), import_v43.z.array(import_v43.z.string())]).nullish()
|
|
248
|
+
})
|
|
249
|
+
)
|
|
250
|
+
);
|
|
235
251
|
var DeepgramSpeechModel = class {
|
|
236
252
|
constructor(modelId, config) {
|
|
237
253
|
this.modelId = modelId;
|
|
@@ -593,7 +609,7 @@ var DeepgramSpeechModel = class {
|
|
|
593
609
|
};
|
|
594
610
|
|
|
595
611
|
// src/version.ts
|
|
596
|
-
var VERSION = true ? "2.0.
|
|
612
|
+
var VERSION = true ? "2.0.68" : "0.0.0-test";
|
|
597
613
|
|
|
598
614
|
// src/deepgram-provider.ts
|
|
599
615
|
function createDeepgram(options = {}) {
|