ai 4.2.5 → 4.2.7

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
@@ -1669,13 +1669,24 @@ function convertToCoreMessages(messages, options) {
1669
1669
  break;
1670
1670
  }
1671
1671
  case "user": {
1672
- coreMessages.push({
1673
- role: "user",
1674
- content: experimental_attachments ? [
1675
- { type: "text", text: content },
1676
- ...attachmentsToParts(experimental_attachments)
1677
- ] : content
1678
- });
1672
+ if (message.parts == null) {
1673
+ coreMessages.push({
1674
+ role: "user",
1675
+ content: experimental_attachments ? [
1676
+ { type: "text", text: content },
1677
+ ...attachmentsToParts(experimental_attachments)
1678
+ ] : content
1679
+ });
1680
+ } else {
1681
+ const textParts = message.parts.filter((part) => part.type === "text").map((part) => ({
1682
+ type: "text",
1683
+ text: part.text
1684
+ }));
1685
+ coreMessages.push({
1686
+ role: "user",
1687
+ content: experimental_attachments ? [...textParts, ...attachmentsToParts(experimental_attachments)] : textParts
1688
+ });
1689
+ }
1679
1690
  break;
1680
1691
  }
1681
1692
  case "assistant": {
@@ -6733,16 +6744,22 @@ _a16 = symbol16;
6733
6744
 
6734
6745
  // core/registry/provider-registry.ts
6735
6746
  import { NoSuchModelError as NoSuchModelError4 } from "@ai-sdk/provider";
6736
- function experimental_createProviderRegistry(providers) {
6737
- const registry = new DefaultProviderRegistry();
6747
+ function createProviderRegistry(providers, {
6748
+ separator = ":"
6749
+ } = {}) {
6750
+ const registry = new DefaultProviderRegistry({
6751
+ separator
6752
+ });
6738
6753
  for (const [id, provider] of Object.entries(providers)) {
6739
6754
  registry.registerProvider({ id, provider });
6740
6755
  }
6741
6756
  return registry;
6742
6757
  }
6758
+ var experimental_createProviderRegistry = createProviderRegistry;
6743
6759
  var DefaultProviderRegistry = class {
6744
- constructor() {
6760
+ constructor({ separator }) {
6745
6761
  this.providers = {};
6762
+ this.separator = separator;
6746
6763
  }
6747
6764
  registerProvider({
6748
6765
  id,
@@ -6763,12 +6780,12 @@ var DefaultProviderRegistry = class {
6763
6780
  return provider;
6764
6781
  }
6765
6782
  splitId(id, modelType) {
6766
- const index = id.indexOf(":");
6783
+ const index = id.indexOf(this.separator);
6767
6784
  if (index === -1) {
6768
6785
  throw new NoSuchModelError4({
6769
6786
  modelId: id,
6770
6787
  modelType,
6771
- message: `Invalid ${modelType} id for registry: ${id} (must be in the format "providerId:modelId")`
6788
+ message: `Invalid ${modelType} id for registry: ${id} (must be in the format "providerId${this.separator}modelId")`
6772
6789
  });
6773
6790
  }
6774
6791
  return [id.slice(0, index), id.slice(index + 1)];
@@ -6805,12 +6822,6 @@ var DefaultProviderRegistry = class {
6805
6822
  }
6806
6823
  return model;
6807
6824
  }
6808
- /**
6809
- * @deprecated Use `textEmbeddingModel` instead.
6810
- */
6811
- textEmbedding(id) {
6812
- return this.textEmbeddingModel(id);
6813
- }
6814
6825
  };
6815
6826
 
6816
6827
  // core/tool/mcp/mcp-client.ts
@@ -7801,6 +7812,7 @@ export {
7801
7812
  createDataStream,
7802
7813
  createDataStreamResponse,
7803
7814
  createIdGenerator5 as createIdGenerator,
7815
+ createProviderRegistry,
7804
7816
  customProvider,
7805
7817
  defaultSettingsMiddleware,
7806
7818
  embed,