@ai-sdk/deepgram 3.0.0-beta.30 → 3.0.0-beta.31

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/deepgram
2
2
 
3
+ ## 3.0.0-beta.31
4
+
5
+ ### Major Changes
6
+
7
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
8
+
9
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [08d2129]
14
+ - @ai-sdk/provider-utils@5.0.0-beta.30
15
+
3
16
  ## 3.0.0-beta.30
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -16,27 +16,6 @@ type DeepgramConfig = {
16
16
 
17
17
  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 & {});
18
18
 
19
- declare const deepgramTranscriptionModelOptionsSchema: z.ZodObject<{
20
- language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
- detectLanguage: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
22
- smartFormat: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
23
- punctuate: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
24
- paragraphs: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
25
- summarize: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"v2">, z.ZodLiteral<false>]>>>;
26
- topics: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
27
- intents: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
28
- sentiment: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
29
- detectEntities: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
30
- redact: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
31
- replace: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
- search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
- keyterm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
- diarize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
35
- utterances: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
36
- uttSplit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
37
- fillerWords: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
38
- }, z.core.$strip>;
39
- type DeepgramTranscriptionModelOptions = z.infer<typeof deepgramTranscriptionModelOptionsSchema>;
40
19
  interface DeepgramTranscriptionModelConfig extends DeepgramConfig {
41
20
  _internal?: {
42
21
  currentDate?: () => Date;
@@ -103,20 +82,6 @@ declare function createDeepgram(options?: DeepgramProviderSettings): DeepgramPro
103
82
  */
104
83
  declare const deepgram: DeepgramProvider;
105
84
 
106
- declare const deepgramSpeechModelOptionsSchema: z.ZodObject<{
107
- bitRate: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
108
- container: z.ZodOptional<z.ZodNullable<z.ZodString>>;
109
- encoding: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
- sampleRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
111
- callback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
- callbackMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
113
- POST: "POST";
114
- PUT: "PUT";
115
- }>>>;
116
- mipOptOut: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
117
- tag: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
118
- }, z.core.$strip>;
119
- type DeepgramSpeechModelOptions = z.infer<typeof deepgramSpeechModelOptionsSchema>;
120
85
  interface DeepgramSpeechModelConfig extends DeepgramConfig {
121
86
  _internal?: {
122
87
  currentDate?: () => Date;
@@ -140,6 +105,43 @@ declare class DeepgramSpeechModel implements SpeechModelV4 {
140
105
  doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
141
106
  }
142
107
 
108
+ declare const deepgramSpeechModelOptionsSchema: z.ZodObject<{
109
+ bitRate: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>;
110
+ container: z.ZodOptional<z.ZodNullable<z.ZodString>>;
111
+ encoding: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ sampleRate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
113
+ callback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
+ callbackMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
115
+ POST: "POST";
116
+ PUT: "PUT";
117
+ }>>>;
118
+ mipOptOut: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
119
+ tag: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
120
+ }, z.core.$strip>;
121
+ type DeepgramSpeechModelOptions = z.infer<typeof deepgramSpeechModelOptionsSchema>;
122
+
123
+ declare const deepgramTranscriptionModelOptionsSchema: z.ZodObject<{
124
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
+ detectLanguage: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
126
+ smartFormat: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
127
+ punctuate: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
128
+ paragraphs: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
129
+ summarize: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<"v2">, z.ZodLiteral<false>]>>>;
130
+ topics: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
131
+ intents: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
132
+ sentiment: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
133
+ detectEntities: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
134
+ redact: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
135
+ replace: z.ZodOptional<z.ZodNullable<z.ZodString>>;
136
+ search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
+ keyterm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ diarize: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
139
+ utterances: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
140
+ uttSplit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
141
+ fillerWords: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
142
+ }, z.core.$strip>;
143
+ type DeepgramTranscriptionModelOptions = z.infer<typeof deepgramTranscriptionModelOptionsSchema>;
144
+
143
145
  declare const VERSION: string;
144
146
 
145
147
  export { type DeepgramProvider, type DeepgramProviderSettings, type DeepgramSpeechModelOptions as DeepgramSpeechCallOptions, DeepgramSpeechModel, type DeepgramSpeechModelId, type DeepgramSpeechModelOptions, type DeepgramTranscriptionModelOptions, VERSION, createDeepgram, deepgram };
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  WORKFLOW_SERIALIZE,
18
18
  WORKFLOW_DESERIALIZE
19
19
  } from "@ai-sdk/provider-utils";
20
- import { z as z2 } from "zod/v4";
20
+ import { z as z3 } from "zod/v4";
21
21
 
22
22
  // src/deepgram-error.ts
23
23
  import { z } from "zod/v4";
@@ -33,7 +33,8 @@ var deepgramFailedResponseHandler = createJsonErrorResponseHandler({
33
33
  errorToMessage: (data) => data.error.message
34
34
  });
35
35
 
