@ai-sdk/hume 0.0.0-64aae7dd-20260114144918

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/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023 Vercel, Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # AI SDK - Hume Provider
2
+
3
+ The **[Hume provider](https://ai-sdk.dev/providers/ai-sdk-providers/hume)** for the [AI SDK](https://ai-sdk.dev/docs)
4
+ contains support for the Hume API.
5
+
6
+ ## Setup
7
+
8
+ The Hume provider is available in the `@ai-sdk/hume` module. You can install it with
9
+
10
+ ```bash
11
+ npm i @ai-sdk/hume
12
+ ```
13
+
14
+ ## Provider Instance
15
+
16
+ You can import the default provider instance `hume` from `@ai-sdk/hume`:
17
+
18
+ ```ts
19
+ import { hume } from '@ai-sdk/hume';
20
+ ```
21
+
22
+ ## Example
23
+
24
+ ```ts
25
+ import { hume } from '@ai-sdk/hume';
26
+ import { experimental_generateSpeech as generateSpeech } from 'ai';
27
+
28
+ const result = await generateSpeech({
29
+ model: hume.speech('aurora'),
30
+ text: 'Hello, world!',
31
+ });
32
+ ```
33
+
34
+ ## Documentation
35
+
36
+ Please check out the **[Hume provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/hume)** for more information.
@@ -0,0 +1,65 @@
1
+ import { SpeechModelV3, ProviderV3 } from '@ai-sdk/provider';
2
+ import { FetchFunction } from '@ai-sdk/provider-utils';
3
+
4
+ type HumeConfig = {
5
+ provider: string;
6
+ url: (options: {
7
+ modelId: string;
8
+ path: string;
9
+ }) => string;
10
+ headers: () => Record<string, string | undefined>;
11
+ fetch?: FetchFunction;
12
+ generateId?: () => string;
13
+ };
14
+
15
+ interface HumeSpeechModelConfig extends HumeConfig {
16
+ _internal?: {
17
+ currentDate?: () => Date;
18
+ };
19
+ }
20
+ declare class HumeSpeechModel implements SpeechModelV3 {
21
+ readonly modelId: '';
22
+ private readonly config;
23
+ readonly specificationVersion = "v3";
24
+ get provider(): string;
25
+ constructor(modelId: '', config: HumeSpeechModelConfig);
26
+ private getArgs;
27
+ doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
28
+ }
29
+
30
+ interface HumeProvider extends Pick<ProviderV3, 'speechModel'> {
31
+ (settings?: {}): {
32
+ speech: HumeSpeechModel;
33
+ };
34
+ /**
35
+ Creates a model for speech synthesis.
36
+ */
37
+ speech(): SpeechModelV3;
38
+ }
39
+ interface HumeProviderSettings {
40
+ /**
41
+ API key for authenticating requests.
42
+ */
43
+ apiKey?: string;
44
+ /**
45
+ Custom headers to include in the requests.
46
+ */
47
+ headers?: Record<string, string>;
48
+ /**
49
+ Custom fetch implementation. You can use it as a middleware to intercept requests,
50
+ or to provide a custom fetch implementation for e.g. testing.
51
+ */
52
+ fetch?: FetchFunction;
53
+ }
54
+ /**
55
+ Create an Hume provider instance.
56
+ */
57
+ declare function createHume(options?: HumeProviderSettings): HumeProvider;
58
+ /**
59
+ Default Hume provider instance.
60
+ */
61
+ declare const hume: HumeProvider;
62
+
63
+ declare const VERSION: string;
64
+
65
+ export { type HumeProvider, type HumeProviderSettings, VERSION, createHume, hume };
@@ -0,0 +1,65 @@
1
+ import { SpeechModelV3, ProviderV3 } from '@ai-sdk/provider';
2
+ import { FetchFunction } from '@ai-sdk/provider-utils';
3
+
4
+ type HumeConfig = {
5
+ provider: string;
6
+ url: (options: {
7
+ modelId: string;
8
+ path: string;
9
+ }) => string;
10
+ headers: () => Record<string, string | undefined>;
11
+ fetch?: FetchFunction;
12
+ generateId?: () => string;
13
+ };
14
+
15
+ interface HumeSpeechModelConfig extends HumeConfig {
16
+ _internal?: {
17
+ currentDate?: () => Date;
18
+ };
19
+ }
20
+ declare class HumeSpeechModel implements SpeechModelV3 {
21
+ readonly modelId: '';
22
+ private readonly config;
23
+ readonly specificationVersion = "v3";
24
+ get provider(): string;
25
+ constructor(modelId: '', config: HumeSpeechModelConfig);
26
+ private getArgs;
27
+ doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
28
+ }
29
+
30
+ interface HumeProvider extends Pick<ProviderV3, 'speechModel'> {
31
+ (settings?: {}): {
32
+ speech: HumeSpeechModel;
33
+ };
34
+ /**
35
+ Creates a model for speech synthesis.
36
+ */
37
+ speech(): SpeechModelV3;
38
+ }
39
+ interface HumeProviderSettings {
40
+ /**
41
+ API key for authenticating requests.
42
+ */
43
+ apiKey?: string;
44
+ /**
45
+ Custom headers to include in the requests.
46
+ */
47
+ headers?: Record<string, string>;
48
+ /**
49
+ Custom fetch implementation. You can use it as a middleware to intercept requests,
50
+ or to provide a custom fetch implementation for e.g. testing.
51
+ */
52
+ fetch?: FetchFunction;
53
+ }
54
+ /**
55
+ Create an Hume provider instance.
56
+ */
57
+ declare function createHume(options?: HumeProviderSettings): HumeProvider;
58
+ /**
59
+ Default Hume provider instance.
60
+ */
61
+ declare const hume: HumeProvider;
62
+
63
+ declare const VERSION: string;
64
+
65
+ export { type HumeProvider, type HumeProviderSettings, VERSION, createHume, hume };
package/dist/index.js ADDED
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ VERSION: () => VERSION,
24
+ createHume: () => createHume,
25
+ hume: () => hume
26
+ });
27
+ module.exports = __toCommonJS(src_exports);
28
+
29
+ // src/hume-provider.ts
30
+ var import_provider_utils3 = require("@ai-sdk/provider-utils");
31
+
32
+ // src/hume-speech-model.ts
33
+ var import_provider_utils2 = require("@ai-sdk/provider-utils");
34
+ var import_v42 = require("zod/v4");
35
+
36
+ // src/hume-error.ts
37
+ var import_v4 = require("zod/v4");
38
+ var import_provider_utils = require("@ai-sdk/provider-utils");
39
+ var humeErrorDataSchema = import_v4.z.object({
40
+ error: import_v4.z.object({
41
+ message: import_v4.z.string(),
42
+ code: import_v4.z.number()
43
+ })
44
+ });
45
+ var humeFailedResponseHandler = (0, import_provider_utils.createJsonErrorResponseHandler)({
46
+ errorSchema: humeErrorDataSchema,
47
+ errorToMessage: (data) => data.error.message
48
+ });
49
+
50
+ // src/hume-speech-model.ts
51
+ var humeSpeechCallOptionsSchema = import_v42.z.object({
52
+ /**
53
+ * Context for the speech synthesis request.
54
+ * Can be either a generationId for retrieving a previous generation,
55
+ * or a list of utterances to synthesize.
56
+ */
57
+ context: import_v42.z.object({
58
+ /**
59
+ * ID of a previously generated speech synthesis to retrieve.
60
+ */
61
+ generationId: import_v42.z.string()
62
+ }).or(
63
+ import_v42.z.object({
64
+ /**
65
+ * List of utterances to synthesize into speech.
66
+ */
67
+ utterances: import_v42.z.array(
68
+ import_v42.z.object({
69
+ /**
70
+ * The text content to convert to speech.
71
+ */
72
+ text: import_v42.z.string(),
73
+ /**
74
+ * Optional description or instructions for how the text should be spoken.
75
+ */
76
+ description: import_v42.z.string().optional(),
77
+ /**
78
+ * Optional speech rate multiplier.
79
+ */
80
+ speed: import_v42.z.number().optional(),
81
+ /**
82
+ * Optional duration of silence to add after the utterance in seconds.
83
+ */
84
+ trailingSilence: import_v42.z.number().optional(),
85
+ /**
86
+ * Voice configuration for the utterance.
87
+ * Can be specified by ID or name.
88
+ */
89
+ voice: import_v42.z.object({
90
+ /**
91
+ * ID of the voice to use.
92
+ */
93
+ id: import_v42.z.string(),
94
+ /**
95
+ * Provider of the voice, either Hume's built-in voices or a custom voice.
96
+ */
97
+ provider: import_v42.z.enum(["HUME_AI", "CUSTOM_VOICE"]).optional()
98
+ }).or(
99
+ import_v42.z.object({
100
+ /**
101
+ * Name of the voice to use.
102
+ */
103
+ name: import_v42.z.string(),
104
+ /**
105
+ * Provider of the voice, either Hume's built-in voices or a custom voice.
106
+ */
107
+ provider: import_v42.z.enum(["HUME_AI", "CUSTOM_VOICE"]).optional()
108
+ })
109
+ ).optional()
110
+ })
111
+ )
112
+ })
113
+ ).nullish()
114
+ });
115
+ var HumeSpeechModel = class {
116
+ constructor(modelId, config) {
117
+ this.modelId = modelId;
118
+ this.config = config;
119
+ this.specificationVersion = "v3";
120
+ }
121
+ get provider() {
122
+ return this.config.provider;
123
+ }
124
+ async getArgs({
125
+ text,
126
+ voice = "d8ab67c6-953d-4bd8-9370-8fa53a0f1453",
127
+ outputFormat = "mp3",
128
+ speed,
129
+ instructions,
130
+ language,
131
+ providerOptions
132
+ }) {
133
+ const warnings = [];
134
+ const humeOptions = await (0, import_provider_utils2.parseProviderOptions)({
135
+ provider: "hume",
136
+ providerOptions,
137
+ schema: humeSpeechCallOptionsSchema
138
+ });
139
+ const requestBody = {
140
+ utterances: [
141
+ {
142
+ text,
143
+ speed,
144
+ description: instructions,
145
+ voice: {
146
+ id: voice,
147
+ provider: "HUME_AI"
148
+ }
149
+ }
150
+ ],
151
+ format: { type: "mp3" }
152
+ };
153
+ if (outputFormat) {
154
+ if (["mp3", "pcm", "wav"].includes(outputFormat)) {
155
+ requestBody.format = { type: outputFormat };
156
+ } else {
157
+ warnings.push({
158
+ type: "unsupported",
159
+ feature: "outputFormat",
160
+ details: `Unsupported output format: ${outputFormat}. Using mp3 instead.`
161
+ });
162
+ }
163
+ }
164
+ if (humeOptions) {
165
+ const speechModelOptions = {};
166
+ if (humeOptions.context) {
167
+ if ("generationId" in humeOptions.context) {
168
+ speechModelOptions.context = {
169
+ generation_id: humeOptions.context.generationId
170
+ };
171
+ } else {
172
+ speechModelOptions.context = {
173
+ utterances: humeOptions.context.utterances.map((utterance) => ({
174
+ text: utterance.text,
175
+ description: utterance.description,
176
+ speed: utterance.speed,
177
+ trailing_silence: utterance.trailingSilence,
178
+ voice: utterance.voice
179
+ }))
180
+ };
181
+ }
182
+ }
183
+ for (const key in speechModelOptions) {
184
+ const value = speechModelOptions[key];
185
+ if (value !== void 0) {
186
+ requestBody[key] = value;
187
+ }
188
+ }
189
+ }
190
+ if (language) {
191
+ warnings.push({
192
+ type: "unsupported",
193
+ feature: "language",
194
+ details: `Hume speech models do not support language selection. Language parameter "${language}" was ignored.`
195
+ });
196
+ }
197
+ return {
198
+ requestBody,
199
+ warnings
200
+ };
201
+ }
202
+ async doGenerate(options) {
203
+ var _a, _b, _c;
204
+ const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
205
+ const { requestBody, warnings } = await this.getArgs(options);
206
+ const {
207
+ value: audio,
208
+ responseHeaders,
209
+ rawValue: rawResponse
210
+ } = await (0, import_provider_utils2.postJsonToApi)({
211
+ url: this.config.url({
212
+ path: "/v0/tts/file",
213
+ modelId: this.modelId
214
+ }),
215
+ headers: (0, import_provider_utils2.combineHeaders)(this.config.headers(), options.headers),
216
+ body: requestBody,
217
+ failedResponseHandler: humeFailedResponseHandler,
218
+ successfulResponseHandler: (0, import_provider_utils2.createBinaryResponseHandler)(),
219
+ abortSignal: options.abortSignal,
220
+ fetch: this.config.fetch
221
+ });
222
+ return {
223
+ audio,
224
+ warnings,
225
+ request: {
226
+ body: JSON.stringify(requestBody)
227
+ },
228
+ response: {
229
+ timestamp: currentDate,
230
+ modelId: this.modelId,
231
+ headers: responseHeaders,
232
+ body: rawResponse
233
+ }
234
+ };
235
+ }
236
+ };
237
+
238
+ // src/version.ts
239
+ var VERSION = true ? "0.0.0-64aae7dd-20260114144918" : "0.0.0-test";
240
+
241
+ // src/hume-provider.ts
242
+ function createHume(options = {}) {
243
+ const getHeaders = () => (0, import_provider_utils3.withUserAgentSuffix)(
244
+ {
245
+ "X-Hume-Api-Key": (0, import_provider_utils3.loadApiKey)({
246
+ apiKey: options.apiKey,
247
+ environmentVariableName: "HUME_API_KEY",
248
+ description: "Hume"
249
+ }),
250
+ ...options.headers
251
+ },
252
+ `ai-sdk/hume/${VERSION}`
253
+ );
254
+ const createSpeechModel = () => new HumeSpeechModel("", {
255
+ provider: `hume.speech`,
256
+ url: ({ path }) => `https://api.hume.ai${path}`,
257
+ headers: getHeaders,
258
+ fetch: options.fetch
259
+ });
260
+ const provider = function() {
261
+ return {
262
+ speech: createSpeechModel()
263
+ };
264
+ };
265
+ provider.speech = createSpeechModel;
266
+ provider.speechModel = createSpeechModel;
267
+ return provider;
268
+ }
269
+ var hume = createHume();
270
+ // Annotate the CommonJS export names for ESM import in node:
271
+ 0 && (module.exports = {
272
+ VERSION,
273
+ createHume,
274
+ hume
275
+ });
276
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/hume-provider.ts","../src/hume-speech-model.ts","../src/hume-error.ts","../src/version.ts"],"sourcesContent":["export { createHume, hume } from './hume-provider';\nexport type { HumeProvider, HumeProviderSettings } from './hume-provider';\nexport { VERSION } from './version';\n","import { SpeechModelV3, ProviderV3 } from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { HumeSpeechModel } from './hume-speech-model';\nimport { VERSION } from './version';\n\nexport interface HumeProvider extends Pick<ProviderV3, 'speechModel'> {\n (settings?: {}): {\n speech: HumeSpeechModel;\n };\n\n /**\nCreates a model for speech synthesis.\n */\n speech(): SpeechModelV3;\n}\n\nexport interface HumeProviderSettings {\n /**\nAPI key for authenticating requests.\n */\n apiKey?: string;\n\n /**\nCustom headers to include in the requests.\n */\n headers?: Record<string, string>;\n\n /**\nCustom fetch implementation. You can use it as a middleware to intercept requests,\nor to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\nCreate an Hume provider instance.\n */\nexport function createHume(options: HumeProviderSettings = {}): HumeProvider {\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n 'X-Hume-Api-Key': loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'HUME_API_KEY',\n description: 'Hume',\n }),\n ...options.headers,\n },\n `ai-sdk/hume/${VERSION}`,\n );\n\n const createSpeechModel = () =>\n new HumeSpeechModel('', {\n provider: `hume.speech`,\n url: ({ path }) => `https://api.hume.ai${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const provider = function () {\n return {\n speech: createSpeechModel(),\n };\n };\n\n provider.speech = createSpeechModel;\n provider.speechModel = createSpeechModel;\n\n return provider satisfies HumeProvider;\n}\n\n/**\nDefault Hume provider instance.\n */\nexport const hume = createHume();\n","import { SpeechModelV3, SharedV3Warning } from '@ai-sdk/provider';\nimport {\n combineHeaders,\n createBinaryResponseHandler,\n parseProviderOptions,\n postJsonToApi,\n} from '@ai-sdk/provider-utils';\nimport { z } from 'zod/v4';\nimport { HumeConfig } from './hume-config';\nimport { humeFailedResponseHandler } from './hume-error';\nimport { HumeSpeechAPITypes } from './hume-api-types';\n\n// https://dev.hume.ai/reference/text-to-speech-tts/synthesize-file\nconst humeSpeechCallOptionsSchema = z.object({\n /**\n * Context for the speech synthesis request.\n * Can be either a generationId for retrieving a previous generation,\n * or a list of utterances to synthesize.\n */\n context: z\n .object({\n /**\n * ID of a previously generated speech synthesis to retrieve.\n */\n generationId: z.string(),\n })\n .or(\n z.object({\n /**\n * List of utterances to synthesize into speech.\n */\n utterances: z.array(\n z.object({\n /**\n * The text content to convert to speech.\n */\n text: z.string(),\n /**\n * Optional description or instructions for how the text should be spoken.\n */\n description: z.string().optional(),\n /**\n * Optional speech rate multiplier.\n */\n speed: z.number().optional(),\n /**\n * Optional duration of silence to add after the utterance in seconds.\n */\n trailingSilence: z.number().optional(),\n /**\n * Voice configuration for the utterance.\n * Can be specified by ID or name.\n */\n voice: z\n .object({\n /**\n * ID of the voice to use.\n */\n id: z.string(),\n /**\n * Provider of the voice, either Hume's built-in voices or a custom voice.\n */\n provider: z.enum(['HUME_AI', 'CUSTOM_VOICE']).optional(),\n })\n .or(\n z.object({\n /**\n * Name of the voice to use.\n */\n name: z.string(),\n /**\n * Provider of the voice, either Hume's built-in voices or a custom voice.\n */\n provider: z.enum(['HUME_AI', 'CUSTOM_VOICE']).optional(),\n }),\n )\n .optional(),\n }),\n ),\n }),\n )\n .nullish(),\n});\n\nexport type HumeSpeechCallOptions = z.infer<typeof humeSpeechCallOptionsSchema>;\n\ninterface HumeSpeechModelConfig extends HumeConfig {\n _internal?: {\n currentDate?: () => Date;\n };\n}\n\nexport class HumeSpeechModel implements SpeechModelV3 {\n readonly specificationVersion = 'v3';\n\n get provider(): string {\n return this.config.provider;\n }\n\n constructor(\n readonly modelId: '',\n private readonly config: HumeSpeechModelConfig,\n ) {}\n\n private async getArgs({\n text,\n voice = 'd8ab67c6-953d-4bd8-9370-8fa53a0f1453',\n outputFormat = 'mp3',\n speed,\n instructions,\n language,\n providerOptions,\n }: Parameters<SpeechModelV3['doGenerate']>[0]) {\n const warnings: SharedV3Warning[] = [];\n\n // Parse provider options\n const humeOptions = await parseProviderOptions({\n provider: 'hume',\n providerOptions,\n schema: humeSpeechCallOptionsSchema,\n });\n\n // Create request body\n const requestBody: HumeSpeechAPITypes = {\n utterances: [\n {\n text,\n speed,\n description: instructions,\n voice: {\n id: voice,\n provider: 'HUME_AI',\n },\n },\n ],\n format: { type: 'mp3' },\n };\n\n if (outputFormat) {\n if (['mp3', 'pcm', 'wav'].includes(outputFormat)) {\n requestBody.format = { type: outputFormat as 'mp3' | 'pcm' | 'wav' };\n } else {\n warnings.push({\n type: 'unsupported',\n feature: 'outputFormat',\n details: `Unsupported output format: ${outputFormat}. Using mp3 instead.`,\n });\n }\n }\n\n // Add provider-specific options\n if (humeOptions) {\n const speechModelOptions: Omit<\n HumeSpeechAPITypes,\n 'utterances' | 'format'\n > = {};\n\n if (humeOptions.context) {\n if ('generationId' in humeOptions.context) {\n speechModelOptions.context = {\n generation_id: humeOptions.context.generationId,\n };\n } else {\n speechModelOptions.context = {\n utterances: humeOptions.context.utterances.map(utterance => ({\n text: utterance.text,\n description: utterance.description,\n speed: utterance.speed,\n trailing_silence: utterance.trailingSilence,\n voice: utterance.voice,\n })),\n };\n }\n }\n\n for (const key in speechModelOptions) {\n const value =\n speechModelOptions[\n key as keyof Omit<HumeSpeechAPITypes, 'utterances' | 'format'>\n ];\n if (value !== undefined) {\n (requestBody as Record<string, unknown>)[key] = value;\n }\n }\n }\n\n if (language) {\n warnings.push({\n type: 'unsupported',\n feature: 'language',\n details: `Hume speech models do not support language selection. Language parameter \"${language}\" was ignored.`,\n });\n }\n\n return {\n requestBody,\n warnings,\n };\n }\n\n async doGenerate(\n options: Parameters<SpeechModelV3['doGenerate']>[0],\n ): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>> {\n const currentDate = this.config._internal?.currentDate?.() ?? new Date();\n const { requestBody, warnings } = await this.getArgs(options);\n\n const {\n value: audio,\n responseHeaders,\n rawValue: rawResponse,\n } = await postJsonToApi({\n url: this.config.url({\n path: '/v0/tts/file',\n modelId: this.modelId,\n }),\n headers: combineHeaders(this.config.headers(), options.headers),\n body: requestBody,\n failedResponseHandler: humeFailedResponseHandler,\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';\nimport { createJsonErrorResponseHandler } from '@ai-sdk/provider-utils';\n\nexport const humeErrorDataSchema = z.object({\n error: z.object({\n message: z.string(),\n code: z.number(),\n }),\n});\n\nexport type HumeErrorData = z.infer<typeof humeErrorDataSchema>;\n\nexport const humeFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: humeErrorDataSchema,\n errorToMessage: data => data.error.message,\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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,yBAIO;;;ACJP,IAAAC,yBAKO;AACP,IAAAC,aAAkB;;;ACPlB,gBAAkB;AAClB,4BAA+C;AAExC,IAAM,sBAAsB,YAAE,OAAO;AAAA,EAC1C,OAAO,YAAE,OAAO;AAAA,IACd,SAAS,YAAE,OAAO;AAAA,IAClB,MAAM,YAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAIM,IAAM,gCAA4B,sDAA+B;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK,MAAM;AACrC,CAAC;;;ADFD,IAAM,8BAA8B,aAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3C,SAAS,aACN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIN,cAAc,aAAE,OAA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