ai 4.1.14 → 4.1.15

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
@@ -5824,9 +5824,10 @@ function appendResponseMessages({
5824
5824
 
5825
5825
  // core/registry/custom-provider.ts
5826
5826
  import { NoSuchModelError as NoSuchModelError2 } from "@ai-sdk/provider";
5827
- function experimental_customProvider({
5827
+ function customProvider({
5828
5828
  languageModels,
5829
5829
  textEmbeddingModels,
5830
+ imageModels,
5830
5831
  fallbackProvider
5831
5832
  }) {
5832
5833
  return {
@@ -5847,9 +5848,19 @@ function experimental_customProvider({
5847
5848
  return fallbackProvider.textEmbeddingModel(modelId);
5848
5849
  }
5849
5850
  throw new NoSuchModelError2({ modelId, modelType: "textEmbeddingModel" });
5851
+ },
5852
+ imageModel(modelId) {
5853
+ if (imageModels != null && modelId in imageModels) {
5854
+ return imageModels[modelId];
5855
+ }
5856
+ if (fallbackProvider == null ? void 0 : fallbackProvider.imageModel) {
5857
+ return fallbackProvider.imageModel(modelId);
5858
+ }
5859
+ throw new NoSuchModelError2({ modelId, modelType: "imageModel" });
5850
5860
  }
5851
5861
  };
5852
5862
  }
5863
+ var experimental_customProvider = customProvider;
5853
5864
 
5854
5865
  // core/registry/no-such-provider-error.ts
5855
5866
  import { AISDKError as AISDKError15, NoSuchModelError as NoSuchModelError3 } from "@ai-sdk/provider";
@@ -5889,7 +5900,10 @@ var DefaultProviderRegistry = class {
5889
5900
  constructor() {
5890
5901
  this.providers = {};
5891
5902
  }
5892
- registerProvider({ id, provider }) {
5903
+ registerProvider({
5904
+ id,
5905
+ provider
5906
+ }) {
5893
5907
  this.providers[id] = provider;
5894
5908
  }
5895
5909
  getProvider(id) {
@@ -5937,6 +5951,16 @@ var DefaultProviderRegistry = class {
5937
5951
  }
5938
5952
  return model;
5939
5953
  }
5954
+ imageModel(id) {
5955
+ var _a15;
5956
+ const [providerId, modelId] = this.splitId(id, "imageModel");
5957
+ const provider = this.getProvider(providerId);
5958
+ const model = (_a15 = provider.imageModel) == null ? void 0 : _a15.call(provider, modelId);
5959
+ if (model == null) {
5960
+ throw new NoSuchModelError4({ modelId: id, modelType: "imageModel" });
5961
+ }
5962
+ return model;
5963
+ }
5940
5964
  /**
5941
5965
  * @deprecated Use `textEmbeddingModel` instead.
5942
5966
  */
@@ -6384,6 +6408,7 @@ export {
6384
6408
  createDataStream,
6385
6409
  createDataStreamResponse,
6386
6410
  createIdGenerator5 as createIdGenerator,
6411
+ customProvider,
6387
6412
  embed,
6388
6413
  embedMany,
6389
6414
  experimental_createProviderRegistry,