ai 5.1.0-beta.15 → 5.1.0-beta.17

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/dist/index.mjs CHANGED
@@ -461,15 +461,31 @@ var RetryError = class extends AISDKError17 {
461
461
  _a15 = symbol15;
462
462
 
463
463
  // src/model/resolve-model.ts
464
+ function transformToV3LanguageModel(model) {
465
+ return {
466
+ ...model,
467
+ specificationVersion: "v3"
468
+ };
469
+ }
470
+ function transformToV3EmbeddingModel(model) {
471
+ return {
472
+ ...model,
473
+ specificationVersion: "v3"
474
+ };
475
+ }
464
476
  function resolveLanguageModel(model) {
465
477
  if (typeof model !== "string") {
466
478
  if (model.specificationVersion !== "v3" && model.specificationVersion !== "v2") {
479
+ const unsupportedModel = model;
467
480
  throw new UnsupportedModelVersionError({
468
- version: model.specificationVersion,
469
- provider: model.provider,
470
- modelId: model.modelId
481
+ version: unsupportedModel.specificationVersion,
482
+ provider: unsupportedModel.provider,
483
+ modelId: unsupportedModel.modelId
471
484
  });
472
485
  }
486
+ if (model.specificationVersion === "v2") {
487
+ return transformToV3LanguageModel(model);
488
+ }
473
489
  return model;
474
490
  }
475
491
  return getGlobalProvider().languageModel(model);
@@ -477,12 +493,16 @@ function resolveLanguageModel(model) {
477
493
  function resolveEmbeddingModel(model) {
478
494
  if (typeof model !== "string") {
479
495
  if (model.specificationVersion !== "v3" && model.specificationVersion !== "v2") {
496
+ const unsupportedModel = model;
480
497
  throw new UnsupportedModelVersionError({
481
- version: model.specificationVersion,
482
- provider: model.provider,
483
- modelId: model.modelId
498
+ version: unsupportedModel.specificationVersion,
499
+ provider: unsupportedModel.provider,
500
+ modelId: unsupportedModel.modelId
484
501
  });
485
502
  }
503
+ if (model.specificationVersion === "v2") {
504
+ return transformToV3EmbeddingModel(model);
505
+ }
486
506
  return model;
487
507
  }
488
508
  return getGlobalProvider().textEmbeddingModel(
@@ -691,7 +711,7 @@ import {
691
711
  } from "@ai-sdk/provider-utils";
692
712
 
693
713
  // src/version.ts
694
- var VERSION = true ? "5.1.0-beta.15" : "0.0.0-test";
714
+ var VERSION = true ? "5.1.0-beta.17" : "0.0.0-test";
695
715
 
696
716
  // src/util/download/download.ts
697
717
  var download = async ({ url }) => {