ai 3.0.29 → 3.0.31

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
@@ -1474,9 +1474,22 @@ var StreamTextResult = class {
1474
1474
  read();
1475
1475
  }
1476
1476
  /**
1477
+ Converts the result to a streamed response object with a stream data part stream.
1478
+ It can be used with the `useChat` and `useCompletion` hooks.
1479
+
1480
+ @param init Optional headers.
1481
+
1482
+ @return A response object.
1483
+ */
1484
+ toAIStreamResponse(init) {
1485
+ return new StreamingTextResponse(this.toAIStream(), init);
1486
+ }
1487
+ /**
1477
1488
  Creates a simple text stream response.
1478
1489
  Each text delta is encoded as UTF-8 and sent as a separate chunk.
1479
1490
  Non-text-delta events are ignored.
1491
+
1492
+ @param init Optional headers and status code.
1480
1493
  */
1481
1494
  toTextStreamResponse(init) {
1482
1495
  var _a;
@@ -1870,7 +1883,7 @@ function readableFromAsyncIterable(iterable) {
1870
1883
  }
1871
1884
 
1872
1885
  // streams/stream-data.ts
1873
- var StreamData = class {
1886
+ var StreamData2 = class {
1874
1887
  constructor() {
1875
1888
  this.encoder = new TextEncoder();
1876
1889
  this.controller = null;
@@ -1966,7 +1979,7 @@ function createStreamDataTransformer() {
1966
1979
  }
1967
1980
  });
1968
1981
  }
1969
- var experimental_StreamData = class extends StreamData {
1982
+ var experimental_StreamData = class extends StreamData2 {
1970
1983
  };
1971
1984
 
1972
1985
  // streams/anthropic-stream.ts
@@ -2910,7 +2923,7 @@ export {
2910
2923
  MistralStream,
2911
2924
  OpenAIStream,
2912
2925
  ReplicateStream,
2913
- StreamData,
2926
+ StreamData2 as StreamData,
2914
2927
  StreamObjectResult,
2915
2928
  StreamTextResult,
2916
2929
  StreamingTextResponse,