ai 5.0.258 → 5.0.260

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.260
4
+
5
+ ### Patch Changes
6
+
7
+ - ab8aa35: fix(ai): preserve provider metadata when simulating text streams
8
+
9
+ ## 5.0.259
10
+
11
+ ### Patch Changes
12
+
13
+ - bf32c45: fix(ai): reject embedding model responses that contain no embeddings
14
+ - Updated dependencies [5728a51]
15
+ - Updated dependencies [6d3e199]
16
+ - @ai-sdk/gateway@2.0.153
17
+
3
18
  ## 5.0.258
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -816,7 +816,7 @@ function detectMediaType({
816
816
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
817
817
 
818
818
  // src/version.ts
819
- var VERSION = true ? "5.0.258" : "0.0.0-test";
819
+ var VERSION = true ? "5.0.260" : "0.0.0-test";
820
820
 
821
821
  // src/util/download/download.ts
822
822
  var download = async ({
@@ -6529,6 +6529,12 @@ async function embed({
6529
6529
  }
6530
6530
  })
6531
6531
  );
6532
+ if (embedding2 == null) {
6533
+ throw new import_provider17.InvalidResponseDataError({
6534
+ data: modelResponse.embeddings,
6535
+ message: "No embedding generated."
6536
+ });
6537
+ }
6532
6538
  return {
6533
6539
  embedding: embedding2,
6534
6540
  usage: usage2,
@@ -8970,7 +8976,11 @@ function simulateStreamingMiddleware() {
8970
8976
  switch (part.type) {
8971
8977
  case "text": {
8972
8978
  if (part.text.length > 0) {
8973
- controller.enqueue({ type: "text-start", id: String(id) });
8979
+ controller.enqueue({
8980
+ type: "text-start",
8981
+ id: String(id),
8982
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
8983
+ });
8974
8984
  controller.enqueue({
8975
8985
  type: "text-delta",
8976
8986
  id: String(id),