ai 6.0.0-beta.140 → 6.0.0-beta.141

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
+ ## 6.0.0-beta.141
4
+
5
+ ### Patch Changes
6
+
7
+ - b1405bf: feat(ai): send context into streamText / generateText onFinish callbacks
8
+
3
9
  ## 6.0.0-beta.140
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1151,13 +1151,21 @@ Callback that is set using the `onFinish` option.
1151
1151
  */
1152
1152
  type GenerateTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
1153
1153
  /**
1154
- Details for all steps.
1155
- */
1154
+ * Details for all steps.
1155
+ */
1156
1156
  readonly steps: StepResult<TOOLS>[];
1157
1157
  /**
1158
- Total usage for all steps. This is the sum of the usage of all steps.
1158
+ * Total usage for all steps. This is the sum of the usage of all steps.
1159
1159
  */
1160
1160
  readonly totalUsage: LanguageModelUsage;
1161
+ /**
1162
+ * Context that is passed into tool execution.
1163
+ *
1164
+ * Experimental (can break in patch releases).
1165
+ *
1166
+ * @default undefined
1167
+ */
1168
+ experimental_context: unknown;
1161
1169
  }) => PromiseLike<void> | void;
1162
1170
  /**
1163
1171
  Generate a text and call tools for a given prompt using a language model.
@@ -2389,13 +2397,21 @@ Callback that is set using the `onFinish` option.
2389
2397
  */
2390
2398
  type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
2391
2399
  /**
2392
- Details for all steps.
2393
- */
2400
+ * Details for all steps.
2401
+ */
2394
2402
  readonly steps: StepResult<TOOLS>[];
2395
2403
  /**
2396
- Total usage for all steps. This is the sum of the usage of all steps.
2404
+ * Total usage for all steps. This is the sum of the usage of all steps.
2397
2405
  */
2398
2406
  readonly totalUsage: LanguageModelUsage;
2407
+ /**
2408
+ * Context that is passed into tool execution.
2409
+ *
2410
+ * Experimental (can break in patch releases).
2411
+ *
2412
+ * @default undefined
2413
+ */
2414
+ experimental_context: unknown;
2399
2415
  }) => PromiseLike<void> | void;
2400
2416
  /**
2401
2417
  Callback that is set using the `onAbort` option.
package/dist/index.d.ts CHANGED
@@ -1151,13 +1151,21 @@ Callback that is set using the `onFinish` option.
1151
1151
  */
1152
1152
  type GenerateTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
1153
1153
  /**
1154
- Details for all steps.
1155
- */
1154
+ * Details for all steps.
1155
+ */
1156
1156
  readonly steps: StepResult<TOOLS>[];
1157
1157
  /**
1158
- Total usage for all steps. This is the sum of the usage of all steps.
1158
+ * Total usage for all steps. This is the sum of the usage of all steps.
1159
1159
  */
1160
1160
  readonly totalUsage: LanguageModelUsage;
1161
+ /**
1162
+ * Context that is passed into tool execution.
1163
+ *
1164
+ * Experimental (can break in patch releases).
1165
+ *
1166
+ * @default undefined
1167
+ */
1168
+ experimental_context: unknown;
1161
1169
  }) => PromiseLike<void> | void;
1162
1170
  /**
1163
1171
  Generate a text and call tools for a given prompt using a language model.
@@ -2389,13 +2397,21 @@ Callback that is set using the `onFinish` option.
2389
2397
  */
2390
2398
  type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
2391
2399
  /**
2392
- Details for all steps.
2393
- */
2400
+ * Details for all steps.
2401
+ */
2394
2402
  readonly steps: StepResult<TOOLS>[];
2395
2403
  /**
2396
- Total usage for all steps. This is the sum of the usage of all steps.
2404
+ * Total usage for all steps. This is the sum of the usage of all steps.
2397
2405
  */
2398
2406
  readonly totalUsage: LanguageModelUsage;
2407
+ /**
2408
+ * Context that is passed into tool execution.
2409
+ *
2410
+ * Experimental (can break in patch releases).
2411
+ *
2412
+ * @default undefined
2413
+ */
2414
+ experimental_context: unknown;
2399
2415
  }) => PromiseLike<void> | void;
2400
2416
  /**
2401
2417
  Callback that is set using the `onAbort` option.
package/dist/index.js CHANGED
@@ -962,7 +962,7 @@ function detectMediaType({
962
962
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
963
963
 
964
964
  // src/version.ts
965
- var VERSION = true ? "6.0.0-beta.140" : "0.0.0-test";
965
+ var VERSION = true ? "6.0.0-beta.141" : "0.0.0-test";
966
966
 
967
967
  // src/util/download/download.ts
968
968
  var download = async ({ url }) => {
@@ -3833,7 +3833,8 @@ async function generateText({
3833
3833
  warnings: lastStep.warnings,
3834
3834
  providerMetadata: lastStep.providerMetadata,
3835
3835
  steps,
3836
- totalUsage
3836
+ totalUsage,
3837
+ experimental_context
3837
3838
  }));
3838
3839
  let resolvedOutput;
3839
3840
  if (lastStep.finishReason === "stop") {
@@ -5742,7 +5743,8 @@ var DefaultStreamTextResult = class {
5742
5743
  response: finalStep.response,
5743
5744
  warnings: finalStep.warnings,
5744
5745
  providerMetadata: finalStep.providerMetadata,
5745
- steps: recordedSteps
5746
+ steps: recordedSteps,
5747
+ experimental_context
5746
5748
  }));
5747
5749
  rootSpan.setAttributes(
5748
5750
  await selectTelemetryAttributes({