@ai-sdk/lmnt 3.0.0-beta.5 → 3.0.0-beta.50
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 +370 -0
- package/README.md +3 -1
- package/dist/index.d.ts +34 -24
- package/dist/index.js +79 -61
- package/dist/index.js.map +1 -1
- package/docs/140-lmnt.mdx +2 -2
- package/package.json +14 -14
- package/src/index.ts +1 -1
- package/src/lmnt-config.ts +2 -2
- package/src/lmnt-provider.ts +33 -4
- package/src/lmnt-speech-model-options.ts +69 -0
- package/src/lmnt-speech-model.ts +23 -74
- package/dist/index.d.mts +0 -89
- package/dist/index.mjs +0 -216
- package/dist/index.mjs.map +0 -1
package/dist/index.d.mts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { SpeechModelV4, ProviderV4 } from '@ai-sdk/provider';
|
|
2
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod/v4';
|
|
4
|
-
|
|
5
|
-
type LMNTConfig = {
|
|
6
|
-
provider: string;
|
|
7
|
-
url: (options: {
|
|
8
|
-
modelId: string;
|
|
9
|
-
path: string;
|
|
10
|
-
}) => string;
|
|
11
|
-
headers: () => Record<string, string | undefined>;
|
|
12
|
-
fetch?: FetchFunction;
|
|
13
|
-
generateId?: () => string;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type LMNTSpeechModelId = 'aurora' | 'blizzard' | (string & {});
|
|
17
|
-
|
|
18
|
-
declare const lmntSpeechModelOptionsSchema: z.ZodObject<{
|
|
19
|
-
model: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
|
|
20
|
-
aurora: "aurora";
|
|
21
|
-
blizzard: "blizzard";
|
|
22
|
-
}>, z.ZodString]>>>>;
|
|
23
|
-
format: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
24
|
-
aac: "aac";
|
|
25
|
-
mp3: "mp3";
|
|
26
|
-
mulaw: "mulaw";
|
|
27
|
-
raw: "raw";
|
|
28
|
-
wav: "wav";
|
|
29
|
-
}>>>>;
|
|
30
|
-
sampleRate: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<8000>, z.ZodLiteral<16000>, z.ZodLiteral<24000>]>>>>;
|
|
31
|
-
speed: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
32
|
-
seed: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
33
|
-
conversational: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>;
|
|
34
|
-
length: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
35
|
-
topP: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
36
|
-
temperature: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
37
|
-
}, z.core.$strip>;
|
|
38
|
-
type LMNTSpeechModelOptions = z.infer<typeof lmntSpeechModelOptionsSchema>;
|
|
39
|
-
interface LMNTSpeechModelConfig extends LMNTConfig {
|
|
40
|
-
_internal?: {
|
|
41
|
-
currentDate?: () => Date;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
declare class LMNTSpeechModel implements SpeechModelV4 {
|
|
45
|
-
readonly modelId: LMNTSpeechModelId;
|
|
46
|
-
private readonly config;
|
|
47
|
-
readonly specificationVersion = "v4";
|
|
48
|
-
get provider(): string;
|
|
49
|
-
constructor(modelId: LMNTSpeechModelId, config: LMNTSpeechModelConfig);
|
|
50
|
-
private getArgs;
|
|
51
|
-
doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface LMNTProvider extends Pick<ProviderV4, 'speechModel'> {
|
|
55
|
-
(modelId: 'aurora', settings?: {}): {
|
|
56
|
-
speech: LMNTSpeechModel;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Creates a model for speech synthesis.
|
|
60
|
-
*/
|
|
61
|
-
speech(modelId: LMNTSpeechModelId): SpeechModelV4;
|
|
62
|
-
}
|
|
63
|
-
interface LMNTProviderSettings {
|
|
64
|
-
/**
|
|
65
|
-
* API key for authenticating requests.
|
|
66
|
-
*/
|
|
67
|
-
apiKey?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Custom headers to include in the requests.
|
|
70
|
-
*/
|
|
71
|
-
headers?: Record<string, string>;
|
|
72
|
-
/**
|
|
73
|
-
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
74
|
-
* or to provide a custom fetch implementation for e.g. testing.
|
|
75
|
-
*/
|
|
76
|
-
fetch?: FetchFunction;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Create an LMNT provider instance.
|
|
80
|
-
*/
|
|
81
|
-
declare function createLMNT(options?: LMNTProviderSettings): LMNTProvider;
|
|
82
|
-
/**
|
|
83
|
-
* Default LMNT provider instance.
|
|
84
|
-
*/
|
|
85
|
-
declare const lmnt: LMNTProvider;
|
|
86
|
-
|
|
87
|
-
declare const VERSION: string;
|
|
88
|
-
|
|
89
|
-
export { type LMNTProvider, type LMNTProviderSettings, type LMNTSpeechModelOptions, VERSION, createLMNT, lmnt };
|
package/dist/index.mjs
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
// src/lmnt-provider.ts
|
|
2
|
-
import {
|
|
3
|
-
loadApiKey,
|
|
4
|
-
withUserAgentSuffix
|
|
5
|
-
} from "@ai-sdk/provider-utils";
|
|
6
|
-
|
|
7
|
-
// src/lmnt-speech-model.ts
|
|
8
|
-
import {
|
|
9
|
-
combineHeaders,
|
|
10
|
-
createBinaryResponseHandler,
|
|
11
|
-
parseProviderOptions,
|
|
12
|
-
postJsonToApi
|
|
13
|
-
} from "@ai-sdk/provider-utils";
|
|
14
|
-
import { z as z2 } from "zod/v4";
|
|
15
|
-
|
|
16
|
-
// src/lmnt-error.ts
|
|
17
|
-
import { z } from "zod/v4";
|
|
18
|
-
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
19
|
-
var lmntErrorDataSchema = z.object({
|
|
20
|
-
error: z.object({
|
|
21
|
-
message: z.string(),
|
|
22
|
-
code: z.number()
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
var lmntFailedResponseHandler = createJsonErrorResponseHandler({
|
|
26
|
-
errorSchema: lmntErrorDataSchema,
|
|
27
|
-
errorToMessage: (data) => data.error.message
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// src/lmnt-speech-model.ts
|
|
31
|
-
var lmntSpeechModelOptionsSchema = z2.object({
|
|
32
|
-
/**
|
|
33
|
-
* The model to use for speech synthesis e.g. 'aurora' or 'blizzard'.
|
|
34
|
-
* @default 'aurora'
|
|
35
|
-
*/
|
|
36
|
-
model: z2.union([z2.enum(["aurora", "blizzard"]), z2.string()]).nullish().default("aurora"),
|
|
37
|
-
/**
|
|
38
|
-
* The audio format of the output.
|
|
39
|
-
* @default 'mp3'
|
|
40
|
-
*/
|
|
41
|
-
format: z2.enum(["aac", "mp3", "mulaw", "raw", "wav"]).nullish().default("mp3"),
|
|
42
|
-
/**
|
|
43
|
-
* The sample rate of the output audio in Hz.
|
|
44
|
-
* @default 24000
|
|
45
|
-
*/
|
|
46
|
-
sampleRate: z2.union([z2.literal(8e3), z2.literal(16e3), z2.literal(24e3)]).nullish().default(24e3),
|
|
47
|
-
/**
|
|
48
|
-
* The speed of the speech. Range: 0.25 to 2.
|
|
49
|
-
* @default 1
|
|
50
|
-
*/
|
|
51
|
-
speed: z2.number().min(0.25).max(2).nullish().default(1),
|
|
52
|
-
/**
|
|
53
|
-
* A seed value for deterministic generation.
|
|
54
|
-
*/
|
|
55
|
-
seed: z2.number().int().nullish(),
|
|
56
|
-
/**
|
|
57
|
-
* Whether to use a conversational style.
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
conversational: z2.boolean().nullish().default(false),
|
|
61
|
-
/**
|
|
62
|
-
* Maximum length of the output in seconds (up to 300).
|
|
63
|
-
*/
|
|
64
|
-
length: z2.number().max(300).nullish(),
|
|
65
|
-
/**
|
|
66
|
-
* Top-p sampling parameter. Range: 0 to 1.
|
|
67
|
-
* @default 1
|
|
68
|
-
*/
|
|
69
|
-
topP: z2.number().min(0).max(1).nullish().default(1),
|
|
70
|
-
/**
|
|
71
|
-
* Temperature for sampling. Higher values increase randomness.
|
|
72
|
-
* @default 1
|
|
73
|
-
*/
|
|
74
|
-
temperature: z2.number().min(0).nullish().default(1)
|
|
75
|
-
});
|
|
76
|
-
var LMNTSpeechModel = class {
|
|
77
|
-
constructor(modelId, config) {
|
|
78
|
-
this.modelId = modelId;
|
|
79
|
-
this.config = config;
|
|
80
|
-
this.specificationVersion = "v4";
|
|
81
|
-
}
|
|
82
|
-
get provider() {
|
|
83
|
-
return this.config.provider;
|
|
84
|
-
}
|
|
85
|
-
async getArgs({
|
|
86
|
-
text,
|
|
87
|
-
voice = "ava",
|
|
88
|
-
outputFormat = "mp3",
|
|
89
|
-
speed,
|
|
90
|
-
language,
|
|
91
|
-
providerOptions
|
|
92
|
-
}) {
|
|
93
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
94
|
-
const warnings = [];
|
|
95
|
-
const lmntOptions = await parseProviderOptions({
|
|
96
|
-
provider: "lmnt",
|
|
97
|
-
providerOptions,
|
|
98
|
-
schema: lmntSpeechModelOptionsSchema
|
|
99
|
-
});
|
|
100
|
-
const requestBody = {
|
|
101
|
-
model: this.modelId,
|
|
102
|
-
text,
|
|
103
|
-
voice,
|
|
104
|
-
response_format: "mp3",
|
|
105
|
-
speed
|
|
106
|
-
};
|
|
107
|
-
if (outputFormat) {
|
|
108
|
-
if (["mp3", "aac", "mulaw", "raw", "wav"].includes(outputFormat)) {
|
|
109
|
-
requestBody.response_format = outputFormat;
|
|
110
|
-
} else {
|
|
111
|
-
warnings.push({
|
|
112
|
-
type: "unsupported",
|
|
113
|
-
feature: "outputFormat",
|
|
114
|
-
details: `Unsupported output format: ${outputFormat}. Using mp3 instead.`
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (lmntOptions) {
|
|
119
|
-
const speechModelOptions = {
|
|
120
|
-
conversational: (_a = lmntOptions.conversational) != null ? _a : void 0,
|
|
121
|
-
length: (_b = lmntOptions.length) != null ? _b : void 0,
|
|
122
|
-
seed: (_c = lmntOptions.seed) != null ? _c : void 0,
|
|
123
|
-
speed: (_d = lmntOptions.speed) != null ? _d : void 0,
|
|
124
|
-
temperature: (_e = lmntOptions.temperature) != null ? _e : void 0,
|
|
125
|
-
top_p: (_f = lmntOptions.topP) != null ? _f : void 0,
|
|
126
|
-
sample_rate: (_g = lmntOptions.sampleRate) != null ? _g : void 0
|
|
127
|
-
};
|
|
128
|
-
for (const key in speechModelOptions) {
|
|
129
|
-
const value = speechModelOptions[key];
|
|
130
|
-
if (value !== void 0) {
|
|
131
|
-
requestBody[key] = value;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (language) {
|
|
136
|
-
requestBody.language = language;
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
requestBody,
|
|
140
|
-
warnings
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
async doGenerate(options) {
|
|
144
|
-
var _a, _b, _c;
|
|
145
|
-
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
146
|
-
const { requestBody, warnings } = await this.getArgs(options);
|
|
147
|
-
const {
|
|
148
|
-
value: audio,
|
|
149
|
-
responseHeaders,
|
|
150
|
-
rawValue: rawResponse
|
|
151
|
-
} = await postJsonToApi({
|
|
152
|
-
url: this.config.url({
|
|
153
|
-
path: "/v1/ai/speech/bytes",
|
|
154
|
-
modelId: this.modelId
|
|
155
|
-
}),
|
|
156
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
157
|
-
body: requestBody,
|
|
158
|
-
failedResponseHandler: lmntFailedResponseHandler,
|
|
159
|
-
successfulResponseHandler: createBinaryResponseHandler(),
|
|
160
|
-
abortSignal: options.abortSignal,
|
|
161
|
-
fetch: this.config.fetch
|
|
162
|
-
});
|
|
163
|
-
return {
|
|
164
|
-
audio,
|
|
165
|
-
warnings,
|
|
166
|
-
request: {
|
|
167
|
-
body: JSON.stringify(requestBody)
|
|
168
|
-
},
|
|
169
|
-
response: {
|
|
170
|
-
timestamp: currentDate,
|
|
171
|
-
modelId: this.modelId,
|
|
172
|
-
headers: responseHeaders,
|
|
173
|
-
body: rawResponse
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// src/version.ts
|
|
180
|
-
var VERSION = true ? "3.0.0-beta.5" : "0.0.0-test";
|
|
181
|
-
|
|
182
|
-
// src/lmnt-provider.ts
|
|
183
|
-
function createLMNT(options = {}) {
|
|
184
|
-
const getHeaders = () => withUserAgentSuffix(
|
|
185
|
-
{
|
|
186
|
-
"x-api-key": loadApiKey({
|
|
187
|
-
apiKey: options.apiKey,
|
|
188
|
-
environmentVariableName: "LMNT_API_KEY",
|
|
189
|
-
description: "LMNT"
|
|
190
|
-
}),
|
|
191
|
-
...options.headers
|
|
192
|
-
},
|
|
193
|
-
`ai-sdk/lmnt/${VERSION}`
|
|
194
|
-
);
|
|
195
|
-
const createSpeechModel = (modelId) => new LMNTSpeechModel(modelId, {
|
|
196
|
-
provider: `lmnt.speech`,
|
|
197
|
-
url: ({ path }) => `https://api.lmnt.com${path}`,
|
|
198
|
-
headers: getHeaders,
|
|
199
|
-
fetch: options.fetch
|
|
200
|
-
});
|
|
201
|
-
const provider = function(modelId) {
|
|
202
|
-
return {
|
|
203
|
-
speech: createSpeechModel(modelId)
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
provider.speech = createSpeechModel;
|
|
207
|
-
provider.speechModel = createSpeechModel;
|
|
208
|
-
return provider;
|
|
209
|
-
}
|
|
210
|
-
var lmnt = createLMNT();
|
|
211
|
-
export {
|
|
212
|
-
VERSION,
|
|
213
|
-
createLMNT,
|
|
214
|
-
lmnt
|
|
215
|
-
};
|
|
216
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lmnt-provider.ts","../src/lmnt-speech-model.ts","../src/lmnt-error.ts","../src/version.ts"],"sourcesContent":["import { SpeechModelV4, ProviderV4 } from '@ai-sdk/provider';\nimport {\n FetchFunction,\n loadApiKey,\n withUserAgentSuffix,\n} from '@ai-sdk/provider-utils';\nimport { LMNTSpeechModel } from './lmnt-speech-model';\nimport { LMNTSpeechModelId } from './lmnt-speech-options';\nimport { VERSION } from './version';\n\nexport interface LMNTProvider extends Pick<ProviderV4, 'speechModel'> {\n (\n modelId: 'aurora',\n settings?: {},\n ): {\n speech: LMNTSpeechModel;\n };\n\n /**\n * Creates a model for speech synthesis.\n */\n speech(modelId: LMNTSpeechModelId): SpeechModelV4;\n}\n\nexport interface LMNTProviderSettings {\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 LMNT provider instance.\n */\nexport function createLMNT(options: LMNTProviderSettings = {}): LMNTProvider {\n const getHeaders = () =>\n withUserAgentSuffix(\n {\n 'x-api-key': loadApiKey({\n apiKey: options.apiKey,\n environmentVariableName: 'LMNT_API_KEY',\n description: 'LMNT',\n }),\n ...options.headers,\n },\n `ai-sdk/lmnt/${VERSION}`,\n );\n\n const createSpeechModel = (modelId: LMNTSpeechModelId) =>\n new LMNTSpeechModel(modelId, {\n provider: `lmnt.speech`,\n url: ({ path }) => `https://api.lmnt.com${path}`,\n headers: getHeaders,\n fetch: options.fetch,\n });\n\n const provider = function (modelId: LMNTSpeechModelId) {\n return {\n speech: createSpeechModel(modelId),\n };\n };\n\n provider.speech = createSpeechModel;\n provider.speechModel = createSpeechModel;\n\n return provider as LMNTProvider;\n}\n\n/**\n * Default LMNT provider instance.\n */\nexport const lmnt = createLMNT();\n","import { SpeechModelV4, SharedV4Warning } 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 { LMNTConfig } from './lmnt-config';\nimport { lmntFailedResponseHandler } from './lmnt-error';\nimport { LMNTSpeechModelId } from './lmnt-speech-options';\nimport { LMNTSpeechAPITypes } from './lmnt-api-types';\n\n// https://docs.lmnt.com/api-reference/speech/synthesize-speech-bytes\nconst lmntSpeechModelOptionsSchema = z.object({\n /**\n * The model to use for speech synthesis e.g. 'aurora' or 'blizzard'.\n * @default 'aurora'\n */\n model: z\n .union([z.enum(['aurora', 'blizzard']), z.string()])\n .nullish()\n .default('aurora'),\n\n /**\n * The audio format of the output.\n * @default 'mp3'\n */\n format: z\n .enum(['aac', 'mp3', 'mulaw', 'raw', 'wav'])\n .nullish()\n .default('mp3'),\n\n /**\n * The sample rate of the output audio in Hz.\n * @default 24000\n */\n sampleRate: z\n .union([z.literal(8000), z.literal(16000), z.literal(24000)])\n .nullish()\n .default(24000),\n\n /**\n * The speed of the speech. Range: 0.25 to 2.\n * @default 1\n */\n speed: z.number().min(0.25).max(2).nullish().default(1),\n\n /**\n * A seed value for deterministic generation.\n */\n seed: z.number().int().nullish(),\n\n /**\n * Whether to use a conversational style.\n * @default false\n */\n conversational: z.boolean().nullish().default(false),\n\n /**\n * Maximum length of the output in seconds (up to 300).\n */\n length: z.number().max(300).nullish(),\n\n /**\n * Top-p sampling parameter. Range: 0 to 1.\n * @default 1\n */\n topP: z.number().min(0).max(1).nullish().default(1),\n\n /**\n * Temperature for sampling. Higher values increase randomness.\n * @default 1\n */\n temperature: z.number().min(0).nullish().default(1),\n});\n\nexport type LMNTSpeechModelOptions = z.infer<\n typeof lmntSpeechModelOptionsSchema\n>;\n\ninterface LMNTSpeechModelConfig extends LMNTConfig {\n _internal?: {\n currentDate?: () => Date;\n };\n}\n\nexport class LMNTSpeechModel implements SpeechModelV4 {\n readonly specificationVersion = 'v4';\n\n get provider(): string {\n return this.config.provider;\n }\n\n constructor(\n readonly modelId: LMNTSpeechModelId,\n private readonly config: LMNTSpeechModelConfig,\n ) {}\n\n private async getArgs({\n text,\n voice = 'ava',\n outputFormat = 'mp3',\n speed,\n language,\n providerOptions,\n }: Parameters<SpeechModelV4['doGenerate']>[0]) {\n const warnings: SharedV4Warning[] = [];\n\n // Parse provider options\n const lmntOptions = await parseProviderOptions({\n provider: 'lmnt',\n providerOptions,\n schema: lmntSpeechModelOptionsSchema,\n });\n\n // Create request body\n const requestBody: Record<string, unknown> = {\n model: this.modelId,\n text,\n voice,\n response_format: 'mp3',\n speed,\n };\n\n if (outputFormat) {\n if (['mp3', 'aac', 'mulaw', 'raw', 'wav'].includes(outputFormat)) {\n requestBody.response_format = outputFormat;\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 (lmntOptions) {\n const speechModelOptions: Omit<LMNTSpeechAPITypes, 'voice' | 'text'> = {\n conversational: lmntOptions.conversational ?? undefined,\n length: lmntOptions.length ?? undefined,\n seed: lmntOptions.seed ?? undefined,\n speed: lmntOptions.speed ?? undefined,\n temperature: lmntOptions.temperature ?? undefined,\n top_p: lmntOptions.topP ?? undefined,\n sample_rate: lmntOptions.sampleRate ?? undefined,\n };\n\n for (const key in speechModelOptions) {\n const value =\n speechModelOptions[\n key as keyof Omit<LMNTSpeechAPITypes, 'voice' | 'text'>\n ];\n if (value !== undefined) {\n requestBody[key] = value;\n }\n }\n }\n\n if (language) {\n requestBody.language = language;\n }\n\n return {\n requestBody,\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, 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: '/v1/ai/speech/bytes',\n modelId: this.modelId,\n }),\n headers: combineHeaders(this.config.headers(), options.headers),\n body: requestBody,\n failedResponseHandler: lmntFailedResponseHandler,\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 lmntErrorDataSchema = z.object({\n error: z.object({\n message: z.string(),\n code: z.number(),\n }),\n});\n\nexport type LMNTErrorData = z.infer<typeof lmntErrorDataSchema>;\n\nexport const lmntFailedResponseHandler = createJsonErrorResponseHandler({\n errorSchema: lmntErrorDataSchema,\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":";AACA;AAAA,EAEE;AAAA,EACA;AAAA,OACK;;;ACJP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,KAAAA,UAAS;;;ACPlB,SAAS,SAAS;AAClB,SAAS,sCAA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