36
- // src/deepgram-transcription-model.ts
36
+ // src/deepgram-transcription-model-options.ts
37
+ import { z as z2 } from "zod/v4";
37
38
  var deepgramTranscriptionModelOptionsSchema = z2.object({
38
39
  /** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */
39
40
  language: z2.string().nullish(),
@@ -72,6 +73,8 @@ var deepgramTranscriptionModelOptionsSchema = z2.object({
72
73
  /** Whether to include filler words (um, uh, etc.) in the transcript. */
73
74
  fillerWords: z2.boolean().nullish()
74
75
  });
76
+
77
+ // src/deepgram-transcription-model.ts
75
78
  var DeepgramTranscriptionModel = class _DeepgramTranscriptionModel {
76
79
  constructor(modelId, config) {
77
80
  this.modelId = modelId;
@@ -179,22 +182,22 @@ var DeepgramTranscriptionModel = class _DeepgramTranscriptionModel {
179
182
  };
180
183
  }
181
184
  };
182
- var deepgramTranscriptionResponseSchema = z2.object({
183
- metadata: z2.object({
184
- duration: z2.number()
185
+ var deepgramTranscriptionResponseSchema = z3.object({
186
+ metadata: z3.object({
187
+ duration: z3.number()
185
188
  }).nullish(),
186
- results: z2.object({
187
- channels: z2.array(
188
- z2.object({
189
- detected_language: z2.string().nullish(),
190
- alternatives: z2.array(
191
- z2.object({
192
- transcript: z2.string(),
193
- words: z2.array(
194
- z2.object({
195
- word: z2.string(),
196
- start: z2.number(),
197
- end: z2.number()
189
+ results: z3.object({
190
+ channels: z3.array(
191
+ z3.object({
192
+ detected_language: z3.string().nullish(),
193
+ alternatives: z3.array(
194
+ z3.object({
195
+ transcript: z3.string(),
196
+ words: z3.array(
197
+ z3.object({
198
+ word: z3.string(),
199
+ start: z3.number(),
200
+ end: z3.number()
198
201
  })
199
202
  )
200
203
  })
@@ -214,25 +217,29 @@ import {
214
217
  WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE2,
215
218
  WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE2
216
219
  } from "@ai-sdk/provider-utils";
217
- import { z as z3 } from "zod/v4";
218
- var deepgramSpeechModelOptionsSchema = z3.object({
220
+
221
+ // src/deepgram-speech-model-options.ts
222
+ import { z as z4 } from "zod/v4";
223
+ var deepgramSpeechModelOptionsSchema = z4.object({
219
224
  /** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */
220
- bitRate: z3.union([z3.number(), z3.string()]).nullish(),
225
+ bitRate: z4.union([z4.number(), z4.string()]).nullish(),
221
226
  /** Container format for the output audio (mp3, wav, etc.). */
222
- container: z3.string().nullish(),
227
+ container: z4.string().nullish(),
223
228
  /** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */
224
- encoding: z3.string().nullish(),
229
+ encoding: z4.string().nullish(),
225
230
  /** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */
226
- sampleRate: z3.number().nullish(),
231
+ sampleRate: z4.number().nullish(),
227
232
  /** URL to which we'll make the callback request. */
228
- callback: z3.string().url().nullish(),
233
+ callback: z4.string().url().nullish(),
229
234
  /** HTTP method by which the callback request will be made (POST or PUT). */
230
- callbackMethod: z3.enum(["POST", "PUT"]).nullish(),
235
+ callbackMethod: z4.enum(["POST", "PUT"]).nullish(),
231
236
  /** Opts out requests from the Deepgram Model Improvement Program. */
232
- mipOptOut: z3.boolean().nullish(),
237
+ mipOptOut: z4.boolean().nullish(),
233
238
  /** Label your requests for the purpose of identification during usage reporting. */
234
- tag: z3.union([z3.string(), z3.array(z3.string())]).nullish()
239
+ tag: z4.union([z4.string(), z4.array(z4.string())]).nullish()
235
240
  });
241
+
242
+ // src/deepgram-speech-model.ts
236
243
  var DeepgramSpeechModel = class _DeepgramSpeechModel {
237
244
  constructor(modelId, config) {
238
245
  this.modelId = modelId;
@@ -603,7 +610,7 @@ var DeepgramSpeechModel = class _DeepgramSpeechModel {
603
610
  };
604
611
 
605
612
  // src/version.ts
606
- var VERSION = true ? "3.0.0-beta.30" : "0.0.0-test";
613
+ var VERSION = true ? "3.0.0-beta.31" : "0.0.0-test";
607
614
 
608
615
  // src/deepgram-provider.ts
609
616
  function createDeepgram(options = {}) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/deepgram-provider.ts","../src/deepgram-transcription-model.ts","../src/deepgram-error.ts","../src/deepgram-speech-model.ts","../src/version.ts"],"sourcesContent":["import {\n NoSuchModelError,\n type TranscriptionModelV4,\n type SpeechModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n loadApiKey,\n withUserAgentSuffix,\n type FetchFunction,\n} from '@ai-sdk/provider-utils';\nimport { DeepgramTranscriptionModel } from './deepgram-transcription-model';\nimport type { DeepgramTranscriptionModelId } from './deepgram-transcription-options';\nimport { DeepgramSpeechModel } from './deepgram-speech-model';\nimport type { DeepgramSpeechModelId } from './deepgram-speech-options';\nimport { VERSION } from './version';\n\nexport interface DeepgramProvider extends ProviderV4 {\n (\n modelId: 'nova-3',\n settings?: {},\n ): {\n transcription: DeepgramTranscriptionModel;\n };\n\n /**\n * Creates a model for transcription.\n */\n transcription(modelId: DeepgramTranscriptionModelId): TranscriptionModelV4;\n\n /**\n * Creates a model for speech generation.\n */\n speech(modelId: DeepgramSpeechModelId): SpeechModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface DeepgramProviderSettings {\n /**\n * API key for authenticating requests.\n */\n apiKey?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create an Deepgram provider instance.\n */\nexport function createDeepgram(\n options: DeepgramProviderSettings = {},\n): DeepgramProvider {\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n authorization: `Token ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'DEEPGRAM_API_KEY',\n description: 'Deepgram',\n })}`,\n ...options.headers,\n },\n `ai-sdk/deepgram/${VERSION}`,\n );\n\n const createTranscriptionModel = (modelId: DeepgramTranscriptionModelId) =>\n new DeepgramTranscriptionModel(modelId, {\n provider: `deepgram.transcription`,\n url: ({ path }) => `https://api.deepgram.com${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createSpeechModel = (modelId: DeepgramSpeechModelId) =>\n new DeepgramSpeechModel(modelId, {\n provider: `deepgram.speech`,\n url: ({ path }) => `https://api.deepgram.com${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const provider = function (modelId: DeepgramTranscriptionModelId) {\n return {\n transcription: createTranscriptionModel(modelId),\n };\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.transcription = createTranscriptionModel;\n provider.transcriptionModel = createTranscriptionModel;\n provider.speech = createSpeechModel;\n provider.speechModel = createSpeechModel;\n\n // Required ProviderV4 methods that are not supported\n provider.languageModel = (modelId: string) => {\n throw new NoSuchModelError({\n modelId,\n modelType: 'languageModel',\n message: 'Deepgram does not provide language models',\n });\n };\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({\n modelId,\n modelType: 'embeddingModel',\n message: 'Deepgram does not provide text embedding models',\n });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({\n modelId,\n modelType: 'imageModel',\n message: 'Deepgram does not provide image models',\n });\n };\n\n return provider as DeepgramProvider;\n}\n\n/**\n * Default Deepgram provider instance.\n */\nexport const deepgram = createDeepgram();\n","import type { SharedV4Warning, TranscriptionModelV4 } from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createJsonResponseHandler,\n parseProviderOptions,\n postToApi,\n serializeModelOptions,\n WORKFLOW_SERIALIZE,\n WORKFLOW_DESERIALIZE,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport type { DeepgramTranscriptionAPITypes } from './deepgram-api-types';\nimport type { DeepgramConfig } from './deepgram-config';\nimport { deepgramFailedResponseHandler } from './deepgram-error';\nimport type { DeepgramTranscriptionModelId } from './deepgram-transcription-options';\n\n// https://developers.deepgram.com/docs/pre-recorded-audio#results\nconst deepgramTranscriptionModelOptionsSchema = z.object({\n /** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */\n language: z.string().nullish(),\n /** Whether to enable automatic language detection. When true, Deepgram will detect the language of the audio. */\n detectLanguage: z.boolean().nullish(),\n /** Whether to use smart formatting, which formats written-out numbers, dates, times, etc. */\n smartFormat: z.boolean().nullish(),\n /** Whether to add punctuation to the transcript. */\n punctuate: z.boolean().nullish(),\n /** Whether to format the transcript into paragraphs. */\n paragraphs: z.boolean().nullish(),\n /** Whether to generate a summary of the transcript. Use 'v2' for the latest version or false to disable. */\n summarize: z.union([z.literal('v2'), z.literal(false)]).nullish(),\n /** Whether to identify topics in the transcript. */\n topics: z.boolean().nullish(),\n /** Whether to identify intents in the transcript. */\n intents: z.boolean().nullish(),\n /** Whether to analyze sentiment in the transcript. */\n sentiment: z.boolean().nullish(),\n /** Whether to detect and tag named entities in the transcript. */\n detectEntities: z.boolean().nullish(),\n /** Specify terms or patterns to redact from the transcript. Can be a string or array of strings. */\n redact: z.union([z.string(), z.array(z.string())]).nullish(),\n /** String to replace redacted content with. */\n replace: z.string().nullish(),\n /** Term or phrase to search for in the transcript. */\n search: z.string().nullish(),\n /** Key term to identify in the transcript. */\n keyterm: z.string().nullish(),\n /** Whether to identify different speakers in the audio. */\n diarize: z.boolean().nullish(),\n /** Whether to segment the transcript into utterances. */\n utterances: z.boolean().nullish(),\n /** Minimum duration of silence (in seconds) to trigger a new utterance. */\n uttSplit: z.number().nullish(),\n /** Whether to include filler words (um, uh, etc.) in the transcript. */\n fillerWords: z.boolean().nullish(),\n});\n\nexport type DeepgramTranscriptionModelOptions = z.infer<\n typeof deepgramTranscriptionModelOptionsSchema\n>;\n\ninterface DeepgramTranscriptionModelConfig extends DeepgramConfig {\n _internal?: {\n currentDate?: () => Date;\n };\n}\n\nexport class DeepgramTranscriptionModel implements TranscriptionModelV4 {\n readonly specificationVersion = 'v4';\n\n get provider(): string {\n return this.config.provider;\n }\n\n static [WORKFLOW_SERIALIZE](model: DeepgramTranscriptionModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: DeepgramTranscriptionModelId;\n config: DeepgramTranscriptionModelConfig;\n }) {\n return new DeepgramTranscriptionModel(options.modelId, options.config);\n }\n\n constructor(\n readonly modelId: DeepgramTranscriptionModelId,\n private readonly config: DeepgramTranscriptionModelConfig,\n ) {}\n\n private async getArgs({\n providerOptions,\n }: Parameters<TranscriptionModelV4['doGenerate']>[0]) {\n const warnings: SharedV4Warning[] = [];\n\n // Parse provider options\n const deepgramOptions = await parseProviderOptions({\n provider: 'deepgram',\n providerOptions,\n schema: deepgramTranscriptionModelOptionsSchema,\n });\n\n const body: DeepgramTranscriptionAPITypes = {\n model: this.modelId,\n diarize: true,\n };\n\n // Add provider-specific options\n if (deepgramOptions) {\n body.detect_entities = deepgramOptions.detectEntities ?? undefined;\n body.detect_language = deepgramOptions.detectLanguage ?? undefined;\n body.filler_words = deepgramOptions.fillerWords ?? undefined;\n body.language = deepgramOptions.language ?? undefined;\n body.punctuate = deepgramOptions.punctuate ?? undefined;\n body.redact = deepgramOptions.redact ?? undefined;\n body.search = deepgramOptions.search ?? undefined;\n body.smart_format = deepgramOptions.smartFormat ?? undefined;\n body.summarize = deepgramOptions.summarize ?? undefined;\n body.topics = deepgramOptions.topics ?? undefined;\n body.utterances = deepgramOptions.utterances ?? undefined;\n body.utt_split = deepgramOptions.uttSplit ?? undefined;\n\n if (typeof deepgramOptions.diarize === 'boolean') {\n body.diarize = deepgramOptions.diarize;\n }\n }\n\n // Convert body to URL query parameters\n const queryParams = new URLSearchParams();\n for (const [key, value] of Object.entries(body)) {\n if (value !== undefined) {\n queryParams.append(key, String(value));\n }\n }\n\n return {\n queryParams,\n warnings,\n };\n }\n\n async doGenerate(\n options: Parameters<TranscriptionModelV4['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>> {\n const currentDate = this.config._internal?.currentDate?.() ?? new Date();\n const { queryParams, warnings } = await this.getArgs(options);\n\n const {\n value: response,\n responseHeaders,\n rawValue: rawResponse,\n } = await postToApi({\n url:\n this.config.url({\n path: '/v1/listen',\n modelId: this.modelId,\n }) +\n '?' +\n queryParams.toString(),\n headers: {\n ...combineHeaders(this.config.headers?.(), options.headers),\n 'Content-Type': options.mediaType,\n },\n body: {\n content: options.audio,\n values: options.audio,\n },\n failedResponseHandler: deepgramFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(\n deepgramTranscriptionResponseSchema,\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n return {\n text:\n response.results?.channels.at(0)?.alternatives.at(0)?.transcript ?? '',\n segments:\n response.results?.channels[0].alternatives[0].words?.map(word => ({\n text: word.word,\n startSecond: word.start,\n endSecond: word.end,\n })) ?? [],\n language:\n response.results?.channels.at(0)?.detected_language ?? undefined,\n durationInSeconds: response.metadata?.duration ?? undefined,\n warnings,\n response: {\n timestamp: currentDate,\n modelId: this.modelId,\n headers: responseHeaders,\n body: rawResponse,\n },\n };\n }\n}\n\nconst deepgramTranscriptionResponseSchema = z.object({\n metadata: z\n .object({\n duration: z.number(),\n })\n .nullish(),\n results: z\n .object({\n channels: z.array(\n z.object({\n detected_language: z.string().nullish(),\n alternatives: z.array(\n z.object({\n transcript: z.string(),\n words: z.array(\n z.object({\n word: z.string(),\n start: z.number(),\n end: z.number(),\n }),\n ),\n }),\n ),\n }),\n ),\n })\n .nullish(),\n});\n","import { z } from 'zod/v4';\nimport { createJsonErrorResponseHandler } from '@ai-sdk/provider-utils';\n\nexport const deepgramErrorDataSchema = z.object({\n error: z.object({\n message: z.string(),\n code: z.number(),\n }),\n});\n\nexport type DeepgramErrorData = z.infer<typeof deepgramErrorDataSchema>;\n\nexport const deepgramFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: deepgramErrorDataSchema,\n errorToMessage: data => data.error.message,\n});\n","import type { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createBinaryResponseHandler,\n parseProviderOptions,\n postJsonToApi,\n serializeModelOptions,\n WORKFLOW_SERIALIZE,\n WORKFLOW_DESERIALIZE,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport type { DeepgramConfig } from './deepgram-config';\nimport { deepgramFailedResponseHandler } from './deepgram-error';\nimport type { DeepgramSpeechModelId } from './deepgram-speech-options';\n\n// https://developers.deepgram.com/reference/text-to-speech/speak-request\nconst deepgramSpeechModelOptionsSchema = z.object({\n /** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */\n bitRate: z.union([z.number(), z.string()]).nullish(),\n /** Container format for the output audio (mp3, wav, etc.). */\n container: z.string().nullish(),\n /** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */\n encoding: z.string().nullish(),\n /** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */\n sampleRate: z.number().nullish(),\n /** URL to which we'll make the callback request. */\n callback: z.string().url().nullish(),\n /** HTTP method by which the callback request will be made (POST or PUT). */\n callbackMethod: z.enum(['POST', 'PUT']).nullish(),\n /** Opts out requests from the Deepgram Model Improvement Program. */\n mipOptOut: z.boolean().nullish(),\n /** Label your requests for the purpose of identification during usage reporting. */\n tag: z.union([z.string(), z.array(z.string())]).nullish(),\n});\n\nexport type DeepgramSpeechModelOptions = z.infer<\n typeof deepgramSpeechModelOptionsSchema\n>;\n\ninterface DeepgramSpeechModelConfig extends DeepgramConfig {\n _internal?: {\n currentDate?: () => Date;\n };\n}\n\nexport class DeepgramSpeechModel implements SpeechModelV4 {\n readonly specificationVersion = 'v4';\n\n get provider(): string {\n return this.config.provider;\n }\n\n static [WORKFLOW_SERIALIZE](model: DeepgramSpeechModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: DeepgramSpeechModelId;\n config: DeepgramSpeechModelConfig;\n }) {\n return new DeepgramSpeechModel(options.modelId, options.config);\n }\n\n constructor(\n readonly modelId: DeepgramSpeechModelId,\n private readonly config: DeepgramSpeechModelConfig,\n ) {}\n\n private async getArgs({\n text,\n voice,\n outputFormat = 'mp3',\n speed,\n language,\n instructions,\n providerOptions,\n }: Parameters<SpeechModelV4['doGenerate']>[0]) {\n const warnings: SharedV4Warning[] = [];\n\n // Parse provider options\n const deepgramOptions = await parseProviderOptions({\n provider: 'deepgram',\n providerOptions,\n schema: deepgramSpeechModelOptionsSchema,\n });\n\n // Create request body\n const requestBody = {\n text,\n };\n\n // Prepare query parameters\n const queryParams: Record<string, string> = {\n model: this.modelId,\n };\n\n // Map outputFormat to encoding/container/sample_rate\n // https://developers.deepgram.com/docs/tts-media-output-settings#audio-format-combinations\n if (outputFormat) {\n const formatLower = outputFormat.toLowerCase();\n\n // Common format mappings based on Deepgram's valid combinations\n const formatMap: Record<\n string,\n {\n encoding?: string;\n container?: string;\n sampleRate?: number;\n bitRate?: number;\n }\n > = {\n // MP3: no container, fixed 22050 sample rate, bitrate 32000/48000\n mp3: { encoding: 'mp3' }, // Don't set container or sample_rate for mp3\n // Linear16: wav/none container, configurable sample rate\n wav: { container: 'wav', encoding: 'linear16' },\n linear16: { encoding: 'linear16', container: 'wav' },\n // MuLaw: wav/none container, 8000/16000 sample rate\n mulaw: { encoding: 'mulaw', container: 'wav' },\n // ALaw: wav/none container, 8000/16000 sample rate\n alaw: { encoding: 'alaw', container: 'wav' },\n // Opus: ogg container, fixed 48000 sample rate\n opus: { encoding: 'opus', container: 'ogg' },\n ogg: { encoding: 'opus', container: 'ogg' },\n // FLAC: no container, configurable sample rate\n flac: { encoding: 'flac' },\n // AAC: no container, fixed 22050 sample rate\n aac: { encoding: 'aac' },\n // Raw audio (no container)\n pcm: { encoding: 'linear16', container: 'none' },\n };\n\n const mappedFormat = formatMap[formatLower];\n if (mappedFormat) {\n if (mappedFormat.encoding) {\n queryParams.encoding = mappedFormat.encoding;\n }\n // Only set container if specified and valid for the encoding\n if (mappedFormat.container) {\n queryParams.container = mappedFormat.container;\n }\n // Only set sample_rate if specified and valid for the encoding\n if (mappedFormat.sampleRate) {\n queryParams.sample_rate = String(mappedFormat.sampleRate);\n }\n // Set bitrate for formats that support it\n if (mappedFormat.bitRate) {\n queryParams.bit_rate = String(mappedFormat.bitRate);\n }\n } else {\n // Try to parse format like \"wav_44100\" or \"linear16_24000\"\n const parts = formatLower.split('_');\n if (parts.length >= 2) {\n const firstPart = parts[0];\n const secondPart = parts[1];\n const sampleRate = parseInt(secondPart, 10);\n\n // Check if first part is an encoding\n if (\n [\n 'linear16',\n 'mulaw',\n 'alaw',\n 'mp3',\n 'opus',\n 'flac',\n 'aac',\n ].includes(firstPart)\n ) {\n queryParams.encoding = firstPart;\n\n // Set container based on encoding\n if (['linear16', 'mulaw', 'alaw'].includes(firstPart)) {\n // These can use wav or none, default to wav\n queryParams.container = 'wav';\n } else if (firstPart === 'opus') {\n queryParams.container = 'ogg';\n }\n // mp3, flac, aac don't use container\n\n // Set sample rate if valid for encoding\n if (!isNaN(sampleRate)) {\n if (\n firstPart === 'linear16' &&\n [8000, 16000, 24000, 32000, 48000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n } else if (\n firstPart === 'mulaw' &&\n [8000, 16000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n } else if (\n firstPart === 'alaw' &&\n [8000, 16000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n } else if (\n firstPart === 'flac' &&\n [8000, 16000, 22050, 32000, 48000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n }\n // mp3, opus, aac have fixed sample rates, don't set\n }\n } else if (['wav', 'ogg'].includes(firstPart)) {\n // First part is container\n if (firstPart === 'wav') {\n queryParams.container = 'wav';\n queryParams.encoding = 'linear16'; // Default encoding for wav\n } else if (firstPart === 'ogg') {\n queryParams.container = 'ogg';\n queryParams.encoding = 'opus'; // Default encoding for ogg\n }\n if (!isNaN(sampleRate)) {\n queryParams.sample_rate = String(sampleRate);\n }\n }\n }\n }\n }\n\n // Add provider-specific options - map camelCase to snake_case\n // Validate combinations according to Deepgram's spec\n if (deepgramOptions) {\n if (deepgramOptions.encoding) {\n const newEncoding = deepgramOptions.encoding.toLowerCase();\n\n // If encoding changes, we may need to clear incompatible parameters\n queryParams.encoding = newEncoding;\n\n // Validate container based on encoding\n if (deepgramOptions.container) {\n // Validate container is valid for this encoding\n if (['linear16', 'mulaw', 'alaw'].includes(newEncoding)) {\n if (\n !['wav', 'none'].includes(deepgramOptions.container.toLowerCase())\n ) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${newEncoding}\" only supports containers \"wav\" or \"none\". Container \"${deepgramOptions.container}\" was ignored.`,\n });\n } else {\n queryParams.container = deepgramOptions.container.toLowerCase();\n }\n } else if (newEncoding === 'opus') {\n // opus requires ogg container, override any previous container setting\n queryParams.container = 'ogg';\n } else if (['mp3', 'flac', 'aac'].includes(newEncoding)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${newEncoding}\" does not support container parameter. Container \"${deepgramOptions.container}\" was ignored.`,\n });\n // Remove container if it was set by outputFormat\n delete queryParams.container;\n }\n } else {\n // No container specified in providerOptions\n // If encoding changed to one that doesn't support container, remove it\n if (['mp3', 'flac', 'aac'].includes(newEncoding)) {\n delete queryParams.container;\n } else if (['linear16', 'mulaw', 'alaw'].includes(newEncoding)) {\n // Set default container if not already set\n if (!queryParams.container) {\n queryParams.container = 'wav'; // Default for these encodings\n }\n } else if (newEncoding === 'opus') {\n // opus requires ogg container, override any previous container setting\n queryParams.container = 'ogg';\n }\n }\n\n // Clean up sample_rate and bit_rate if they're incompatible with the new encoding\n // Fixed sample rate encodings (mp3, opus, aac) don't support sample_rate parameter\n if (['mp3', 'opus', 'aac'].includes(newEncoding)) {\n delete queryParams.sample_rate;\n }\n // Lossless encodings without bitrate support (linear16, mulaw, alaw, flac) don't support bit_rate\n if (['linear16', 'mulaw', 'alaw', 'flac'].includes(newEncoding)) {\n delete queryParams.bit_rate;\n }\n } else if (deepgramOptions.container) {\n // Container specified without encoding - set default encoding\n const container = deepgramOptions.container.toLowerCase();\n const oldEncoding = queryParams.encoding?.toLowerCase();\n let newEncoding: string | undefined;\n\n if (container === 'wav') {\n queryParams.container = 'wav';\n newEncoding = 'linear16'; // Default encoding for wav\n } else if (container === 'ogg') {\n queryParams.container = 'ogg';\n newEncoding = 'opus'; // Default encoding for ogg\n } else if (container === 'none') {\n queryParams.container = 'none';\n newEncoding = 'linear16'; // Default encoding for raw audio\n }\n\n // If encoding changed, clean up incompatible parameters\n if (newEncoding && newEncoding !== oldEncoding) {\n queryParams.encoding = newEncoding;\n // Clean up sample_rate and bit_rate if they're incompatible with the new encoding\n if (['mp3', 'opus', 'aac'].includes(newEncoding)) {\n delete queryParams.sample_rate;\n }\n if (['linear16', 'mulaw', 'alaw', 'flac'].includes(newEncoding)) {\n delete queryParams.bit_rate;\n }\n }\n }\n\n if (deepgramOptions.sampleRate != null) {\n const encoding = queryParams.encoding?.toLowerCase() || '';\n const sampleRate = deepgramOptions.sampleRate;\n\n // Validate sample rate based on encoding\n if (encoding === 'linear16') {\n if (![8000, 16000, 24000, 32000, 48000].includes(sampleRate)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"linear16\" only supports sample rates: 8000, 16000, 24000, 32000, 48000. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n queryParams.sample_rate = String(sampleRate);\n }\n } else if (encoding === 'mulaw' || encoding === 'alaw') {\n if (![8000, 16000].includes(sampleRate)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${encoding}\" only supports sample rates: 8000, 16000. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n queryParams.sample_rate = String(sampleRate);\n }\n } else if (encoding === 'flac') {\n if (![8000, 16000, 22050, 32000, 48000].includes(sampleRate)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"flac\" only supports sample rates: 8000, 16000, 22050, 32000, 48000. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n queryParams.sample_rate = String(sampleRate);\n }\n } else if (['mp3', 'opus', 'aac'].includes(encoding)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${encoding}\" has a fixed sample rate and does not support sample_rate parameter. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n // No encoding set yet, allow it (will be validated when encoding is set)\n queryParams.sample_rate = String(sampleRate);\n }\n }\n\n if (deepgramOptions.bitRate != null) {\n const encoding = queryParams.encoding?.toLowerCase() || '';\n const bitRate = deepgramOptions.bitRate;\n\n // Validate bitrate based on encoding\n if (encoding === 'mp3') {\n if (![32000, 48000].includes(Number(bitRate))) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"mp3\" only supports bit rates: 32000, 48000. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n queryParams.bit_rate = String(bitRate);\n }\n } else if (encoding === 'opus') {\n const bitRateNum = Number(bitRate);\n if (bitRateNum < 4000 || bitRateNum > 650000) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"opus\" supports bit rates between 4000 and 650000. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n queryParams.bit_rate = String(bitRate);\n }\n } else if (encoding === 'aac') {\n const bitRateNum = Number(bitRate);\n if (bitRateNum < 4000 || bitRateNum > 192000) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"aac\" supports bit rates between 4000 and 192000. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n queryParams.bit_rate = String(bitRate);\n }\n } else if (['linear16', 'mulaw', 'alaw', 'flac'].includes(encoding)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${encoding}\" does not support bit_rate parameter. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n // No encoding set yet, allow it\n queryParams.bit_rate = String(bitRate);\n }\n }\n\n if (deepgramOptions.callback) {\n queryParams.callback = deepgramOptions.callback;\n }\n if (deepgramOptions.callbackMethod) {\n queryParams.callback_method = deepgramOptions.callbackMethod;\n }\n if (deepgramOptions.mipOptOut != null) {\n queryParams.mip_opt_out = String(deepgramOptions.mipOptOut);\n }\n if (deepgramOptions.tag) {\n if (Array.isArray(deepgramOptions.tag)) {\n queryParams.tag = deepgramOptions.tag.join(',');\n } else {\n queryParams.tag = deepgramOptions.tag;\n }\n }\n }\n\n // Handle voice parameter - Deepgram embeds voice in model ID\n // If voice is provided and different from model, warn user\n if (voice && voice !== this.modelId) {\n warnings.push({\n type: 'unsupported',\n feature: 'voice',\n details: `Deepgram TTS models embed the voice in the model ID. The voice parameter \"${voice}\" was ignored. Use the model ID to select a voice (e.g., \"aura-2-helena-en\").`,\n });\n }\n\n // Handle speed - not supported in Deepgram REST API\n if (speed != null) {\n warnings.push({\n type: 'unsupported',\n feature: 'speed',\n details: `Deepgram TTS REST API does not support speed adjustment. Speed parameter was ignored.`,\n });\n }\n\n // Handle language - Deepgram models are language-specific via model ID\n if (language) {\n warnings.push({\n type: 'unsupported',\n feature: 'language',\n details: `Deepgram TTS models are language-specific via the model ID. Language parameter \"${language}\" was ignored. Select a model with the appropriate language suffix (e.g., \"-en\" for English).`,\n });\n }\n\n // Handle instructions - not supported in Deepgram REST API\n if (instructions) {\n warnings.push({\n type: 'unsupported',\n feature: 'instructions',\n details: `Deepgram TTS REST API does not support instructions. Instructions parameter was ignored.`,\n });\n }\n\n return {\n requestBody,\n queryParams,\n warnings,\n };\n }\n\n async doGenerate(\n options: Parameters<SpeechModelV4['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>> {\n const currentDate = this.config._internal?.currentDate?.() ?? new Date();\n const { requestBody, queryParams, warnings } = await this.getArgs(options);\n\n const {\n value: audio,\n responseHeaders,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: (() => {\n const baseUrl = this.config.url({\n path: '/v1/speak',\n modelId: this.modelId,\n });\n const queryString = new URLSearchParams(queryParams).toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n })(),\n headers: combineHeaders(this.config.headers?.(), options.headers),\n body: requestBody,\n failedResponseHandler: deepgramFailedResponseHandler,\n successfulResponseHandler: createBinaryResponseHandler(),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n return {\n audio,\n warnings,\n request: {\n body: JSON.stringify(requestBody),\n },\n response: {\n timestamp: currentDate,\n modelId: this.modelId,\n headers: responseHeaders,\n body: rawResponse,\n },\n };\n }\n}\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;;;ACTP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,KAAAA,UAAS;;;ACVlB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAExC,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,OAAO,EAAE,OAAO;AAAA,IACd,SAAS,EAAE,OAAO;AAAA,IAClB,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAIM,IAAM,gCAAgC,+BAA+B;AAAA,EAC1E,aAAa;A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ACA,mBAAmB,OAAO;AAAA,EAC5B;AAEF,QAAM,2BAA2B,CAAC,YAChC,IAAI,2BAA2B,SAAS;AAAA,IACtC,UAAU;AAAA,IACV,KAAK,CAAC,EAAE,KAAK,MAAM,2BAA2B,IAAI;AAAA,IAClD,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,oBAAoB,CAAC,YACzB,IAAI,oBAAoB,SAAS;AAAA,IAC/B,UAAU;AAAA,IACV,KAAK,CAAC,EAAE,KAAK,MAAM,2BAA2B,IAAI;AAAA,IAClD,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,WAAW,SAAU,SAAuC;AAChE,WAAO;AAAA,MACL,eAAe,yBAAyB,OAAO;AAAA,IACjD;AAAA,EACF;AAEA,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,qBAAqB;AAC9B,WAAS,SAAS;AAClB,WAAS,cAAc;AAGvB,WAAS,gBAAgB,CAAC,YAAoB;AAC5C,UAAM,IAAI,iBAAiB;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iBAAiB;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACA,WAAS,qBAAqB,SAAS;AAEvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAKO,IAAM,WAAW,eAAe;","names":["z","z","combineHeaders","parseProviderOptions","serializeModelOptions","WORKFLOW_SERIALIZE","WORKFLOW_DESERIALIZE","z","z","WORKFLOW_SERIALIZE","serializeModelOptions","WORKFLOW_DESERIALIZE","parseProviderOptions","combineHeaders"]}
1
+ {"version":3,"sources":["../src/deepgram-provider.ts","../src/deepgram-transcription-model.ts","../src/deepgram-error.ts","../src/deepgram-transcription-model-options.ts","../src/deepgram-speech-model.ts","../src/deepgram-speech-model-options.ts","../src/version.ts"],"sourcesContent":["import {\n NoSuchModelError,\n type TranscriptionModelV4,\n type SpeechModelV4,\n type ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n loadApiKey,\n withUserAgentSuffix,\n type FetchFunction,\n} from '@ai-sdk/provider-utils';\nimport { DeepgramTranscriptionModel } from './deepgram-transcription-model';\nimport type { DeepgramTranscriptionModelId } from './deepgram-transcription-options';\nimport { DeepgramSpeechModel } from './deepgram-speech-model';\nimport type { DeepgramSpeechModelId } from './deepgram-speech-options';\nimport { VERSION } from './version';\n\nexport interface DeepgramProvider extends ProviderV4 {\n (\n modelId: 'nova-3',\n settings?: {},\n ): {\n transcription: DeepgramTranscriptionModel;\n };\n\n /**\n * Creates a model for transcription.\n */\n transcription(modelId: DeepgramTranscriptionModelId): TranscriptionModelV4;\n\n /**\n * Creates a model for speech generation.\n */\n speech(modelId: DeepgramSpeechModelId): SpeechModelV4;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface DeepgramProviderSettings {\n /**\n * API key for authenticating requests.\n */\n apiKey?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create an Deepgram provider instance.\n */\nexport function createDeepgram(\n options: DeepgramProviderSettings = {},\n): DeepgramProvider {\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n authorization: `Token ${loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'DEEPGRAM_API_KEY',\n description: 'Deepgram',\n })}`,\n ...options.headers,\n },\n `ai-sdk/deepgram/${VERSION}`,\n );\n\n const createTranscriptionModel = (modelId: DeepgramTranscriptionModelId) =>\n new DeepgramTranscriptionModel(modelId, {\n provider: `deepgram.transcription`,\n url: ({ path }) => `https://api.deepgram.com${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const createSpeechModel = (modelId: DeepgramSpeechModelId) =>\n new DeepgramSpeechModel(modelId, {\n provider: `deepgram.speech`,\n url: ({ path }) => `https://api.deepgram.com${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const provider = function (modelId: DeepgramTranscriptionModelId) {\n return {\n transcription: createTranscriptionModel(modelId),\n };\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.transcription = createTranscriptionModel;\n provider.transcriptionModel = createTranscriptionModel;\n provider.speech = createSpeechModel;\n provider.speechModel = createSpeechModel;\n\n // Required ProviderV4 methods that are not supported\n provider.languageModel = (modelId: string) => {\n throw new NoSuchModelError({\n modelId,\n modelType: 'languageModel',\n message: 'Deepgram does not provide language models',\n });\n };\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({\n modelId,\n modelType: 'embeddingModel',\n message: 'Deepgram does not provide text embedding models',\n });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({\n modelId,\n modelType: 'imageModel',\n message: 'Deepgram does not provide image models',\n });\n };\n\n return provider as DeepgramProvider;\n}\n\n/**\n * Default Deepgram provider instance.\n */\nexport const deepgram = createDeepgram();\n","import type { SharedV4Warning, TranscriptionModelV4 } from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createJsonResponseHandler,\n parseProviderOptions,\n postToApi,\n serializeModelOptions,\n WORKFLOW_SERIALIZE,\n WORKFLOW_DESERIALIZE,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport type { DeepgramTranscriptionAPITypes } from './deepgram-api-types';\nimport type { DeepgramConfig } from './deepgram-config';\nimport { deepgramFailedResponseHandler } from './deepgram-error';\nimport { deepgramTranscriptionModelOptionsSchema } from './deepgram-transcription-model-options';\nimport type { DeepgramTranscriptionModelId } from './deepgram-transcription-options';\n\ninterface DeepgramTranscriptionModelConfig extends DeepgramConfig {\n _internal?: {\n currentDate?: () => Date;\n };\n}\n\nexport class DeepgramTranscriptionModel implements TranscriptionModelV4 {\n readonly specificationVersion = 'v4';\n\n get provider(): string {\n return this.config.provider;\n }\n\n static [WORKFLOW_SERIALIZE](model: DeepgramTranscriptionModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: DeepgramTranscriptionModelId;\n config: DeepgramTranscriptionModelConfig;\n }) {\n return new DeepgramTranscriptionModel(options.modelId, options.config);\n }\n\n constructor(\n readonly modelId: DeepgramTranscriptionModelId,\n private readonly config: DeepgramTranscriptionModelConfig,\n ) {}\n\n private async getArgs({\n providerOptions,\n }: Parameters<TranscriptionModelV4['doGenerate']>[0]) {\n const warnings: SharedV4Warning[] = [];\n\n // Parse provider options\n const deepgramOptions = await parseProviderOptions({\n provider: 'deepgram',\n providerOptions,\n schema: deepgramTranscriptionModelOptionsSchema,\n });\n\n const body: DeepgramTranscriptionAPITypes = {\n model: this.modelId,\n diarize: true,\n };\n\n // Add provider-specific options\n if (deepgramOptions) {\n body.detect_entities = deepgramOptions.detectEntities ?? undefined;\n body.detect_language = deepgramOptions.detectLanguage ?? undefined;\n body.filler_words = deepgramOptions.fillerWords ?? undefined;\n body.language = deepgramOptions.language ?? undefined;\n body.punctuate = deepgramOptions.punctuate ?? undefined;\n body.redact = deepgramOptions.redact ?? undefined;\n body.search = deepgramOptions.search ?? undefined;\n body.smart_format = deepgramOptions.smartFormat ?? undefined;\n body.summarize = deepgramOptions.summarize ?? undefined;\n body.topics = deepgramOptions.topics ?? undefined;\n body.utterances = deepgramOptions.utterances ?? undefined;\n body.utt_split = deepgramOptions.uttSplit ?? undefined;\n\n if (typeof deepgramOptions.diarize === 'boolean') {\n body.diarize = deepgramOptions.diarize;\n }\n }\n\n // Convert body to URL query parameters\n const queryParams = new URLSearchParams();\n for (const [key, value] of Object.entries(body)) {\n if (value !== undefined) {\n queryParams.append(key, String(value));\n }\n }\n\n return {\n queryParams,\n warnings,\n };\n }\n\n async doGenerate(\n options: Parameters<TranscriptionModelV4['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>> {\n const currentDate = this.config._internal?.currentDate?.() ?? new Date();\n const { queryParams, warnings } = await this.getArgs(options);\n\n const {\n value: response,\n responseHeaders,\n rawValue: rawResponse,\n } = await postToApi({\n url:\n this.config.url({\n path: '/v1/listen',\n modelId: this.modelId,\n }) +\n '?' +\n queryParams.toString(),\n headers: {\n ...combineHeaders(this.config.headers?.(), options.headers),\n 'Content-Type': options.mediaType,\n },\n body: {\n content: options.audio,\n values: options.audio,\n },\n failedResponseHandler: deepgramFailedResponseHandler,\n successfulResponseHandler: createJsonResponseHandler(\n deepgramTranscriptionResponseSchema,\n ),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n return {\n text:\n response.results?.channels.at(0)?.alternatives.at(0)?.transcript ?? '',\n segments:\n response.results?.channels[0].alternatives[0].words?.map(word => ({\n text: word.word,\n startSecond: word.start,\n endSecond: word.end,\n })) ?? [],\n language:\n response.results?.channels.at(0)?.detected_language ?? undefined,\n durationInSeconds: response.metadata?.duration ?? undefined,\n warnings,\n response: {\n timestamp: currentDate,\n modelId: this.modelId,\n headers: responseHeaders,\n body: rawResponse,\n },\n };\n }\n}\n\nconst deepgramTranscriptionResponseSchema = z.object({\n metadata: z\n .object({\n duration: z.number(),\n })\n .nullish(),\n results: z\n .object({\n channels: z.array(\n z.object({\n detected_language: z.string().nullish(),\n alternatives: z.array(\n z.object({\n transcript: z.string(),\n words: z.array(\n z.object({\n word: z.string(),\n start: z.number(),\n end: z.number(),\n }),\n ),\n }),\n ),\n }),\n ),\n })\n .nullish(),\n});\n","import { z } from 'zod/v4';\nimport { createJsonErrorResponseHandler } from '@ai-sdk/provider-utils';\n\nexport const deepgramErrorDataSchema = z.object({\n error: z.object({\n message: z.string(),\n code: z.number(),\n }),\n});\n\nexport type DeepgramErrorData = z.infer<typeof deepgramErrorDataSchema>;\n\nexport const deepgramFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: deepgramErrorDataSchema,\n errorToMessage: data => data.error.message,\n});\n","import { z } from 'zod/v4';\n\n// https://developers.deepgram.com/docs/pre-recorded-audio#results\nexport const deepgramTranscriptionModelOptionsSchema = z.object({\n /** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */\n language: z.string().nullish(),\n /** Whether to enable automatic language detection. When true, Deepgram will detect the language of the audio. */\n detectLanguage: z.boolean().nullish(),\n /** Whether to use smart formatting, which formats written-out numbers, dates, times, etc. */\n smartFormat: z.boolean().nullish(),\n /** Whether to add punctuation to the transcript. */\n punctuate: z.boolean().nullish(),\n /** Whether to format the transcript into paragraphs. */\n paragraphs: z.boolean().nullish(),\n /** Whether to generate a summary of the transcript. Use 'v2' for the latest version or false to disable. */\n summarize: z.union([z.literal('v2'), z.literal(false)]).nullish(),\n /** Whether to identify topics in the transcript. */\n topics: z.boolean().nullish(),\n /** Whether to identify intents in the transcript. */\n intents: z.boolean().nullish(),\n /** Whether to analyze sentiment in the transcript. */\n sentiment: z.boolean().nullish(),\n /** Whether to detect and tag named entities in the transcript. */\n detectEntities: z.boolean().nullish(),\n /** Specify terms or patterns to redact from the transcript. Can be a string or array of strings. */\n redact: z.union([z.string(), z.array(z.string())]).nullish(),\n /** String to replace redacted content with. */\n replace: z.string().nullish(),\n /** Term or phrase to search for in the transcript. */\n search: z.string().nullish(),\n /** Key term to identify in the transcript. */\n keyterm: z.string().nullish(),\n /** Whether to identify different speakers in the audio. */\n diarize: z.boolean().nullish(),\n /** Whether to segment the transcript into utterances. */\n utterances: z.boolean().nullish(),\n /** Minimum duration of silence (in seconds) to trigger a new utterance. */\n uttSplit: z.number().nullish(),\n /** Whether to include filler words (um, uh, etc.) in the transcript. */\n fillerWords: z.boolean().nullish(),\n});\n\nexport type DeepgramTranscriptionModelOptions = z.infer<\n typeof deepgramTranscriptionModelOptionsSchema\n>;\n","import type { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createBinaryResponseHandler,\n parseProviderOptions,\n postJsonToApi,\n serializeModelOptions,\n WORKFLOW_SERIALIZE,\n WORKFLOW_DESERIALIZE,\n} from '@ai-sdk/provider-utils';\nimport type { DeepgramConfig } from './deepgram-config';\nimport { deepgramFailedResponseHandler } from './deepgram-error';\nimport { deepgramSpeechModelOptionsSchema } from './deepgram-speech-model-options';\nimport type { DeepgramSpeechModelId } from './deepgram-speech-options';\n\ninterface DeepgramSpeechModelConfig extends DeepgramConfig {\n _internal?: {\n currentDate?: () => Date;\n };\n}\n\nexport class DeepgramSpeechModel implements SpeechModelV4 {\n readonly specificationVersion = 'v4';\n\n get provider(): string {\n return this.config.provider;\n }\n\n static [WORKFLOW_SERIALIZE](model: DeepgramSpeechModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: DeepgramSpeechModelId;\n config: DeepgramSpeechModelConfig;\n }) {\n return new DeepgramSpeechModel(options.modelId, options.config);\n }\n\n constructor(\n readonly modelId: DeepgramSpeechModelId,\n private readonly config: DeepgramSpeechModelConfig,\n ) {}\n\n private async getArgs({\n text,\n voice,\n outputFormat = 'mp3',\n speed,\n language,\n instructions,\n providerOptions,\n }: Parameters<SpeechModelV4['doGenerate']>[0]) {\n const warnings: SharedV4Warning[] = [];\n\n // Parse provider options\n const deepgramOptions = await parseProviderOptions({\n provider: 'deepgram',\n providerOptions,\n schema: deepgramSpeechModelOptionsSchema,\n });\n\n // Create request body\n const requestBody = {\n text,\n };\n\n // Prepare query parameters\n const queryParams: Record<string, string> = {\n model: this.modelId,\n };\n\n // Map outputFormat to encoding/container/sample_rate\n // https://developers.deepgram.com/docs/tts-media-output-settings#audio-format-combinations\n if (outputFormat) {\n const formatLower = outputFormat.toLowerCase();\n\n // Common format mappings based on Deepgram's valid combinations\n const formatMap: Record<\n string,\n {\n encoding?: string;\n container?: string;\n sampleRate?: number;\n bitRate?: number;\n }\n > = {\n // MP3: no container, fixed 22050 sample rate, bitrate 32000/48000\n mp3: { encoding: 'mp3' }, // Don't set container or sample_rate for mp3\n // Linear16: wav/none container, configurable sample rate\n wav: { container: 'wav', encoding: 'linear16' },\n linear16: { encoding: 'linear16', container: 'wav' },\n // MuLaw: wav/none container, 8000/16000 sample rate\n mulaw: { encoding: 'mulaw', container: 'wav' },\n // ALaw: wav/none container, 8000/16000 sample rate\n alaw: { encoding: 'alaw', container: 'wav' },\n // Opus: ogg container, fixed 48000 sample rate\n opus: { encoding: 'opus', container: 'ogg' },\n ogg: { encoding: 'opus', container: 'ogg' },\n // FLAC: no container, configurable sample rate\n flac: { encoding: 'flac' },\n // AAC: no container, fixed 22050 sample rate\n aac: { encoding: 'aac' },\n // Raw audio (no container)\n pcm: { encoding: 'linear16', container: 'none' },\n };\n\n const mappedFormat = formatMap[formatLower];\n if (mappedFormat) {\n if (mappedFormat.encoding) {\n queryParams.encoding = mappedFormat.encoding;\n }\n // Only set container if specified and valid for the encoding\n if (mappedFormat.container) {\n queryParams.container = mappedFormat.container;\n }\n // Only set sample_rate if specified and valid for the encoding\n if (mappedFormat.sampleRate) {\n queryParams.sample_rate = String(mappedFormat.sampleRate);\n }\n // Set bitrate for formats that support it\n if (mappedFormat.bitRate) {\n queryParams.bit_rate = String(mappedFormat.bitRate);\n }\n } else {\n // Try to parse format like \"wav_44100\" or \"linear16_24000\"\n const parts = formatLower.split('_');\n if (parts.length >= 2) {\n const firstPart = parts[0];\n const secondPart = parts[1];\n const sampleRate = parseInt(secondPart, 10);\n\n // Check if first part is an encoding\n if (\n [\n 'linear16',\n 'mulaw',\n 'alaw',\n 'mp3',\n 'opus',\n 'flac',\n 'aac',\n ].includes(firstPart)\n ) {\n queryParams.encoding = firstPart;\n\n // Set container based on encoding\n if (['linear16', 'mulaw', 'alaw'].includes(firstPart)) {\n // These can use wav or none, default to wav\n queryParams.container = 'wav';\n } else if (firstPart === 'opus') {\n queryParams.container = 'ogg';\n }\n // mp3, flac, aac don't use container\n\n // Set sample rate if valid for encoding\n if (!isNaN(sampleRate)) {\n if (\n firstPart === 'linear16' &&\n [8000, 16000, 24000, 32000, 48000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n } else if (\n firstPart === 'mulaw' &&\n [8000, 16000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n } else if (\n firstPart === 'alaw' &&\n [8000, 16000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n } else if (\n firstPart === 'flac' &&\n [8000, 16000, 22050, 32000, 48000].includes(sampleRate)\n ) {\n queryParams.sample_rate = String(sampleRate);\n }\n // mp3, opus, aac have fixed sample rates, don't set\n }\n } else if (['wav', 'ogg'].includes(firstPart)) {\n // First part is container\n if (firstPart === 'wav') {\n queryParams.container = 'wav';\n queryParams.encoding = 'linear16'; // Default encoding for wav\n } else if (firstPart === 'ogg') {\n queryParams.container = 'ogg';\n queryParams.encoding = 'opus'; // Default encoding for ogg\n }\n if (!isNaN(sampleRate)) {\n queryParams.sample_rate = String(sampleRate);\n }\n }\n }\n }\n }\n\n // Add provider-specific options - map camelCase to snake_case\n // Validate combinations according to Deepgram's spec\n if (deepgramOptions) {\n if (deepgramOptions.encoding) {\n const newEncoding = deepgramOptions.encoding.toLowerCase();\n\n // If encoding changes, we may need to clear incompatible parameters\n queryParams.encoding = newEncoding;\n\n // Validate container based on encoding\n if (deepgramOptions.container) {\n // Validate container is valid for this encoding\n if (['linear16', 'mulaw', 'alaw'].includes(newEncoding)) {\n if (\n !['wav', 'none'].includes(deepgramOptions.container.toLowerCase())\n ) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${newEncoding}\" only supports containers \"wav\" or \"none\". Container \"${deepgramOptions.container}\" was ignored.`,\n });\n } else {\n queryParams.container = deepgramOptions.container.toLowerCase();\n }\n } else if (newEncoding === 'opus') {\n // opus requires ogg container, override any previous container setting\n queryParams.container = 'ogg';\n } else if (['mp3', 'flac', 'aac'].includes(newEncoding)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${newEncoding}\" does not support container parameter. Container \"${deepgramOptions.container}\" was ignored.`,\n });\n // Remove container if it was set by outputFormat\n delete queryParams.container;\n }\n } else {\n // No container specified in providerOptions\n // If encoding changed to one that doesn't support container, remove it\n if (['mp3', 'flac', 'aac'].includes(newEncoding)) {\n delete queryParams.container;\n } else if (['linear16', 'mulaw', 'alaw'].includes(newEncoding)) {\n // Set default container if not already set\n if (!queryParams.container) {\n queryParams.container = 'wav'; // Default for these encodings\n }\n } else if (newEncoding === 'opus') {\n // opus requires ogg container, override any previous container setting\n queryParams.container = 'ogg';\n }\n }\n\n // Clean up sample_rate and bit_rate if they're incompatible with the new encoding\n // Fixed sample rate encodings (mp3, opus, aac) don't support sample_rate parameter\n if (['mp3', 'opus', 'aac'].includes(newEncoding)) {\n delete queryParams.sample_rate;\n }\n // Lossless encodings without bitrate support (linear16, mulaw, alaw, flac) don't support bit_rate\n if (['linear16', 'mulaw', 'alaw', 'flac'].includes(newEncoding)) {\n delete queryParams.bit_rate;\n }\n } else if (deepgramOptions.container) {\n // Container specified without encoding - set default encoding\n const container = deepgramOptions.container.toLowerCase();\n const oldEncoding = queryParams.encoding?.toLowerCase();\n let newEncoding: string | undefined;\n\n if (container === 'wav') {\n queryParams.container = 'wav';\n newEncoding = 'linear16'; // Default encoding for wav\n } else if (container === 'ogg') {\n queryParams.container = 'ogg';\n newEncoding = 'opus'; // Default encoding for ogg\n } else if (container === 'none') {\n queryParams.container = 'none';\n newEncoding = 'linear16'; // Default encoding for raw audio\n }\n\n // If encoding changed, clean up incompatible parameters\n if (newEncoding && newEncoding !== oldEncoding) {\n queryParams.encoding = newEncoding;\n // Clean up sample_rate and bit_rate if they're incompatible with the new encoding\n if (['mp3', 'opus', 'aac'].includes(newEncoding)) {\n delete queryParams.sample_rate;\n }\n if (['linear16', 'mulaw', 'alaw', 'flac'].includes(newEncoding)) {\n delete queryParams.bit_rate;\n }\n }\n }\n\n if (deepgramOptions.sampleRate != null) {\n const encoding = queryParams.encoding?.toLowerCase() || '';\n const sampleRate = deepgramOptions.sampleRate;\n\n // Validate sample rate based on encoding\n if (encoding === 'linear16') {\n if (![8000, 16000, 24000, 32000, 48000].includes(sampleRate)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"linear16\" only supports sample rates: 8000, 16000, 24000, 32000, 48000. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n queryParams.sample_rate = String(sampleRate);\n }\n } else if (encoding === 'mulaw' || encoding === 'alaw') {\n if (![8000, 16000].includes(sampleRate)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${encoding}\" only supports sample rates: 8000, 16000. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n queryParams.sample_rate = String(sampleRate);\n }\n } else if (encoding === 'flac') {\n if (![8000, 16000, 22050, 32000, 48000].includes(sampleRate)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"flac\" only supports sample rates: 8000, 16000, 22050, 32000, 48000. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n queryParams.sample_rate = String(sampleRate);\n }\n } else if (['mp3', 'opus', 'aac'].includes(encoding)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${encoding}\" has a fixed sample rate and does not support sample_rate parameter. Sample rate ${sampleRate} was ignored.`,\n });\n } else {\n // No encoding set yet, allow it (will be validated when encoding is set)\n queryParams.sample_rate = String(sampleRate);\n }\n }\n\n if (deepgramOptions.bitRate != null) {\n const encoding = queryParams.encoding?.toLowerCase() || '';\n const bitRate = deepgramOptions.bitRate;\n\n // Validate bitrate based on encoding\n if (encoding === 'mp3') {\n if (![32000, 48000].includes(Number(bitRate))) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"mp3\" only supports bit rates: 32000, 48000. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n queryParams.bit_rate = String(bitRate);\n }\n } else if (encoding === 'opus') {\n const bitRateNum = Number(bitRate);\n if (bitRateNum < 4000 || bitRateNum > 650000) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"opus\" supports bit rates between 4000 and 650000. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n queryParams.bit_rate = String(bitRate);\n }\n } else if (encoding === 'aac') {\n const bitRateNum = Number(bitRate);\n if (bitRateNum < 4000 || bitRateNum > 192000) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"aac\" supports bit rates between 4000 and 192000. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n queryParams.bit_rate = String(bitRate);\n }\n } else if (['linear16', 'mulaw', 'alaw', 'flac'].includes(encoding)) {\n warnings.push({\n type: 'unsupported',\n feature: 'providerOptions',\n details: `Encoding \"${encoding}\" does not support bit_rate parameter. Bit rate ${bitRate} was ignored.`,\n });\n } else {\n // No encoding set yet, allow it\n queryParams.bit_rate = String(bitRate);\n }\n }\n\n if (deepgramOptions.callback) {\n queryParams.callback = deepgramOptions.callback;\n }\n if (deepgramOptions.callbackMethod) {\n queryParams.callback_method = deepgramOptions.callbackMethod;\n }\n if (deepgramOptions.mipOptOut != null) {\n queryParams.mip_opt_out = String(deepgramOptions.mipOptOut);\n }\n if (deepgramOptions.tag) {\n if (Array.isArray(deepgramOptions.tag)) {\n queryParams.tag = deepgramOptions.tag.join(',');\n } else {\n queryParams.tag = deepgramOptions.tag;\n }\n }\n }\n\n // Handle voice parameter - Deepgram embeds voice in model ID\n // If voice is provided and different from model, warn user\n if (voice && voice !== this.modelId) {\n warnings.push({\n type: 'unsupported',\n feature: 'voice',\n details: `Deepgram TTS models embed the voice in the model ID. The voice parameter \"${voice}\" was ignored. Use the model ID to select a voice (e.g., \"aura-2-helena-en\").`,\n });\n }\n\n // Handle speed - not supported in Deepgram REST API\n if (speed != null) {\n warnings.push({\n type: 'unsupported',\n feature: 'speed',\n details: `Deepgram TTS REST API does not support speed adjustment. Speed parameter was ignored.`,\n });\n }\n\n // Handle language - Deepgram models are language-specific via model ID\n if (language) {\n warnings.push({\n type: 'unsupported',\n feature: 'language',\n details: `Deepgram TTS models are language-specific via the model ID. Language parameter \"${language}\" was ignored. Select a model with the appropriate language suffix (e.g., \"-en\" for English).`,\n });\n }\n\n // Handle instructions - not supported in Deepgram REST API\n if (instructions) {\n warnings.push({\n type: 'unsupported',\n feature: 'instructions',\n details: `Deepgram TTS REST API does not support instructions. Instructions parameter was ignored.`,\n });\n }\n\n return {\n requestBody,\n queryParams,\n warnings,\n };\n }\n\n async doGenerate(\n options: Parameters<SpeechModelV4['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>> {\n const currentDate = this.config._internal?.currentDate?.() ?? new Date();\n const { requestBody, queryParams, warnings } = await this.getArgs(options);\n\n const {\n value: audio,\n responseHeaders,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: (() => {\n const baseUrl = this.config.url({\n path: '/v1/speak',\n modelId: this.modelId,\n });\n const queryString = new URLSearchParams(queryParams).toString();\n return queryString ? `${baseUrl}?${queryString}` : baseUrl;\n })(),\n headers: combineHeaders(this.config.headers?.(), options.headers),\n body: requestBody,\n failedResponseHandler: deepgramFailedResponseHandler,\n successfulResponseHandler: createBinaryResponseHandler(),\n abortSignal: options.abortSignal,\n fetch: this.config.fetch,\n });\n\n return {\n audio,\n warnings,\n request: {\n body: JSON.stringify(requestBody),\n },\n response: {\n timestamp: currentDate,\n modelId: this.modelId,\n headers: responseHeaders,\n body: rawResponse,\n },\n };\n }\n}\n","import { z } from 'zod/v4';\n\n// https://developers.deepgram.com/reference/text-to-speech/speak-request\nexport const deepgramSpeechModelOptionsSchema = z.object({\n /** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */\n bitRate: z.union([z.number(), z.string()]).nullish(),\n /** Container format for the output audio (mp3, wav, etc.). */\n container: z.string().nullish(),\n /** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */\n encoding: z.string().nullish(),\n /** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */\n sampleRate: z.number().nullish(),\n /** URL to which we'll make the callback request. */\n callback: z.string().url().nullish(),\n /** HTTP method by which the callback request will be made (POST or PUT). */\n callbackMethod: z.enum(['POST', 'PUT']).nullish(),\n /** Opts out requests from the Deepgram Model Improvement Program. */\n mipOptOut: z.boolean().nullish(),\n /** Label your requests for the purpose of identification during usage reporting. */\n tag: z.union([z.string(), z.array(z.string())]).nullish(),\n});\n\nexport type DeepgramSpeechModelOptions = z.infer<\n typeof deepgramSpeechModelOptionsSchema\n>;\n","// Version string of this package injected at build time.\ndeclare const __PACKAGE_VERSION__: string | undefined;\nexport const VERSION: string =\n typeof __PACKAGE_VERSION__ !== 'undefined'\n ? __PACKAGE_VERSION__\n : '0.0.0-test';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;;;ACTP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,KAAAA,UAAS;;;ACVlB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAExC,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC9C,OAAO,EAAE,OAAO;AAAA,IACd,SAAS,EAAE,OAAO;AAAA,IAClB,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAIM,IAAM,gCAAgC,+BAA+B;AAAA,EAC1E,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK,MAAM;AACrC,CAAC;;;ACfD,SAAS,KAAAC,UAA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M,2BAA2B,CAAC,YAChC,IAAI,2BAA2B,SAAS;AAAA,IACtC,UAAU;AAAA,IACV,KAAK,CAAC,EAAE,KAAK,MAAM,2BAA2B,IAAI;AAAA,IAClD,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,oBAAoB,CAAC,YACzB,IAAI,oBAAoB,SAAS;AAAA,IAC/B,UAAU;AAAA,IACV,KAAK,CAAC,EAAE,KAAK,MAAM,2BAA2B,IAAI;AAAA,IAClD,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,WAAW,SAAU,SAAuC;AAChE,WAAO;AAAA,MACL,eAAe,yBAAyB,OAAO;AAAA,IACjD;AAAA,EACF;AAEA,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,qBAAqB;AAC9B,WAAS,SAAS;AAClB,WAAS,cAAc;AAGvB,WAAS,gBAAgB,CAAC,YAAoB;AAC5C,UAAM,IAAI,iBAAiB;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iBAAiB;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACA,WAAS,qBAAqB,SAAS;AAEvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB;AAAA,MACzB;AAAA,MACA,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AAEA,SAAO;AACT;AAKO,IAAM,WAAW,eAAe;","names":["z","z","z","combineHeaders","parseProviderOptions","serializeModelOptions","WORKFLOW_SERIALIZE","WORKFLOW_DESERIALIZE","z","WORKFLOW_SERIALIZE","serializeModelOptions","WORKFLOW_DESERIALIZE","parseProviderOptions","combineHeaders"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/deepgram",
3
- "version": "3.0.0-beta.30",
3
+ "version": "3.0.0-beta.31",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@ai-sdk/provider": "4.0.0-beta.14",
33
- "@ai-sdk/provider-utils": "5.0.0-beta.29"
33
+ "@ai-sdk/provider-utils": "5.0.0-beta.30"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.17.24",
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ // https://developers.deepgram.com/reference/text-to-speech/speak-request
4
+ export const deepgramSpeechModelOptionsSchema = z.object({
5
+ /** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */
6
+ bitRate: z.union([z.number(), z.string()]).nullish(),
7
+ /** Container format for the output audio (mp3, wav, etc.). */
8
+ container: z.string().nullish(),
9
+ /** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */
10
+ encoding: z.string().nullish(),
11
+ /** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */
12
+ sampleRate: z.number().nullish(),
13
+ /** URL to which we'll make the callback request. */
14
+ callback: z.string().url().nullish(),
15
+ /** HTTP method by which the callback request will be made (POST or PUT). */
16
+ callbackMethod: z.enum(['POST', 'PUT']).nullish(),
17
+ /** Opts out requests from the Deepgram Model Improvement Program. */
18
+ mipOptOut: z.boolean().nullish(),
19
+ /** Label your requests for the purpose of identification during usage reporting. */
20
+ tag: z.union([z.string(), z.array(z.string())]).nullish(),
21
+ });
22
+
23
+ export type DeepgramSpeechModelOptions = z.infer<
24
+ typeof deepgramSpeechModelOptionsSchema
25
+ >;
@@ -8,35 +8,11 @@ import {
8
8
  WORKFLOW_SERIALIZE,
9
9
  WORKFLOW_DESERIALIZE,
10
10
  } from '@ai-sdk/provider-utils';
11
- import { z } from 'zod/v4';
12
11
  import type { DeepgramConfig } from './deepgram-config';
13
12
  import { deepgramFailedResponseHandler } from './deepgram-error';
13
+ import { deepgramSpeechModelOptionsSchema } from './deepgram-speech-model-options';
14
14
  import type { DeepgramSpeechModelId } from './deepgram-speech-options';
15
15
 
16
- // https://developers.deepgram.com/reference/text-to-speech/speak-request
17
- const deepgramSpeechModelOptionsSchema = z.object({
18
- /** Bitrate of the audio in bits per second. Can be a number or predefined enum value. */
19
- bitRate: z.union([z.number(), z.string()]).nullish(),
20
- /** Container format for the output audio (mp3, wav, etc.). */
21
- container: z.string().nullish(),
22
- /** Encoding type for the audio output (linear16, mulaw, alaw, etc.). */
23
- encoding: z.string().nullish(),
24
- /** Sample rate for the output audio in Hz (8000, 16000, 24000, 44100, 48000). */
25
- sampleRate: z.number().nullish(),
26
- /** URL to which we'll make the callback request. */
27
- callback: z.string().url().nullish(),
28
- /** HTTP method by which the callback request will be made (POST or PUT). */
29
- callbackMethod: z.enum(['POST', 'PUT']).nullish(),
30
- /** Opts out requests from the Deepgram Model Improvement Program. */
31
- mipOptOut: z.boolean().nullish(),
32
- /** Label your requests for the purpose of identification during usage reporting. */
33
- tag: z.union([z.string(), z.array(z.string())]).nullish(),
34
- });
35
-
36
- export type DeepgramSpeechModelOptions = z.infer<
37
- typeof deepgramSpeechModelOptionsSchema
38
- >;
39
-
40
16
  interface DeepgramSpeechModelConfig extends DeepgramConfig {
41
17
  _internal?: {
42
18
  currentDate?: () => Date;
@@ -0,0 +1,45 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ // https://developers.deepgram.com/docs/pre-recorded-audio#results
4
+ export const deepgramTranscriptionModelOptionsSchema = z.object({
5
+ /** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */
6
+ language: z.string().nullish(),
7
+ /** Whether to enable automatic language detection. When true, Deepgram will detect the language of the audio. */
8
+ detectLanguage: z.boolean().nullish(),
9
+ /** Whether to use smart formatting, which formats written-out numbers, dates, times, etc. */
10
+ smartFormat: z.boolean().nullish(),
11
+ /** Whether to add punctuation to the transcript. */
12
+ punctuate: z.boolean().nullish(),
13
+ /** Whether to format the transcript into paragraphs. */
14
+ paragraphs: z.boolean().nullish(),
15
+ /** Whether to generate a summary of the transcript. Use 'v2' for the latest version or false to disable. */
16
+ summarize: z.union([z.literal('v2'), z.literal(false)]).nullish(),
17
+ /** Whether to identify topics in the transcript. */
18
+ topics: z.boolean().nullish(),
19
+ /** Whether to identify intents in the transcript. */
20
+ intents: z.boolean().nullish(),
21
+ /** Whether to analyze sentiment in the transcript. */
22
+ sentiment: z.boolean().nullish(),
23
+ /** Whether to detect and tag named entities in the transcript. */
24
+ detectEntities: z.boolean().nullish(),
25
+ /** Specify terms or patterns to redact from the transcript. Can be a string or array of strings. */
26
+ redact: z.union([z.string(), z.array(z.string())]).nullish(),
27
+ /** String to replace redacted content with. */
28
+ replace: z.string().nullish(),
29
+ /** Term or phrase to search for in the transcript. */
30
+ search: z.string().nullish(),
31
+ /** Key term to identify in the transcript. */
32
+ keyterm: z.string().nullish(),
33
+ /** Whether to identify different speakers in the audio. */
34
+ diarize: z.boolean().nullish(),
35
+ /** Whether to segment the transcript into utterances. */
36
+ utterances: z.boolean().nullish(),
37
+ /** Minimum duration of silence (in seconds) to trigger a new utterance. */
38
+ uttSplit: z.number().nullish(),
39
+ /** Whether to include filler words (um, uh, etc.) in the transcript. */
40
+ fillerWords: z.boolean().nullish(),
41
+ });
42
+
43
+ export type DeepgramTranscriptionModelOptions = z.infer<
44
+ typeof deepgramTranscriptionModelOptionsSchema
45
+ >;
@@ -12,52 +12,9 @@ import { z } from 'zod/v4';
12
12
  import type { DeepgramTranscriptionAPITypes } from './deepgram-api-types';
13
13
  import type { DeepgramConfig } from './deepgram-config';
14
14
  import { deepgramFailedResponseHandler } from './deepgram-error';
15
+ import { deepgramTranscriptionModelOptionsSchema } from './deepgram-transcription-model-options';
15
16
  import type { DeepgramTranscriptionModelId } from './deepgram-transcription-options';
16
17
 
17
- // https://developers.deepgram.com/docs/pre-recorded-audio#results
18
- const deepgramTranscriptionModelOptionsSchema = z.object({
19
- /** Language to use for transcription. If not specified, Deepgram defaults to English. Use `detectLanguage: true` to enable automatic language detection. */
20
- language: z.string().nullish(),
21
- /** Whether to enable automatic language detection. When true, Deepgram will detect the language of the audio. */
22
- detectLanguage: z.boolean().nullish(),
23
- /** Whether to use smart formatting, which formats written-out numbers, dates, times, etc. */
24
- smartFormat: z.boolean().nullish(),
25
- /** Whether to add punctuation to the transcript. */
26
- punctuate: z.boolean().nullish(),
27
- /** Whether to format the transcript into paragraphs. */
28
- paragraphs: z.boolean().nullish(),
29
- /** Whether to generate a summary of the transcript. Use 'v2' for the latest version or false to disable. */
30
- summarize: z.union([z.literal('v2'), z.literal(false)]).nullish(),
31
- /** Whether to identify topics in the transcript. */
32
- topics: z.boolean().nullish(),
33
- /** Whether to identify intents in the transcript. */
34
- intents: z.boolean().nullish(),
35
- /** Whether to analyze sentiment in the transcript. */
36
- sentiment: z.boolean().nullish(),
37
- /** Whether to detect and tag named entities in the transcript. */
38
- detectEntities: z.boolean().nullish(),
39
- /** Specify terms or patterns to redact from the transcript. Can be a string or array of strings. */
40
- redact: z.union([z.string(), z.array(z.string())]).nullish(),
41
- /** String to replace redacted content with. */
42
- replace: z.string().nullish(),
43
- /** Term or phrase to search for in the transcript. */
44
- search: z.string().nullish(),
45
- /** Key term to identify in the transcript. */
46
- keyterm: z.string().nullish(),
47
- /** Whether to identify different speakers in the audio. */
48
- diarize: z.boolean().nullish(),
49
- /** Whether to segment the transcript into utterances. */
50
- utterances: z.boolean().nullish(),
51
- /** Minimum duration of silence (in seconds) to trigger a new utterance. */
52
- uttSplit: z.number().nullish(),
53
- /** Whether to include filler words (um, uh, etc.) in the transcript. */
54
- fillerWords: z.boolean().nullish(),
55
- });
56
-
57
- export type DeepgramTranscriptionModelOptions = z.infer<
58
- typeof deepgramTranscriptionModelOptionsSchema
59
- >;
60
-
61
18
  interface DeepgramTranscriptionModelConfig extends DeepgramConfig {
62
19
  _internal?: {
63
20
  currentDate?: () => Date;
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@ export type {
8
8
  DeepgramSpeechModelOptions,
9
9
  /** @deprecated Use `DeepgramSpeechModelOptions` instead. */
10
10
  DeepgramSpeechModelOptions as DeepgramSpeechCallOptions,
11
- } from './deepgram-speech-model';
11
+ } from './deepgram-speech-model-options';
12
12
  export type { DeepgramSpeechModelId } from './deepgram-speech-options';
13
- export type { DeepgramTranscriptionModelOptions } from './deepgram-transcription-model';
13
+ export type { DeepgramTranscriptionModelOptions } from './deepgram-transcription-model-options';
14
14
  export { VERSION } from './version';