ai 4.0.2 → 4.0.4

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,23 @@
1
1
  # ai
2
2
 
3
+ ## 4.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 6ff6689: fix (ai): trigger onFinal when stream adapter finishes
8
+ - 6ff6689: chore (ai): deprecate onCompletion (stream callbacks)
9
+
10
+ ## 4.0.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [88b364b]
15
+ - Updated dependencies [b446ae5]
16
+ - @ai-sdk/ui-utils@1.0.2
17
+ - @ai-sdk/provider@1.0.1
18
+ - @ai-sdk/react@1.0.2
19
+ - @ai-sdk/provider-utils@2.0.2
20
+
3
21
  ## 4.0.2
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2176,7 +2176,11 @@ declare function AssistantResponse({ threadId, messageId }: AssistantResponseSet
2176
2176
  interface StreamCallbacks {
2177
2177
  /** `onStart`: Called once when the stream is initialized. */
2178
2178
  onStart?: () => Promise<void> | void;
2179
- /** `onCompletion`: Called for each tokenized message. */
2179
+ /**
2180
+ * `onCompletion`: Called for each tokenized message.
2181
+ *
2182
+ * @deprecated Use `onFinal` instead.
2183
+ */
2180
2184
  onCompletion?: (completion: string) => Promise<void> | void;
2181
2185
  /** `onFinal`: Called once when the stream is closed with the final completion message. */
2182
2186
  onFinal?: (completion: string) => Promise<void> | void;
package/dist/index.d.ts CHANGED
@@ -2176,7 +2176,11 @@ declare function AssistantResponse({ threadId, messageId }: AssistantResponseSet
2176
2176
  interface StreamCallbacks {
2177
2177
  /** `onStart`: Called once when the stream is initialized. */
2178
2178
  onStart?: () => Promise<void> | void;
2179
- /** `onCompletion`: Called for each tokenized message. */
2179
+ /**
2180
+ * `onCompletion`: Called for each tokenized message.
2181
+ *
2182
+ * @deprecated Use `onFinal` instead.
2183
+ */
2180
2184
  onCompletion?: (completion: string) => Promise<void> | void;
2181
2185
  /** `onFinal`: Called once when the stream is closed with the final completion message. */
2182
2186
  onFinal?: (completion: string) => Promise<void> | void;
package/dist/index.js CHANGED
@@ -5007,6 +5007,9 @@ function createCallbacksTransformer(callbacks = {}) {
5007
5007
  if (callbacks.onCompletion) {
5008
5008
  await callbacks.onCompletion(aggregatedResponse);
5009
5009
  }
5010
+ if (callbacks.onFinal) {
5011
+ await callbacks.onFinal(aggregatedResponse);
5012
+ }
5010
5013
  }
5011
5014
  });
5012
5015
  }