ai 6.0.0-beta.46 → 6.0.0-beta.48
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 +12 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +64 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -16
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -482,6 +482,24 @@ function transformToV3EmbeddingModel(model) {
|
|
|
482
482
|
}
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
|
+
function transformToV3TranscriptionModel(model) {
|
|
486
|
+
return new Proxy(model, {
|
|
487
|
+
get(target, prop) {
|
|
488
|
+
if (prop === "specificationVersion")
|
|
489
|
+
return "v3";
|
|
490
|
+
return target[prop];
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
function transformToV3SpeechModel(model) {
|
|
495
|
+
return new Proxy(model, {
|
|
496
|
+
get(target, prop) {
|
|
497
|
+
if (prop === "specificationVersion")
|
|
498
|
+
return "v3";
|
|
499
|
+
return target[prop];
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
}
|
|
485
503
|
function resolveLanguageModel(model) {
|
|
486
504
|
if (typeof model !== "string") {
|
|
487
505
|
if (model.specificationVersion !== "v3" && model.specificationVersion !== "v2") {
|
|
@@ -518,6 +536,42 @@ function resolveEmbeddingModel(model) {
|
|
|
518
536
|
model
|
|
519
537
|
);
|
|
520
538
|
}
|
|
539
|
+
function resolveTranscriptionModel(model) {
|
|
540
|
+
var _a17, _b;
|
|
541
|
+
if (typeof model !== "string") {
|
|
542
|
+
if (model.specificationVersion !== "v3" && model.specificationVersion !== "v2") {
|
|
543
|
+
const unsupportedModel = model;
|
|
544
|
+
throw new UnsupportedModelVersionError({
|
|
545
|
+
version: unsupportedModel.specificationVersion,
|
|
546
|
+
provider: unsupportedModel.provider,
|
|
547
|
+
modelId: unsupportedModel.modelId
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
if (model.specificationVersion === "v2") {
|
|
551
|
+
return transformToV3TranscriptionModel(model);
|
|
552
|
+
}
|
|
553
|
+
return model;
|
|
554
|
+
}
|
|
555
|
+
return (_b = (_a17 = getGlobalProvider()).transcriptionModel) == null ? void 0 : _b.call(_a17, model);
|
|
556
|
+
}
|
|
557
|
+
function resolveSpeechModel(model) {
|
|
558
|
+
var _a17, _b;
|
|
559
|
+
if (typeof model !== "string") {
|
|
560
|
+
if (model.specificationVersion !== "v3" && model.specificationVersion !== "v2") {
|
|
561
|
+
const unsupportedModel = model;
|
|
562
|
+
throw new UnsupportedModelVersionError({
|
|
563
|
+
version: unsupportedModel.specificationVersion,
|
|
564
|
+
provider: unsupportedModel.provider,
|
|
565
|
+
modelId: unsupportedModel.modelId
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
if (model.specificationVersion === "v2") {
|
|
569
|
+
return transformToV3SpeechModel(model);
|
|
570
|
+
}
|
|
571
|
+
return model;
|
|
572
|
+
}
|
|
573
|
+
return (_b = (_a17 = getGlobalProvider()).speechModel) == null ? void 0 : _b.call(_a17, model);
|
|
574
|
+
}
|
|
521
575
|
function getGlobalProvider() {
|
|
522
576
|
var _a17;
|
|
523
577
|
return (_a17 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a17 : gateway;
|
|
@@ -720,7 +774,7 @@ import {
|
|
|
720
774
|
} from "@ai-sdk/provider-utils";
|
|
721
775
|
|
|
722
776
|
// src/version.ts
|
|
723
|
-
var VERSION = true ? "6.0.0-beta.
|
|
777
|
+
var VERSION = true ? "6.0.0-beta.48" : "0.0.0-test";
|
|
724
778
|
|
|
725
779
|
// src/util/download/download.ts
|
|
726
780
|
var download = async ({ url }) => {
|
|
@@ -8270,12 +8324,9 @@ async function generateSpeech({
|
|
|
8270
8324
|
headers
|
|
8271
8325
|
}) {
|
|
8272
8326
|
var _a17;
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
provider: model.provider,
|
|
8277
|
-
modelId: model.modelId
|
|
8278
|
-
});
|
|
8327
|
+
const resolvedModel = resolveSpeechModel(model);
|
|
8328
|
+
if (!resolvedModel) {
|
|
8329
|
+
throw new Error("Model could not be resolved");
|
|
8279
8330
|
}
|
|
8280
8331
|
const headersWithUserAgent = withUserAgentSuffix7(
|
|
8281
8332
|
headers != null ? headers : {},
|
|
@@ -8286,7 +8337,7 @@ async function generateSpeech({
|
|
|
8286
8337
|
abortSignal
|
|
8287
8338
|
});
|
|
8288
8339
|
const result = await retry(
|
|
8289
|
-
() =>
|
|
8340
|
+
() => resolvedModel.doGenerate({
|
|
8290
8341
|
text: text2,
|
|
8291
8342
|
voice,
|
|
8292
8343
|
outputFormat,
|
|
@@ -9706,12 +9757,9 @@ async function transcribe({
|
|
|
9706
9757
|
abortSignal,
|
|
9707
9758
|
headers
|
|
9708
9759
|
}) {
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
provider: model.provider,
|
|
9713
|
-
modelId: model.modelId
|
|
9714
|
-
});
|
|
9760
|
+
const resolvedModel = resolveTranscriptionModel(model);
|
|
9761
|
+
if (!resolvedModel) {
|
|
9762
|
+
throw new Error("Model could not be resolved");
|
|
9715
9763
|
}
|
|
9716
9764
|
const { retry } = prepareRetries({
|
|
9717
9765
|
maxRetries: maxRetriesArg,
|
|
@@ -9725,7 +9773,7 @@ async function transcribe({
|
|
|
9725
9773
|
const result = await retry(
|
|
9726
9774
|
() => {
|
|
9727
9775
|
var _a17;
|
|
9728
|
-
return
|
|
9776
|
+
return resolvedModel.doGenerate({
|
|
9729
9777
|
audio: audioData,
|
|
9730
9778
|
abortSignal,
|
|
9731
9779
|
headers: headersWithUserAgent,
|
|
@@ -10421,7 +10469,7 @@ var AbstractChat = class {
|
|
|
10421
10469
|
}
|
|
10422
10470
|
this.activeResponse = void 0;
|
|
10423
10471
|
}
|
|
10424
|
-
if ((_b = this.sendAutomaticallyWhen) == null ? void 0 : _b.call(this, { messages: this.state.messages })) {
|
|
10472
|
+
if (((_b = this.sendAutomaticallyWhen) == null ? void 0 : _b.call(this, { messages: this.state.messages })) && !isError) {
|
|
10425
10473
|
await this.makeRequest({
|
|
10426
10474
|
trigger: "submit-message",
|
|
10427
10475
|
messageId: (_c = this.lastMessage) == null ? void 0 : _c.id,
|