@ai-sdk/lmnt 3.0.0-beta.3 → 3.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@ai-sdk/lmnt",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.31",
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.mjs",
28
- "require": "./dist/index.js"
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.2",
33
- "@ai-sdk/provider-utils": "5.0.0-beta.3"
32
+ "@ai-sdk/provider-utils": "5.0.0-beta.30",
33
+ "@ai-sdk/provider": "4.0.0-beta.14"
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.0",
40
+ "@ai-sdk/test-server": "2.0.0-beta.3",
41
41
  "@vercel/ai-tsconfig": "0.0.0"
42
42
  },
43
43
  "peerDependencies": {
@@ -47,12 +47,14 @@
47
47
  "node": ">=18"
48
48
  },
49
49
  "publishConfig": {
50
- "access": "public"
50
+ "access": "public",
51
+ "provenance": true
51
52
  },
52
53
  "homepage": "https://ai-sdk.dev/docs",
53
54
  "repository": {
54
55
  "type": "git",
55
- "url": "git+https://github.com/vercel/ai.git"
56
+ "url": "https://github.com/vercel/ai",
57
+ "directory": "packages/lmnt"
56
58
  },
57
59
  "bugs": {
58
60
  "url": "https://github.com/vercel/ai/issues"
@@ -64,9 +66,7 @@
64
66
  "build": "tsup --tsconfig tsconfig.build.json",
65
67
  "build:watch": "tsup --tsconfig tsconfig.build.json --watch",
66
68
  "clean": "del-cli dist docs",
67
- "lint": "eslint \"./**/*.ts*\"",
68
69
  "type-check": "tsc --noEmit",
69
- "prettier-check": "prettier --check \"./**/*.ts*\"",
70
70
  "test": "pnpm test:node && pnpm test:edge",
71
71
  "test:watch": "vitest --config vitest.node.config.js --watch",
72
72
  "test:edge": "vitest --config vitest.edge.config.js --run",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { createLMNT, lmnt } from './lmnt-provider';
2
2
  export type { LMNTProvider, LMNTProviderSettings } from './lmnt-provider';
3
- export type { LMNTSpeechModelOptions } from './lmnt-speech-model';
3
+ export type { LMNTSpeechModelOptions } from './lmnt-speech-model-options';
4
4
  export { VERSION } from './version';
@@ -1,9 +1,9 @@
1
- import { FetchFunction } from '@ai-sdk/provider-utils';
1
+ import type { FetchFunction } from '@ai-sdk/provider-utils';
2
2
 
3
3
  export type LMNTConfig = {
4
4
  provider: string;
5
5
  url: (options: { modelId: string; path: string }) => string;
6
- headers: () => Record<string, string | undefined>;
6
+ headers?: () => Record<string, string | undefined>;
7
7
  fetch?: FetchFunction;
8
8
  generateId?: () => string;
9
9
  };
@@ -1,14 +1,18 @@
1
- import { SpeechModelV3, ProviderV3 } from '@ai-sdk/provider';
2
1
  import {
3
- FetchFunction,
2
+ NoSuchModelError,
3
+ type SpeechModelV4,
4
+ type ProviderV4,
5
+ } from '@ai-sdk/provider';
6
+ import {
4
7
  loadApiKey,
5
8
  withUserAgentSuffix,
9
+ type FetchFunction,
6
10
  } from '@ai-sdk/provider-utils';
7
11
  import { LMNTSpeechModel } from './lmnt-speech-model';
8
- import { LMNTSpeechModelId } from './lmnt-speech-options';
12
+ import type { LMNTSpeechModelId } from './lmnt-speech-options';
9
13
  import { VERSION } from './version';
10
14
 
11
- export interface LMNTProvider extends Pick<ProviderV3, 'speechModel'> {
15
+ export interface LMNTProvider extends ProviderV4 {
12
16
  (
13
17
  modelId: 'aurora',
14
18
  settings?: {},
@@ -19,7 +23,7 @@ export interface LMNTProvider extends Pick<ProviderV3, 'speechModel'> {
19
23
  /**
20
24
  * Creates a model for speech synthesis.
21
25
  */
22
- speech(modelId: LMNTSpeechModelId): SpeechModelV3;
26
+ speech(modelId: LMNTSpeechModelId): SpeechModelV4;
23
27
  }
24
28
 
25
29
  export interface LMNTProviderSettings {
@@ -71,9 +75,34 @@ export function createLMNT(options: LMNTProviderSettings = {}): LMNTProvider {
71
75
  };
72
76
  };
73
77
 
78
+ provider.specificationVersion = 'v4' as const;
74
79
  provider.speech = createSpeechModel;
75
80
  provider.speechModel = createSpeechModel;
76
81
 
82
+ provider.languageModel = (modelId: string) => {
83
+ throw new NoSuchModelError({
84
+ modelId,
85
+ modelType: 'languageModel',
86
+ message: 'LMNT does not provide language models',
87
+ });
88
+ };
89
+
90
+ provider.embeddingModel = (modelId: string) => {
91
+ throw new NoSuchModelError({
92
+ modelId,
93
+ modelType: 'embeddingModel',
94
+ message: 'LMNT does not provide embedding models',
95
+ });
96
+ };
97
+
98
+ provider.imageModel = (modelId: string) => {
99
+ throw new NoSuchModelError({
100
+ modelId,
101
+ modelType: 'imageModel',
102
+ message: 'LMNT does not provide image models',
103
+ });
104
+ };
105
+
77
106
  return provider as LMNTProvider;
78
107
  }
79
108
 
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod/v4';
2
+
3
+ // https://docs.lmnt.com/api-reference/speech/synthesize-speech-bytes
4
+ export const lmntSpeechModelOptionsSchema = z.object({
5
+ /**
6
+ * The model to use for speech synthesis e.g. 'aurora' or 'blizzard'.
7
+ * @default 'aurora'
8
+ */
9
+ model: z
10
+ .union([z.enum(['aurora', 'blizzard']), z.string()])
11
+ .nullish()
12
+ .default('aurora'),
13
+
14
+ /**
15
+ * The audio format of the output.
16
+ * @default 'mp3'
17
+ */
18
+ format: z
19
+ .enum(['aac', 'mp3', 'mulaw', 'raw', 'wav'])
20
+ .nullish()
21
+ .default('mp3'),
22
+
23
+ /**
24
+ * The sample rate of the output audio in Hz.
25
+ * @default 24000
26
+ */
27
+ sampleRate: z
28
+ .union([z.literal(8000), z.literal(16000), z.literal(24000)])
29
+ .nullish()
30
+ .default(24000),
31
+
32
+ /**
33
+ * The speed of the speech. Range: 0.25 to 2.
34
+ * @default 1
35
+ */
36
+ speed: z.number().min(0.25).max(2).nullish().default(1),
37
+
38
+ /**
39
+ * A seed value for deterministic generation.
40
+ */
41
+ seed: z.number().int().nullish(),
42
+
43
+ /**
44
+ * Whether to use a conversational style.
45
+ * @default false
46
+ */
47
+ conversational: z.boolean().nullish().default(false),
48
+
49
+ /**
50
+ * Maximum length of the output in seconds (up to 300).
51
+ */
52
+ length: z.number().max(300).nullish(),
53
+
54
+ /**
55
+ * Top-p sampling parameter. Range: 0 to 1.
56
+ * @default 1
57
+ */
58
+ topP: z.number().min(0).max(1).nullish().default(1),
59
+
60
+ /**
61
+ * Temperature for sampling. Higher values increase randomness.
62
+ * @default 1
63
+ */
64
+ temperature: z.number().min(0).nullish().default(1),
65
+ });
66
+
67
+ export type LMNTSpeechModelOptions = z.infer<
68
+ typeof lmntSpeechModelOptionsSchema
69
+ >;
@@ -1,83 +1,18 @@
1
- import { SpeechModelV3, SharedV3Warning } from '@ai-sdk/provider';
1
+ import type { 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
- import { z } from 'zod/v4';
9
- import { LMNTConfig } from './lmnt-config';
11
+ import type { LMNTConfig } from './lmnt-config';
10
12
  import { lmntFailedResponseHandler } from './lmnt-error';
11
- import { LMNTSpeechModelId } from './lmnt-speech-options';
12
- import { LMNTSpeechAPITypes } from './lmnt-api-types';
13
-
14
- // https://docs.lmnt.com/api-reference/speech/synthesize-speech-bytes
15
- const lmntSpeechModelOptionsSchema = z.object({
16
- /**
17
- * The model to use for speech synthesis e.g. 'aurora' or 'blizzard'.
18
- * @default 'aurora'
19
- */
20
- model: z
21
- .union([z.enum(['aurora', 'blizzard']), z.string()])
22
- .nullish()
23
- .default('aurora'),
24
-
25
- /**
26
- * The audio format of the output.
27
- * @default 'mp3'
28
- */
29
- format: z
30
- .enum(['aac', 'mp3', 'mulaw', 'raw', 'wav'])
31
- .nullish()
32
- .default('mp3'),
33
-
34
- /**
35
- * The sample rate of the output audio in Hz.
36
- * @default 24000
37
- */
38
- sampleRate: z
39
- .union([z.literal(8000), z.literal(16000), z.literal(24000)])
40
- .nullish()
41
- .default(24000),
42
-
43
- /**
44
- * The speed of the speech. Range: 0.25 to 2.
45
- * @default 1
46
- */
47
- speed: z.number().min(0.25).max(2).nullish().default(1),
48
-
49
- /**
50
- * A seed value for deterministic generation.
51
- */
52
- seed: z.number().int().nullish(),
53
-
54
- /**
55
- * Whether to use a conversational style.
56
- * @default false
57
- */
58
- conversational: z.boolean().nullish().default(false),
59
-
60
- /**
61
- * Maximum length of the output in seconds (up to 300).
62
- */
63
- length: z.number().max(300).nullish(),
64
-
65
- /**
66
- * Top-p sampling parameter. Range: 0 to 1.
67
- * @default 1
68
- */
69
- topP: z.number().min(0).max(1).nullish().default(1),
70
-
71
- /**
72
- * Temperature for sampling. Higher values increase randomness.
73
- * @default 1
74
- */
75
- temperature: z.number().min(0).nullish().default(1),
76
- });
77
-
78
- export type LMNTSpeechModelOptions = z.infer<
79
- typeof lmntSpeechModelOptionsSchema
80
- >;
13
+ import { lmntSpeechModelOptionsSchema } from './lmnt-speech-model-options';
14
+ import type { LMNTSpeechModelId } from './lmnt-speech-options';
15
+ import type { LMNTSpeechAPITypes } from './lmnt-api-types';
81
16
 
82
17
  interface LMNTSpeechModelConfig extends LMNTConfig {
83
18
  _internal?: {
@@ -85,13 +20,27 @@ interface LMNTSpeechModelConfig extends LMNTConfig {
85
20
  };
86
21
  }
87
22
 
88
- export class LMNTSpeechModel implements SpeechModelV3 {
89
- readonly specificationVersion = 'v3';
23
+ export class LMNTSpeechModel implements SpeechModelV4 {
24
+ readonly specificationVersion = 'v4';
90
25
 
91
26
  get provider(): string {
92
27
  return this.config.provider;
93
28
  }
94
29
 
30
+ static [WORKFLOW_SERIALIZE](model: LMNTSpeechModel) {
31
+ return serializeModelOptions({
32
+ modelId: model.modelId,
33
+ config: model.config,
34
+ });
35
+ }
36
+
37
+ static [WORKFLOW_DESERIALIZE](options: {
38
+ modelId: LMNTSpeechModelId;
39
+ config: LMNTSpeechModelConfig;
40
+ }) {
41
+ return new LMNTSpeechModel(options.modelId, options.config);
42
+ }
43
+
95
44
  constructor(
96
45
  readonly modelId: LMNTSpeechModelId,
97
46
  private readonly config: LMNTSpeechModelConfig,
@@ -104,8 +53,8 @@ export class LMNTSpeechModel implements SpeechModelV3 {
104
53
  speed,
105
54
  language,
106
55
  providerOptions,
107
- }: Parameters<SpeechModelV3['doGenerate']>[0]) {
108
- const warnings: SharedV3Warning[] = [];
56
+ }: Parameters<SpeechModelV4['doGenerate']>[0]) {
57
+ const warnings: SharedV4Warning[] = [];
109
58
 
110
59
  // Parse provider options
111
60
  const lmntOptions = await parseProviderOptions({
@@ -169,8 +118,8 @@ export class LMNTSpeechModel implements SpeechModelV3 {
169
118
  }
170
119
 
171
120
  async doGenerate(
172
- options: Parameters<SpeechModelV3['doGenerate']>[0],
173
- ): Promise<Awaited<ReturnType<SpeechModelV3['doGenerate']>>> {
121
+ options: Parameters<SpeechModelV4['doGenerate']>[0],
122
+ ): Promise<Awaited<ReturnType<SpeechModelV4['doGenerate']>>> {
174
123
  const currentDate = this.config._internal?.currentDate?.() ?? new Date();
175
124
  const { requestBody, warnings } = await this.getArgs(options);
176
125
 
@@ -183,7 +132,7 @@ export class LMNTSpeechModel implements SpeechModelV3 {
183
132
  path: '/v1/ai/speech/bytes',
184
133
  modelId: this.modelId,
185
134
  }),
186
- headers: combineHeaders(this.config.headers(), options.headers),
135
+ headers: combineHeaders(this.config.headers?.(), options.headers),
187
136
  body: requestBody,
188
137
  failedResponseHandler: lmntFailedResponseHandler,
189
138
  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.3" : "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