@ai-sdk/elevenlabs 3.0.0-beta.2 → 3.0.0-beta.20
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 +146 -4
- package/README.md +2 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +93 -105
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/src/elevenlabs-provider.ts +7 -7
- package/src/elevenlabs-speech-model.ts +7 -7
- package/src/elevenlabs-transcription-model.ts +7 -7
- package/dist/index.d.mts +0 -122
- package/dist/index.mjs +0 -423
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
1
|
# @ai-sdk/elevenlabs
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.20
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ef992f8]
|
|
12
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
14
|
+
|
|
15
|
+
## 3.0.0-beta.19
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [90e2d8a]
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
21
|
+
|
|
22
|
+
## 3.0.0-beta.18
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [3ae1786]
|
|
27
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
28
|
+
|
|
29
|
+
## 3.0.0-beta.17
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [176466a]
|
|
34
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
35
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
36
|
+
|
|
37
|
+
## 3.0.0-beta.16
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [e311194]
|
|
42
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
43
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
44
|
+
|
|
45
|
+
## 3.0.0-beta.15
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [34bd95d]
|
|
50
|
+
- Updated dependencies [008271d]
|
|
51
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
52
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
53
|
+
|
|
54
|
+
## 3.0.0-beta.14
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [b0c2869]
|
|
59
|
+
- Updated dependencies [7e26e81]
|
|
60
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
61
|
+
|
|
62
|
+
## 3.0.0-beta.13
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [46d1149]
|
|
67
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
68
|
+
|
|
69
|
+
## 3.0.0-beta.12
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- Updated dependencies [6fd51c0]
|
|
74
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
75
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
76
|
+
|
|
77
|
+
## 3.0.0-beta.11
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [c29a26f]
|
|
82
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
83
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
84
|
+
|
|
85
|
+
## 3.0.0-beta.10
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
90
|
+
|
|
91
|
+
## 3.0.0-beta.9
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [2e17091]
|
|
96
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
97
|
+
|
|
98
|
+
## 3.0.0-beta.8
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [986c6fd]
|
|
103
|
+
- Updated dependencies [493295c]
|
|
104
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
105
|
+
|
|
106
|
+
## 3.0.0-beta.7
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- Updated dependencies [1f509d4]
|
|
111
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
112
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
113
|
+
|
|
114
|
+
## 3.0.0-beta.6
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [3887c70]
|
|
119
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
120
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
121
|
+
|
|
122
|
+
## 3.0.0-beta.5
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [776b617]
|
|
127
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
128
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
129
|
+
|
|
130
|
+
## 3.0.0-beta.4
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [61753c3]
|
|
135
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
136
|
+
|
|
137
|
+
## 3.0.0-beta.3
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [f7d4f01]
|
|
142
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
143
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
144
|
+
|
|
3
145
|
## 3.0.0-beta.2
|
|
4
146
|
|
|
5
147
|
### Patch Changes
|
|
@@ -219,13 +361,13 @@
|
|
|
219
361
|
Before
|
|
220
362
|
|
|
221
363
|
```ts
|
|
222
|
-
model.textEmbeddingModel(
|
|
364
|
+
model.textEmbeddingModel("my-model-id");
|
|
223
365
|
```
|
|
224
366
|
|
|
225
367
|
After
|
|
226
368
|
|
|
227
369
|
```ts
|
|
228
|
-
model.embeddingModel(
|
|
370
|
+
model.embeddingModel("my-model-id");
|
|
229
371
|
```
|
|
230
372
|
|
|
231
373
|
- 95f65c2: chore: use import \* from zod/v4
|
|
@@ -425,13 +567,13 @@
|
|
|
425
567
|
Before
|
|
426
568
|
|
|
427
569
|
```ts
|
|
428
|
-
model.textEmbeddingModel(
|
|
570
|
+
model.textEmbeddingModel("my-model-id");
|
|
429
571
|
```
|
|
430
572
|
|
|
431
573
|
After
|
|
432
574
|
|
|
433
575
|
```ts
|
|
434
|
-
model.embeddingModel(
|
|
576
|
+
model.embeddingModel("my-model-id");
|
|
435
577
|
```
|
|
436
578
|
|
|
437
579
|
- Updated dependencies [8d9e8ad]
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
The **[ElevenLabs provider](https://ai-sdk.dev/providers/ai-sdk-providers/elevenlabs)** for the [AI SDK](https://ai-sdk.dev/docs)
|
|
4
4
|
contains language model support for the ElevenLabs chat and completion APIs and embedding model support for the ElevenLabs embeddings API.
|
|
5
5
|
|
|
6
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access ElevenLabs (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 ElevenLabs provider is available in the `@ai-sdk/elevenlabs` module. You can install it with
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TranscriptionModelV4, ProviderV4, SpeechModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
@@ -36,31 +36,31 @@ interface ElevenLabsTranscriptionModelConfig extends ElevenLabsConfig {
|
|
|
36
36
|
currentDate?: () => Date;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
declare class ElevenLabsTranscriptionModel implements
|
|
39
|
+
declare class ElevenLabsTranscriptionModel implements TranscriptionModelV4 {
|
|
40
40
|
readonly modelId: ElevenLabsTranscriptionModelId;
|
|
41
41
|
private readonly config;
|
|
42
|
-
readonly specificationVersion = "
|
|
42
|
+
readonly specificationVersion = "v4";
|
|
43
43
|
get provider(): string;
|
|
44
44
|
constructor(modelId: ElevenLabsTranscriptionModelId, config: ElevenLabsTranscriptionModelConfig);
|
|
45
45
|
private getArgs;
|
|
46
|
-
doGenerate(options: Parameters<
|
|
46
|
+
doGenerate(options: Parameters<TranscriptionModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
type ElevenLabsSpeechModelId = 'eleven_v3' | 'eleven_multilingual_v2' | 'eleven_flash_v2_5' | 'eleven_flash_v2' | 'eleven_turbo_v2_5' | 'eleven_turbo_v2' | 'eleven_monolingual_v1' | 'eleven_multilingual_v1' | (string & {});
|
|
50
50
|
type ElevenLabsSpeechVoiceId = string;
|
|
51
51
|
|
|
52
|
-
interface ElevenLabsProvider extends
|
|
52
|
+
interface ElevenLabsProvider extends ProviderV4 {
|
|
53
53
|
(modelId: 'scribe_v1', settings?: {}): {
|
|
54
54
|
transcription: ElevenLabsTranscriptionModel;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* Creates a model for transcription.
|
|
58
58
|
*/
|
|
59
|
-
transcription(modelId: ElevenLabsTranscriptionModelId):
|
|
59
|
+
transcription(modelId: ElevenLabsTranscriptionModelId): TranscriptionModelV4;
|
|
60
60
|
/**
|
|
61
61
|
* Creates a model for speech generation.
|
|
62
62
|
*/
|
|
63
|
-
speech(modelId: ElevenLabsSpeechModelId):
|
|
63
|
+
speech(modelId: ElevenLabsSpeechModelId): SpeechModelV4;
|
|
64
64
|
/**
|
|
65
65
|
* @deprecated Use `embeddingModel` instead.
|
|
66
66
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,67 +1,51 @@
|
|
|
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
|
-
createElevenLabs: () => createElevenLabs,
|
|
25
|
-
elevenlabs: () => elevenlabs
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
|
|
29
1
|
// src/elevenlabs-provider.ts
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
loadApiKey,
|
|
7
|
+
withUserAgentSuffix
|
|
8
|
+
} from "@ai-sdk/provider-utils";
|
|
32
9
|
|
|
33
10
|
// src/elevenlabs-transcription-model.ts
|
|
34
|
-
|
|
35
|
-
|
|
11
|
+
import {
|
|
12
|
+
combineHeaders,
|
|
13
|
+
convertBase64ToUint8Array,
|
|
14
|
+
createJsonResponseHandler,
|
|
15
|
+
mediaTypeToExtension,
|
|
16
|
+
parseProviderOptions,
|
|
17
|
+
postFormDataToApi
|
|
18
|
+
} from "@ai-sdk/provider-utils";
|
|
19
|
+
import { z as z2 } from "zod/v4";
|
|
36
20
|
|
|
37
21
|
// src/elevenlabs-error.ts
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var elevenlabsErrorDataSchema =
|
|
41
|
-
error:
|
|
42
|
-
message:
|
|
43
|
-
code:
|
|
22
|
+
import { z } from "zod/v4";
|
|
23
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
24
|
+
var elevenlabsErrorDataSchema = z.object({
|
|
25
|
+
error: z.object({
|
|
26
|
+
message: z.string(),
|
|
27
|
+
code: z.number()
|
|
44
28
|
})
|
|
45
29
|
});
|
|
46
|
-
var elevenlabsFailedResponseHandler =
|
|
30
|
+
var elevenlabsFailedResponseHandler = createJsonErrorResponseHandler({
|
|
47
31
|
errorSchema: elevenlabsErrorDataSchema,
|
|
48
32
|
errorToMessage: (data) => data.error.message
|
|
49
33
|
});
|
|
50
34
|
|
|
51
35
|
// src/elevenlabs-transcription-model.ts
|
|
52
|
-
var elevenLabsTranscriptionModelOptionsSchema =
|
|
53
|
-
languageCode:
|
|
54
|
-
tagAudioEvents:
|
|
55
|
-
numSpeakers:
|
|
56
|
-
timestampsGranularity:
|
|
57
|
-
diarize:
|
|
58
|
-
fileFormat:
|
|
36
|
+
var elevenLabsTranscriptionModelOptionsSchema = z2.object({
|
|
37
|
+
languageCode: z2.string().nullish(),
|
|
38
|
+
tagAudioEvents: z2.boolean().nullish().default(true),
|
|
39
|
+
numSpeakers: z2.number().int().min(1).max(32).nullish(),
|
|
40
|
+
timestampsGranularity: z2.enum(["none", "word", "character"]).nullish().default("word"),
|
|
41
|
+
diarize: z2.boolean().nullish().default(false),
|
|
42
|
+
fileFormat: z2.enum(["pcm_s16le_16", "other"]).nullish().default("other")
|
|
59
43
|
});
|
|
60
44
|
var ElevenLabsTranscriptionModel = class {
|
|
61
45
|
constructor(modelId, config) {
|
|
62
46
|
this.modelId = modelId;
|
|
63
47
|
this.config = config;
|
|
64
|
-
this.specificationVersion = "
|
|
48
|
+
this.specificationVersion = "v4";
|
|
65
49
|
}
|
|
66
50
|
get provider() {
|
|
67
51
|
return this.config.provider;
|
|
@@ -73,15 +57,15 @@ var ElevenLabsTranscriptionModel = class {
|
|
|
73
57
|
}) {
|
|
74
58
|
var _a, _b, _c, _d, _e;
|
|
75
59
|
const warnings = [];
|
|
76
|
-
const elevenlabsOptions = await
|
|
60
|
+
const elevenlabsOptions = await parseProviderOptions({
|
|
77
61
|
provider: "elevenlabs",
|
|
78
62
|
providerOptions,
|
|
79
63
|
schema: elevenLabsTranscriptionModelOptionsSchema
|
|
80
64
|
});
|
|
81
65
|
const formData = new FormData();
|
|
82
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([
|
|
66
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([convertBase64ToUint8Array(audio)]);
|
|
83
67
|
formData.append("model_id", this.modelId);
|
|
84
|
-
const fileExtension =
|
|
68
|
+
const fileExtension = mediaTypeToExtension(mediaType);
|
|
85
69
|
formData.append(
|
|
86
70
|
"file",
|
|
87
71
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -119,15 +103,15 @@ var ElevenLabsTranscriptionModel = class {
|
|
|
119
103
|
value: response,
|
|
120
104
|
responseHeaders,
|
|
121
105
|
rawValue: rawResponse
|
|
122
|
-
} = await
|
|
106
|
+
} = await postFormDataToApi({
|
|
123
107
|
url: this.config.url({
|
|
124
108
|
path: "/v1/speech-to-text",
|
|
125
109
|
modelId: this.modelId
|
|
126
110
|
}),
|
|
127
|
-
headers:
|
|
111
|
+
headers: combineHeaders(this.config.headers(), options.headers),
|
|
128
112
|
formData,
|
|
129
113
|
failedResponseHandler: elevenlabsFailedResponseHandler,
|
|
130
|
-
successfulResponseHandler:
|
|
114
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
131
115
|
elevenlabsTranscriptionResponseSchema
|
|
132
116
|
),
|
|
133
117
|
abortSignal: options.abortSignal,
|
|
@@ -155,22 +139,22 @@ var ElevenLabsTranscriptionModel = class {
|
|
|
155
139
|
};
|
|
156
140
|
}
|
|
157
141
|
};
|
|
158
|
-
var elevenlabsTranscriptionResponseSchema =
|
|
159
|
-
language_code:
|
|
160
|
-
language_probability:
|
|
161
|
-
text:
|
|
162
|
-
words:
|
|
163
|
-
|
|
164
|
-
text:
|
|
165
|
-
type:
|
|
166
|
-
start:
|
|
167
|
-
end:
|
|
168
|
-
speaker_id:
|
|
169
|
-
characters:
|
|
170
|
-
|
|
171
|
-
text:
|
|
172
|
-
start:
|
|
173
|
-
end:
|
|
142
|
+
var elevenlabsTranscriptionResponseSchema = z2.object({
|
|
143
|
+
language_code: z2.string(),
|
|
144
|
+
language_probability: z2.number(),
|
|
145
|
+
text: z2.string(),
|
|
146
|
+
words: z2.array(
|
|
147
|
+
z2.object({
|
|
148
|
+
text: z2.string(),
|
|
149
|
+
type: z2.enum(["word", "spacing", "audio_event"]),
|
|
150
|
+
start: z2.number().nullish(),
|
|
151
|
+
end: z2.number().nullish(),
|
|
152
|
+
speaker_id: z2.string().nullish(),
|
|
153
|
+
characters: z2.array(
|
|
154
|
+
z2.object({
|
|
155
|
+
text: z2.string(),
|
|
156
|
+
start: z2.number().nullish(),
|
|
157
|
+
end: z2.number().nullish()
|
|
174
158
|
})
|
|
175
159
|
).nullish()
|
|
176
160
|
})
|
|
@@ -178,36 +162,41 @@ var elevenlabsTranscriptionResponseSchema = import_v42.z.object({
|
|
|
178
162
|
});
|
|
179
163
|
|
|
180
164
|
// src/elevenlabs-speech-model.ts
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
165
|
+
import {
|
|
166
|
+
combineHeaders as combineHeaders2,
|
|
167
|
+
createBinaryResponseHandler,
|
|
168
|
+
parseProviderOptions as parseProviderOptions2,
|
|
169
|
+
postJsonToApi
|
|
170
|
+
} from "@ai-sdk/provider-utils";
|
|
171
|
+
import { z as z3 } from "zod/v4";
|
|
172
|
+
var elevenLabsSpeechModelOptionsSchema = z3.object({
|
|
173
|
+
languageCode: z3.string().optional(),
|
|
174
|
+
voiceSettings: z3.object({
|
|
175
|
+
stability: z3.number().min(0).max(1).optional(),
|
|
176
|
+
similarityBoost: z3.number().min(0).max(1).optional(),
|
|
177
|
+
style: z3.number().min(0).max(1).optional(),
|
|
178
|
+
useSpeakerBoost: z3.boolean().optional()
|
|
190
179
|
}).optional(),
|
|
191
|
-
pronunciationDictionaryLocators:
|
|
192
|
-
|
|
193
|
-
pronunciationDictionaryId:
|
|
194
|
-
versionId:
|
|
180
|
+
pronunciationDictionaryLocators: z3.array(
|
|
181
|
+
z3.object({
|
|
182
|
+
pronunciationDictionaryId: z3.string(),
|
|
183
|
+
versionId: z3.string().optional()
|
|
195
184
|
})
|
|
196
185
|
).max(3).optional(),
|
|
197
|
-
seed:
|
|
198
|
-
previousText:
|
|
199
|
-
nextText:
|
|
200
|
-
previousRequestIds:
|
|
201
|
-
nextRequestIds:
|
|
202
|
-
applyTextNormalization:
|
|
203
|
-
applyLanguageTextNormalization:
|
|
204
|
-
enableLogging:
|
|
186
|
+
seed: z3.number().min(0).max(4294967295).optional(),
|
|
187
|
+
previousText: z3.string().optional(),
|
|
188
|
+
nextText: z3.string().optional(),
|
|
189
|
+
previousRequestIds: z3.array(z3.string()).max(3).optional(),
|
|
190
|
+
nextRequestIds: z3.array(z3.string()).max(3).optional(),
|
|
191
|
+
applyTextNormalization: z3.enum(["auto", "on", "off"]).optional(),
|
|
192
|
+
applyLanguageTextNormalization: z3.boolean().optional(),
|
|
193
|
+
enableLogging: z3.boolean().optional()
|
|
205
194
|
});
|
|
206
195
|
var ElevenLabsSpeechModel = class {
|
|
207
196
|
constructor(modelId, config) {
|
|
208
197
|
this.modelId = modelId;
|
|
209
198
|
this.config = config;
|
|
210
|
-
this.specificationVersion = "
|
|
199
|
+
this.specificationVersion = "v4";
|
|
211
200
|
}
|
|
212
201
|
get provider() {
|
|
213
202
|
return this.config.provider;
|
|
@@ -222,7 +211,7 @@ var ElevenLabsSpeechModel = class {
|
|
|
222
211
|
providerOptions
|
|
223
212
|
}) {
|
|
224
213
|
const warnings = [];
|
|
225
|
-
const elevenLabsOptions = await (
|
|
214
|
+
const elevenLabsOptions = await parseProviderOptions2({
|
|
226
215
|
provider: "elevenlabs",
|
|
227
216
|
providerOptions,
|
|
228
217
|
schema: elevenLabsSpeechModelOptionsSchema
|
|
@@ -331,7 +320,7 @@ var ElevenLabsSpeechModel = class {
|
|
|
331
320
|
value: audio,
|
|
332
321
|
responseHeaders,
|
|
333
322
|
rawValue: rawResponse
|
|
334
|
-
} = await
|
|
323
|
+
} = await postJsonToApi({
|
|
335
324
|
url: (() => {
|
|
336
325
|
const baseUrl = this.config.url({
|
|
337
326
|
path: `/v1/text-to-speech/${voiceId}`,
|
|
@@ -340,10 +329,10 @@ var ElevenLabsSpeechModel = class {
|
|
|
340
329
|
const queryString = new URLSearchParams(queryParams).toString();
|
|
341
330
|
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
342
331
|
})(),
|
|
343
|
-
headers: (
|
|
332
|
+
headers: combineHeaders2(this.config.headers(), options.headers),
|
|
344
333
|
body: requestBody,
|
|
345
334
|
failedResponseHandler: elevenlabsFailedResponseHandler,
|
|
346
|
-
successfulResponseHandler:
|
|
335
|
+
successfulResponseHandler: createBinaryResponseHandler(),
|
|
347
336
|
abortSignal: options.abortSignal,
|
|
348
337
|
fetch: this.config.fetch
|
|
349
338
|
});
|
|
@@ -364,13 +353,13 @@ var ElevenLabsSpeechModel = class {
|
|
|
364
353
|
};
|
|
365
354
|
|
|
366
355
|
// src/version.ts
|
|
367
|
-
var VERSION = true ? "3.0.0-beta.
|
|
356
|
+
var VERSION = true ? "3.0.0-beta.20" : "0.0.0-test";
|
|
368
357
|
|
|
369
358
|
// src/elevenlabs-provider.ts
|
|
370
359
|
function createElevenLabs(options = {}) {
|
|
371
|
-
const getHeaders = () =>
|
|
360
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
372
361
|
{
|
|
373
|
-
"xi-api-key":
|
|
362
|
+
"xi-api-key": loadApiKey({
|
|
374
363
|
apiKey: options.apiKey,
|
|
375
364
|
environmentVariableName: "ELEVENLABS_API_KEY",
|
|
376
365
|
description: "ElevenLabs"
|
|
@@ -396,20 +385,20 @@ function createElevenLabs(options = {}) {
|
|
|
396
385
|
transcription: createTranscriptionModel(modelId)
|
|
397
386
|
};
|
|
398
387
|
};
|
|
399
|
-
provider.specificationVersion = "
|
|
388
|
+
provider.specificationVersion = "v4";
|
|
400
389
|
provider.transcription = createTranscriptionModel;
|
|
401
390
|
provider.transcriptionModel = createTranscriptionModel;
|
|
402
391
|
provider.speech = createSpeechModel;
|
|
403
392
|
provider.speechModel = createSpeechModel;
|
|
404
393
|
provider.languageModel = (modelId) => {
|
|
405
|
-
throw new
|
|
394
|
+
throw new NoSuchModelError({
|
|
406
395
|
modelId,
|
|
407
396
|
modelType: "languageModel",
|
|
408
397
|
message: "ElevenLabs does not provide language models"
|
|
409
398
|
});
|
|
410
399
|
};
|
|
411
400
|
provider.embeddingModel = (modelId) => {
|
|
412
|
-
throw new
|
|
401
|
+
throw new NoSuchModelError({
|
|
413
402
|
modelId,
|
|
414
403
|
modelType: "embeddingModel",
|
|
415
404
|
message: "ElevenLabs does not provide embedding models"
|
|
@@ -417,7 +406,7 @@ function createElevenLabs(options = {}) {
|
|
|
417
406
|
};
|
|
418
407
|
provider.textEmbeddingModel = provider.embeddingModel;
|
|
419
408
|
provider.imageModel = (modelId) => {
|
|
420
|
-
throw new
|
|
409
|
+
throw new NoSuchModelError({
|
|
421
410
|
modelId,
|
|
422
411
|
modelType: "imageModel",
|
|
423
412
|
message: "ElevenLabs does not provide image models"
|
|
@@ -426,10 +415,9 @@ function createElevenLabs(options = {}) {
|
|
|
426
415
|
return provider;
|
|
427
416
|
}
|
|
428
417
|
var elevenlabs = createElevenLabs();
|
|
429
|
-
|
|
430
|
-
0 && (module.exports = {
|
|
418
|
+
export {
|
|
431
419
|
VERSION,
|
|
432
420
|
createElevenLabs,
|
|
433
421
|
elevenlabs
|
|
434
|
-
}
|
|
422
|
+
};
|
|
435
423
|
//# sourceMappingURL=index.js.map
|