@ai-sdk/lmnt 3.0.0-beta.2 → 3.0.0-beta.21
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 +159 -0
- package/README.md +2 -0
- package/dist/index.d.ts +17 -8
- package/dist/index.js +52 -61
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/src/lmnt-config.ts +1 -1
- package/src/lmnt-provider.ts +3 -3
- package/src/lmnt-speech-model.ts +25 -8
- package/dist/index.d.mts +0 -89
- package/dist/index.mjs +0 -216
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,164 @@
|
|
|
1
1
|
# @ai-sdk/lmnt
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
8
|
+
|
|
9
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
10
|
+
|
|
11
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
12
|
+
|
|
13
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [b3976a2]
|
|
16
|
+
- Updated dependencies [ff5eba1]
|
|
17
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
18
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
19
|
+
|
|
20
|
+
## 3.0.0-beta.20
|
|
21
|
+
|
|
22
|
+
### Major Changes
|
|
23
|
+
|
|
24
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [ef992f8]
|
|
29
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
30
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
31
|
+
|
|
32
|
+
## 3.0.0-beta.19
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [90e2d8a]
|
|
37
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
38
|
+
|
|
39
|
+
## 3.0.0-beta.18
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [3ae1786]
|
|
44
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
45
|
+
|
|
46
|
+
## 3.0.0-beta.17
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [176466a]
|
|
51
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
52
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
53
|
+
|
|
54
|
+
## 3.0.0-beta.16
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [e311194]
|
|
59
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
60
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
61
|
+
|
|
62
|
+
## 3.0.0-beta.15
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [34bd95d]
|
|
67
|
+
- Updated dependencies [008271d]
|
|
68
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
69
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
70
|
+
|
|
71
|
+
## 3.0.0-beta.14
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [b0c2869]
|
|
76
|
+
- Updated dependencies [7e26e81]
|
|
77
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
78
|
+
|
|
79
|
+
## 3.0.0-beta.13
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [46d1149]
|
|
84
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
85
|
+
|
|
86
|
+
## 3.0.0-beta.12
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies [6fd51c0]
|
|
91
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
92
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
93
|
+
|
|
94
|
+
## 3.0.0-beta.11
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies [c29a26f]
|
|
99
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
100
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
101
|
+
|
|
102
|
+
## 3.0.0-beta.10
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
107
|
+
|
|
108
|
+
## 3.0.0-beta.9
|
|
109
|
+
|
|
110
|
+
### Patch Changes
|
|
111
|
+
|
|
112
|
+
- Updated dependencies [2e17091]
|
|
113
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
114
|
+
|
|
115
|
+
## 3.0.0-beta.8
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Updated dependencies [986c6fd]
|
|
120
|
+
- Updated dependencies [493295c]
|
|
121
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
122
|
+
|
|
123
|
+
## 3.0.0-beta.7
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [1f509d4]
|
|
128
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
129
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
130
|
+
|
|
131
|
+
## 3.0.0-beta.6
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- Updated dependencies [3887c70]
|
|
136
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
137
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
138
|
+
|
|
139
|
+
## 3.0.0-beta.5
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [776b617]
|
|
144
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
145
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
146
|
+
|
|
147
|
+
## 3.0.0-beta.4
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- Updated dependencies [61753c3]
|
|
152
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
153
|
+
|
|
154
|
+
## 3.0.0-beta.3
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Updated dependencies [f7d4f01]
|
|
159
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
160
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
161
|
+
|
|
3
162
|
## 3.0.0-beta.2
|
|
4
163
|
|
|
5
164
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
The **[LMNT provider](https://ai-sdk.dev/providers/ai-sdk-providers/lmnt)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
4
|
contains language model support for the LMNT API.
|
|
5
5
|
|
|
6
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access LMNT (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
7
|
+
|
|
6
8
|
## Setup
|
|
7
9
|
|
|
8
10
|
The LMNT provider is available in the `@ai-sdk/lmnt` module. You can install it with
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
2
|
+
import { SpeechModelV4, ProviderV4 } from '@ai-sdk/provider';
|
|
3
|
+
import { FetchFunction, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@ai-sdk/provider-utils';
|
|
3
4
|
import { z } from 'zod/v4';
|
|
4
5
|
|
|
5
6
|
type LMNTConfig = {
|
|
@@ -8,7 +9,7 @@ type LMNTConfig = {
|
|
|
8
9
|
modelId: string;
|
|
9
10
|
path: string;
|
|
10
11
|
}) => string;
|
|
11
|
-
headers
|
|
12
|
+
headers?: () => Record<string, string | undefined>;
|
|
12
13
|
fetch?: FetchFunction;
|
|
13
14
|
generateId?: () => string;
|
|
14
15
|
};
|
|
@@ -41,24 +42,32 @@ interface LMNTSpeechModelConfig extends LMNTConfig {
|
|
|
41
42
|
currentDate?: () => Date;
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
declare class LMNTSpeechModel implements
|
|
45
|
+
declare class LMNTSpeechModel implements SpeechModelV4 {
|
|
45
46
|
readonly modelId: LMNTSpeechModelId;
|
|
46
47
|
private readonly config;
|
|
47
|
-
readonly specificationVersion = "
|
|
48
|
+
readonly specificationVersion = "v4";
|
|
48
49
|
get provider(): string;
|
|
50
|
+
static [WORKFLOW_SERIALIZE](model: LMNTSpeechModel): {
|
|
51
|
+
modelId: string;
|
|
52
|
+
config: _ai_sdk_provider.JSONObject;
|
|
53
|
+
};
|
|
54
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
55
|
+
modelId: LMNTSpeechModelId;
|
|
56
|
+
config: LMNTSpeechModelConfig;
|
|
57
|
+
}): LMNTSpeechModel;
|
|
49
58
|
constructor(modelId: LMNTSpeechModelId, config: LMNTSpeechModelConfig);
|
|
50
59
|
private getArgs;
|
|
51
|
-
doGenerate(options: Parameters<
|
|
60
|
+
doGenerate(options: Parameters<SpeechModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>>;
|
|
52
61
|
}
|
|
53
62
|
|
|
54
|
-
interface LMNTProvider extends Pick<
|
|
63
|
+
interface LMNTProvider extends Pick<ProviderV4, 'speechModel'> {
|
|
55
64
|
(modelId: 'aurora', settings?: {}): {
|
|
56
65
|
speech: LMNTSpeechModel;
|
|
57
66
|
};
|
|
58
67
|
/**
|
|
59
68
|
* Creates a model for speech synthesis.
|
|
60
69
|
*/
|
|
61
|
-
speech(modelId: LMNTSpeechModelId):
|
|
70
|
+
speech(modelId: LMNTSpeechModelId): SpeechModelV4;
|
|
62
71
|
}
|
|
63
72
|
interface LMNTProviderSettings {
|
|
64
73
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,107 +1,99 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
VERSION: () => VERSION,
|
|
24
|
-
createLMNT: () => createLMNT,
|
|
25
|
-
lmnt: () => lmnt
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/lmnt-provider.ts
|
|
30
|
-
|
|
2
|
+
import {
|
|
3
|
+
loadApiKey,
|
|
4
|
+
withUserAgentSuffix
|
|
5
|
+
} from "@ai-sdk/provider-utils";
|
|
31
6
|
|
|
32
7
|
// src/lmnt-speech-model.ts
|
|
33
|
-
|
|
34
|
-
|
|
8
|
+
import {
|
|
9
|
+
combineHeaders,
|
|
10
|
+
createBinaryResponseHandler,
|
|
11
|
+
parseProviderOptions,
|
|
12
|
+
postJsonToApi,
|
|
13
|
+
serializeModelOptions,
|
|
14
|
+
WORKFLOW_SERIALIZE,
|
|
15
|
+
WORKFLOW_DESERIALIZE
|
|
16
|
+
} from "@ai-sdk/provider-utils";
|
|
17
|
+
import { z as z2 } from "zod/v4";
|
|
35
18
|
|
|
36
19
|
// src/lmnt-error.ts
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var lmntErrorDataSchema =
|
|
40
|
-
error:
|
|
41
|
-
message:
|
|
42
|
-
code:
|
|
20
|
+
import { z } from "zod/v4";
|
|
21
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
22
|
+
var lmntErrorDataSchema = z.object({
|
|
23
|
+
error: z.object({
|
|
24
|
+
message: z.string(),
|
|
25
|
+
code: z.number()
|
|
43
26
|
})
|
|
44
27
|
});
|
|
45
|
-
var lmntFailedResponseHandler =
|
|
28
|
+
var lmntFailedResponseHandler = createJsonErrorResponseHandler({
|
|
46
29
|
errorSchema: lmntErrorDataSchema,
|
|
47
30
|
errorToMessage: (data) => data.error.message
|
|
48
31
|
});
|
|
49
32
|
|
|
50
33
|
// src/lmnt-speech-model.ts
|
|
51
|
-
var lmntSpeechModelOptionsSchema =
|
|
34
|
+
var lmntSpeechModelOptionsSchema = z2.object({
|
|
52
35
|
/**
|
|
53
36
|
* The model to use for speech synthesis e.g. 'aurora' or 'blizzard'.
|
|
54
37
|
* @default 'aurora'
|
|
55
38
|
*/
|
|
56
|
-
model:
|
|
39
|
+
model: z2.union([z2.enum(["aurora", "blizzard"]), z2.string()]).nullish().default("aurora"),
|
|
57
40
|
/**
|
|
58
41
|
* The audio format of the output.
|
|
59
42
|
* @default 'mp3'
|
|
60
43
|
*/
|
|
61
|
-
format:
|
|
44
|
+
format: z2.enum(["aac", "mp3", "mulaw", "raw", "wav"]).nullish().default("mp3"),
|
|
62
45
|
/**
|
|
63
46
|
* The sample rate of the output audio in Hz.
|
|
64
47
|
* @default 24000
|
|
65
48
|
*/
|
|
66
|
-
sampleRate:
|
|
49
|
+
sampleRate: z2.union([z2.literal(8e3), z2.literal(16e3), z2.literal(24e3)]).nullish().default(24e3),
|
|
67
50
|
/**
|
|
68
51
|
* The speed of the speech. Range: 0.25 to 2.
|
|
69
52
|
* @default 1
|
|
70
53
|
*/
|
|
71
|
-
speed:
|
|
54
|
+
speed: z2.number().min(0.25).max(2).nullish().default(1),
|
|
72
55
|
/**
|
|
73
56
|
* A seed value for deterministic generation.
|
|
74
57
|
*/
|
|
75
|
-
seed:
|
|
58
|
+
seed: z2.number().int().nullish(),
|
|
76
59
|
/**
|
|
77
60
|
* Whether to use a conversational style.
|
|
78
61
|
* @default false
|
|
79
62
|
*/
|
|
80
|
-
conversational:
|
|
63
|
+
conversational: z2.boolean().nullish().default(false),
|
|
81
64
|
/**
|
|
82
65
|
* Maximum length of the output in seconds (up to 300).
|
|
83
66
|
*/
|
|
84
|
-
length:
|
|
67
|
+
length: z2.number().max(300).nullish(),
|
|
85
68
|
/**
|
|
86
69
|
* Top-p sampling parameter. Range: 0 to 1.
|
|
87
70
|
* @default 1
|
|
88
71
|
*/
|
|
89
|
-
topP:
|
|
72
|
+
topP: z2.number().min(0).max(1).nullish().default(1),
|
|
90
73
|
/**
|
|
91
74
|
* Temperature for sampling. Higher values increase randomness.
|
|
92
75
|
* @default 1
|
|
93
76
|
*/
|
|
94
|
-
temperature:
|
|
77
|
+
temperature: z2.number().min(0).nullish().default(1)
|
|
95
78
|
});
|
|
96
|
-
var LMNTSpeechModel = class {
|
|
79
|
+
var LMNTSpeechModel = class _LMNTSpeechModel {
|
|
97
80
|
constructor(modelId, config) {
|
|
98
81
|
this.modelId = modelId;
|
|
99
82
|
this.config = config;
|
|
100
|
-
this.specificationVersion = "
|
|
83
|
+
this.specificationVersion = "v4";
|
|
101
84
|
}
|
|
102
85
|
get provider() {
|
|
103
86
|
return this.config.provider;
|
|
104
87
|
}
|
|
88
|
+
static [WORKFLOW_SERIALIZE](model) {
|
|
89
|
+
return serializeModelOptions({
|
|
90
|
+
modelId: model.modelId,
|
|
91
|
+
config: model.config
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
static [WORKFLOW_DESERIALIZE](options) {
|
|
95
|
+
return new _LMNTSpeechModel(options.modelId, options.config);
|
|
96
|
+
}
|
|
105
97
|
async getArgs({
|
|
106
98
|
text,
|
|
107
99
|
voice = "ava",
|
|
@@ -112,7 +104,7 @@ var LMNTSpeechModel = class {
|
|
|
112
104
|
}) {
|
|
113
105
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
114
106
|
const warnings = [];
|
|
115
|
-
const lmntOptions = await
|
|
107
|
+
const lmntOptions = await parseProviderOptions({
|
|
116
108
|
provider: "lmnt",
|
|
117
109
|
providerOptions,
|
|
118
110
|
schema: lmntSpeechModelOptionsSchema
|
|
@@ -161,22 +153,22 @@ var LMNTSpeechModel = class {
|
|
|
161
153
|
};
|
|
162
154
|
}
|
|
163
155
|
async doGenerate(options) {
|
|
164
|
-
var _a, _b, _c;
|
|
156
|
+
var _a, _b, _c, _d, _e;
|
|
165
157
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
166
158
|
const { requestBody, warnings } = await this.getArgs(options);
|
|
167
159
|
const {
|
|
168
160
|
value: audio,
|
|
169
161
|
responseHeaders,
|
|
170
162
|
rawValue: rawResponse
|
|
171
|
-
} = await
|
|
163
|
+
} = await postJsonToApi({
|
|
172
164
|
url: this.config.url({
|
|
173
165
|
path: "/v1/ai/speech/bytes",
|
|
174
166
|
modelId: this.modelId
|
|
175
167
|
}),
|
|
176
|
-
headers: (
|
|
168
|
+
headers: combineHeaders((_e = (_d = this.config).headers) == null ? void 0 : _e.call(_d), options.headers),
|
|
177
169
|
body: requestBody,
|
|
178
170
|
failedResponseHandler: lmntFailedResponseHandler,
|
|
179
|
-
successfulResponseHandler:
|
|
171
|
+
successfulResponseHandler: createBinaryResponseHandler(),
|
|
180
172
|
abortSignal: options.abortSignal,
|
|
181
173
|
fetch: this.config.fetch
|
|
182
174
|
});
|
|
@@ -197,13 +189,13 @@ var LMNTSpeechModel = class {
|
|
|
197
189
|
};
|
|
198
190
|
|
|
199
191
|
// src/version.ts
|
|
200
|
-
var VERSION = true ? "3.0.0-beta.
|
|
192
|
+
var VERSION = true ? "3.0.0-beta.21" : "0.0.0-test";
|
|
201
193
|
|
|
202
194
|
// src/lmnt-provider.ts
|
|
203
195
|
function createLMNT(options = {}) {
|
|
204
|
-
const getHeaders = () =>
|
|
196
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
205
197
|
{
|
|
206
|
-
"x-api-key":
|
|
198
|
+
"x-api-key": loadApiKey({
|
|
207
199
|
apiKey: options.apiKey,
|
|
208
200
|
environmentVariableName: "LMNT_API_KEY",
|
|
209
201
|
description: "LMNT"
|
|
@@ -228,10 +220,9 @@ function createLMNT(options = {}) {
|
|
|
228
220
|
return provider;
|
|
229
221
|
}
|
|
230
222
|
var lmnt = createLMNT();
|
|
231
|
-
|
|
232
|
-
0 && (module.exports = {
|
|
223
|
+
export {
|
|
233
224
|
VERSION,
|
|
234
225
|
createLMNT,
|
|
235
226
|
lmnt
|
|
236
|
-
}
|
|
227
|
+
};
|
|
237
228
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/lmnt-provider.ts","../src/lmnt-speech-model.ts","../src/lmnt-error.ts","../src/version.ts"],"sourcesContent":["export { createLMNT, lmnt } from './lmnt-provider';\nexport type { LMNTProvider, LMNTProviderSettings } from './lmnt-provider';\nexport type { LMNTSpeechModelOptions } from './lmnt-speech-model';\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 { LMNTSpeechModel } from './lmnt-speech-model';\nimport { LMNTSpeechModelId } from './lmnt-speech-options';\nimport { VERSION } from './version';\n\nexport interface LMNTProvider extends Pick<ProviderV3, '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): SpeechModelV3;\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 { 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 { 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 SpeechModelV3 {\n readonly specificationVersion = 'v3';\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<SpeechModelV3['doGenerate']>[0]) {\n const warnings: SharedV3Warning[] = [];\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<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: '/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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,yBAIO;;;ACJP,IAAAC,yBAKO;AACP,IAAAC,aAAkB;;;ACPlB,gBAAkB;AA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A,QAChB,yBAAyB;AAAA,QACzB,aAAa;AAAA,MACf,CAAC;AAAA,MACD,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,eAAe,OAAO;AAAA,EACxB;AAEF,QAAM,oBAAoB,CAAC,YACzB,IAAI,gBAAgB,SAAS;AAAA,IAC3B,UAAU;AAAA,IACV,KAAK,CAAC,EAAE,KAAK,MAAM,uBAAuB,IAAI;AAAA,IAC9C,SAAS;AAAA,IACT,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,WAAW,SAAU,SAA4B;AACrD,WAAO;AAAA,MACL,QAAQ,kBAAkB,OAAO;AAAA,IACnC;AAAA,EACF;AAEA,WAAS,SAAS;AAClB,WAAS,cAAc;AAEvB,SAAO;AACT;AAKO,IAAM,OAAO,WAAW;","names":["import_provider_utils","import_provider_utils","import_v4"]}
|
|
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 serializeModelOptions,\n WORKFLOW_SERIALIZE,\n WORKFLOW_DESERIALIZE,\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 static [WORKFLOW_SERIALIZE](model: LMNTSpeechModel) {\n return serializeModelOptions({\n modelId: model.modelId,\n config: model.config,\n });\n }\n\n static [WORKFLOW_DESERIALIZE](options: {\n modelId: LMNTSpeechModelId;\n config: LMNTSpeechModelConfig;\n }) {\n return new LMNTSpeechModel(options.modelId, options.config);\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,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,KAAAA,UAAS;;;ACVlB,SAAS,SAAS;AAClB,SAAS,sCAAsC;AAExC,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,OAAO,EAAE,OAAO;AAAA,IACd,SAAS,EAAE,OAAO;AAAA,IAClB,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAIM,IAAM,4BAA4B,+BAA+B;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK,MAAM;AACrC,CAAC;;;ADED,IAAM,+BAA+BC,GAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,OAAOA,GACJ,MAAM,CAACA,GAAE,KAAK,CAAC,UAAU,UAAU,CAAC,GAAGA,GAAE,OAAO,CAAC,CAAC,EAClD,QAAQ,EACR,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,QAAQA,GACL,KAAK,CAAC,OAAO,OAAO,SAAS,OAAO,KAAK,CAAC,EAC1C,QAAQ,EACR,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,YAAYA,GACT,MAAM,CAACA,GAAE,QAAQ,GAAI,GAAGA,GAAE,QAAQ,IAAK,GAAGA,GAAE,QAAQ,IAAK,CAAC,CA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;AAKO,IAAM,OAAO,WAAW;","names":["z","z"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/lmnt",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.21",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"license": "Apache-2.0",
|
|
5
6
|
"sideEffects": false,
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*",
|
|
@@ -24,20 +24,20 @@
|
|
|
24
24
|
"./package.json": "./package.json",
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
|
-
"import": "./dist/index.
|
|
28
|
-
"
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/provider": "4.0.0-beta.
|
|
33
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
32
|
+
"@ai-sdk/provider": "4.0.0-beta.12",
|
|
33
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.20"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "20.17.24",
|
|
37
37
|
"tsup": "^8",
|
|
38
38
|
"typescript": "5.6.3",
|
|
39
39
|
"zod": "3.25.76",
|
|
40
|
-
"@ai-sdk/test-server": "2.0.0-beta.
|
|
40
|
+
"@ai-sdk/test-server": "2.0.0-beta.1",
|
|
41
41
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -64,9 +64,7 @@
|
|
|
64
64
|
"build": "tsup --tsconfig tsconfig.build.json",
|
|
65
65
|
"build:watch": "tsup --tsconfig tsconfig.build.json --watch",
|
|
66
66
|
"clean": "del-cli dist docs",
|
|
67
|
-
"lint": "eslint \"./**/*.ts*\"",
|
|
68
67
|
"type-check": "tsc --noEmit",
|
|
69
|
-
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
70
68
|
"test": "pnpm test:node && pnpm test:edge",
|
|
71
69
|
"test:watch": "vitest --config vitest.node.config.js --watch",
|
|
72
70
|
"test:edge": "vitest --config vitest.edge.config.js --run",
|
package/src/lmnt-config.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
export type LMNTConfig = {
|
|
4
4
|
provider: string;
|
|
5
5
|
url: (options: { modelId: string; path: string }) => string;
|
|
6
|
-
headers
|
|
6
|
+
headers?: () => Record<string, string | undefined>;
|
|
7
7
|
fetch?: FetchFunction;
|
|
8
8
|
generateId?: () => string;
|
|
9
9
|
};
|
package/src/lmnt-provider.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SpeechModelV4, ProviderV4 } from '@ai-sdk/provider';
|
|
2
2
|
import {
|
|
3
3
|
FetchFunction,
|
|
4
4
|
loadApiKey,
|
|
@@ -8,7 +8,7 @@ import { LMNTSpeechModel } from './lmnt-speech-model';
|
|
|
8
8
|
import { LMNTSpeechModelId } from './lmnt-speech-options';
|
|
9
9
|
import { VERSION } from './version';
|
|
10
10
|
|
|
11
|
-
export interface LMNTProvider extends Pick<
|
|
11
|
+
export interface LMNTProvider extends Pick<ProviderV4, 'speechModel'> {
|
|
12
12
|
(
|
|
13
13
|
modelId: 'aurora',
|
|
14
14
|
settings?: {},
|
|
@@ -19,7 +19,7 @@ export interface LMNTProvider extends Pick<ProviderV3, 'speechModel'> {
|
|
|
19
19
|
/**
|
|
20
20
|
* Creates a model for speech synthesis.
|
|
21
21
|
*/
|
|
22
|
-
speech(modelId: LMNTSpeechModelId):
|
|
22
|
+
speech(modelId: LMNTSpeechModelId): SpeechModelV4;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface LMNTProviderSettings {
|
package/src/lmnt-speech-model.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';
|
|
2
2
|
import {
|
|
3
3
|
combineHeaders,
|
|
4
4
|
createBinaryResponseHandler,
|
|
5
5
|
parseProviderOptions,
|
|
6
6
|
postJsonToApi,
|
|
7
|
+
serializeModelOptions,
|
|
8
|
+
WORKFLOW_SERIALIZE,
|
|
9
|
+
WORKFLOW_DESERIALIZE,
|
|
7
10
|
} from '@ai-sdk/provider-utils';
|
|
8
11
|
import { z } from 'zod/v4';
|
|
9
12
|
import { LMNTConfig } from './lmnt-config';
|
|
@@ -85,13 +88,27 @@ interface LMNTSpeechModelConfig extends LMNTConfig {
|
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
export class LMNTSpeechModel implements
|
|
89
|
-
readonly specificationVersion = '
|
|
91
|
+
export class LMNTSpeechModel implements SpeechModelV4 {
|
|
92
|
+
readonly specificationVersion = 'v4';
|
|
90
93
|
|
|
91
94
|
get provider(): string {
|
|
92
95
|
return this.config.provider;
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
static [WORKFLOW_SERIALIZE](model: LMNTSpeechModel) {
|
|
99
|
+
return serializeModelOptions({
|
|
100
|
+
modelId: model.modelId,
|
|
101
|
+
config: model.config,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
106
|
+
modelId: LMNTSpeechModelId;
|
|
107
|
+
config: LMNTSpeechModelConfig;
|
|
108
|
+
}) {
|
|
109
|
+
return new LMNTSpeechModel(options.modelId, options.config);
|
|
110
|
+
}
|
|
111
|
+
|
|
95
112
|
constructor(
|
|
96
113
|
readonly modelId: LMNTSpeechModelId,
|
|
97
114
|
private readonly config: LMNTSpeechModelConfig,
|
|
@@ -104,8 +121,8 @@ export class LMNTSpeechModel implements SpeechModelV3 {
|
|
|
104
121
|
speed,
|
|
105
122
|
language,
|
|
106
123
|
providerOptions,
|
|
107
|
-
}: Parameters<
|
|
108
|
-
const warnings:
|
|
124
|
+
}: Parameters<SpeechModelV4['doGenerate']>[0]) {
|
|
125
|
+
const warnings: SharedV4Warning[] = [];
|
|
109
126
|
|
|
110
127
|
// Parse provider options
|
|
111
128
|
const lmntOptions = await parseProviderOptions({
|
|
@@ -169,8 +186,8 @@ export class LMNTSpeechModel implements SpeechModelV3 {
|
|
|
169
186
|
}
|
|
170
187
|
|
|
171
188
|
async doGenerate(
|
|
172
|
-
options: Parameters<
|
|
173
|
-
): Promise<Awaited<ReturnType<
|
|
189
|
+
options: Parameters<SpeechModelV4['doGenerate']>[0],
|
|
190
|
+
): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>> {
|
|
174
191
|
const currentDate = this.config._internal?.currentDate?.() ?? new Date();
|
|
175
192
|
const { requestBody, warnings } = await this.getArgs(options);
|
|
176
193
|
|
|
@@ -183,7 +200,7 @@ export class LMNTSpeechModel implements SpeechModelV3 {
|
|
|
183
200
|
path: '/v1/ai/speech/bytes',
|
|
184
201
|
modelId: this.modelId,
|
|
185
202
|
}),
|
|
186
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
203
|
+
headers: combineHeaders(this.config.headers?.(), options.headers),
|
|
187
204
|
body: requestBody,
|
|
188
205
|
failedResponseHandler: lmntFailedResponseHandler,
|
|
189
206
|
successfulResponseHandler: createBinaryResponseHandler(),
|
package/dist/index.d.mts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { SpeechModelV3, ProviderV3 } 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 SpeechModelV3 {
|
|
45
|
-
readonly modelId: LMNTSpeechModelId;
|
|
46
|
-
private readonly config;
|
|
47
|
-
readonly specificationVersion = "v3";
|
|
48
|
-
get provider(): string;
|
|
49
|
-
constructor(modelId: LMNTSpeechModelId, config: LMNTSpeechModelConfig);
|
|
50
|
-
private getArgs;
|
|
51
|
-
doGenerate(options: Parameters<SpeechModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface LMNTProvider extends Pick<ProviderV3, 'speechModel'> {
|
|
55
|
-
(modelId: 'aurora', settings?: {}): {
|
|
56
|
-
speech: LMNTSpeechModel;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Creates a model for speech synthesis.
|
|
60
|
-
*/
|
|
61
|
-
speech(modelId: LMNTSpeechModelId): SpeechModelV3;
|
|
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 = "v3";
|
|
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.2" : "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 { SpeechModelV3, ProviderV3 } 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<ProviderV3, '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): SpeechModelV3;\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 { 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 { 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 SpeechModelV3 {\n readonly specificationVersion = 'v3';\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<SpeechModelV3['doGenerate']>[0]) {\n const warnings: SharedV3Warning[] = [];\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<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: '/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,sCAAsC;AAExC,IAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,OAAO,EAAE,OAAO;AAAA,IACd,SAAS,EAAE,OAAO;AAAA,IAClB,MAAM,EAAE,OAAO;AAAA,EACjB,CAAC;AACH,CAAC;AAIM,IAAM,4BAA4B,+BAA+B;AAAA,EACtE,aAAa;AAAA,EACb,gBAAgB,UAAQ,KAAK,MAAM;AACrC,CAAC;;;ADDD,IAAM,+BAA+BC,GAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,OAAOA,GACJ,MAAM,CAACA,GAAE,KAAK,CAAC,UAAU,UAAU,CAAC,GAAGA,GAAE,OAAO,CAAC,CAAC,EAClD,QAAQ,EACR,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMnB,QAAQA,GACL,KAAK,CAAC,OAAO,OAAO,SAAS,OAAO,KAAK,CAAC,EAC1C,QAAQ,EACR,QAAQ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhB,YAAYA,GACT,MAAM,CAACA,GAAE,QAAQ,GAAI,GAAGA,GAAE,QAAQ,IAAK,GAAGA,GAAE,QAAQ,IAAK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