ai 4.1.23 → 4.1.24

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,11 @@
1
1
  # ai
2
2
 
3
+ ## 4.1.24
4
+
5
+ ### Patch Changes
6
+
7
+ - 38142b8: feat (ai/core): introduce streamText consumeStream
8
+
3
9
  ## 4.1.23
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2116,6 +2116,13 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2116
2116
  */
2117
2117
  readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2118
2118
  /**
2119
+ Consumes the stream without processing the parts.
2120
+ This is useful to force the stream to finish.
2121
+ It effectively removes the backpressure and allows the stream to finish,
2122
+ triggering the `onFinish` callback and the promise resolution.
2123
+ */
2124
+ consumeStream(): Promise<void>;
2125
+ /**
2119
2126
  Converts the result to a data stream.
2120
2127
 
2121
2128
  @param data an optional StreamData object that will be merged into the stream.
package/dist/index.d.ts CHANGED
@@ -2116,6 +2116,13 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2116
2116
  */
2117
2117
  readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2118
2118
  /**
2119
+ Consumes the stream without processing the parts.
2120
+ This is useful to force the stream to finish.
2121
+ It effectively removes the backpressure and allows the stream to finish,
2122
+ triggering the `onFinish` callback and the promise resolution.
2123
+ */
2124
+ consumeStream(): Promise<void>;
2125
+ /**
2119
2126
  Converts the result to a data stream.
2120
2127
 
2121
2128
  @param data an optional StreamData object that will be merged into the stream.
package/dist/index.js CHANGED
@@ -5521,6 +5521,11 @@ var DefaultStreamTextResult = class {
5521
5521
  )
5522
5522
  );
5523
5523
  }
5524
+ async consumeStream() {
5525
+ const stream = this.fullStream;
5526
+ for await (const part of stream) {
5527
+ }
5528
+ }
5524
5529
  get experimental_partialOutputStream() {
5525
5530
  if (this.output == null) {
5526
5531
  throw new NoOutputSpecifiedError();