ai 6.0.0-beta.70 → 6.0.0-beta.71

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.71
4
+
5
+ ### Patch Changes
6
+
7
+ - 077aea3: feat(ai): stable structured output on generateText, streamText, and ToolLoopAgent
8
+
3
9
  ## 6.0.0-beta.70
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -632,9 +632,16 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
632
632
  */
633
633
  readonly steps: Array<StepResult<TOOLS>>;
634
634
  /**
635
- The generated structured output. It uses the `experimental_output` specification.
635
+ The generated structured output. It uses the `output` specification.
636
+
637
+ @deprecated Use `output` instead.
636
638
  */
637
639
  readonly experimental_output: OUTPUT;
640
+ /**
641
+ The generated structured output. It uses the `output` specification.
642
+
643
+ */
644
+ readonly output: OUTPUT;
638
645
  }
639
646
 
640
647
  /**
@@ -1092,7 +1099,7 @@ If set and supported by the model, calls will generate deterministic results.
1092
1099
  @returns
1093
1100
  A result object that contains the generated text, the results of the tool calls, and additional information.
1094
1101
  */
1095
- declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
1102
+ declare function generateText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
1096
1103
  /**
1097
1104
  The language model to use.
1098
1105
  */
@@ -1134,7 +1141,13 @@ changing the tool call and result types in the result.
1134
1141
  /**
1135
1142
  Optional specification for parsing structured outputs from the LLM response.
1136
1143
  */
1137
- experimental_output?: Output<OUTPUT, OUTPUT_PARTIAL>;
1144
+ output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1145
+ /**
1146
+ Optional specification for parsing structured outputs from the LLM response.
1147
+
1148
+ @deprecated Use `output` instead.
1149
+ */
1150
+ experimental_output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1138
1151
  /**
1139
1152
  Custom download function to use for URLs.
1140
1153
 
@@ -1332,7 +1345,7 @@ If set and supported by the model, calls will generate deterministic results.
1332
1345
  @return
1333
1346
  A result object for accessing different stream types and additional information.
1334
1347
  */
1335
- declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
1348
+ declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
1336
1349
  /**
1337
1350
  The language model to use.
1338
1351
  */
@@ -1374,6 +1387,12 @@ functionality that can be fully encapsulated in the provider.
1374
1387
  /**
1375
1388
  Optional specification for parsing structured outputs from the LLM response.
1376
1389
  */
1390
+ output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1391
+ /**
1392
+ Optional specification for parsing structured outputs from the LLM response.
1393
+
1394
+ @deprecated Use `output` instead.
1395
+ */
1377
1396
  experimental_output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1378
1397
  /**
1379
1398
  Optional function that you can use to provide different settings for a step.
@@ -2301,10 +2320,16 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2301
2320
  */
2302
2321
  readonly fullStream: AsyncIterableStream<TextStreamPart<TOOLS>>;
2303
2322
  /**
2304
- A stream of partial outputs. It uses the `experimental_output` specification.
2323
+ * A stream of partial outputs. It uses the `output` specification.
2324
+ *
2325
+ * @deprecated Use `partialOutputStream` instead.
2305
2326
  */
2306
2327
  readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2307
2328
  /**
2329
+ * A stream of partial outputs. It uses the `output` specification.
2330
+ */
2331
+ readonly partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2332
+ /**
2308
2333
  Consumes the stream without processing the parts.
2309
2334
  This is useful to force the stream to finish.
2310
2335
  It effectively removes the backpressure and allows the stream to finish,
@@ -2553,9 +2578,9 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2553
2578
  */
2554
2579
  activeTools?: Array<keyof NoInfer<TOOLS>>;
2555
2580
  /**
2556
- Optional specification for parsing structured outputs from the LLM response.
2581
+ Optional specification for generating structured outputs.
2557
2582
  */
2558
- experimental_output?: OUTPUT;
2583
+ output?: OUTPUT;
2559
2584
  /**
2560
2585
  Optional function that you can use to provide different settings for a step.
2561
2586
  */
package/dist/index.d.ts CHANGED
@@ -632,9 +632,16 @@ interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
632
632
  */
633
633
  readonly steps: Array<StepResult<TOOLS>>;
634
634
  /**
635
- The generated structured output. It uses the `experimental_output` specification.
635
+ The generated structured output. It uses the `output` specification.
636
+
637
+ @deprecated Use `output` instead.
636
638
  */
637
639
  readonly experimental_output: OUTPUT;
640
+ /**
641
+ The generated structured output. It uses the `output` specification.
642
+
643
+ */
644
+ readonly output: OUTPUT;
638
645
  }
639
646
 
640
647
  /**
@@ -1092,7 +1099,7 @@ If set and supported by the model, calls will generate deterministic results.
1092
1099
  @returns
1093
1100
  A result object that contains the generated text, the results of the tool calls, and additional information.
1094
1101
  */
1095
- declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
1102
+ declare function generateText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, _internal: { generateId, currentDate, }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
1096
1103
  /**
1097
1104
  The language model to use.
1098
1105
  */
@@ -1134,7 +1141,13 @@ changing the tool call and result types in the result.
1134
1141
  /**
1135
1142
  Optional specification for parsing structured outputs from the LLM response.
1136
1143
  */
1137
- experimental_output?: Output<OUTPUT, OUTPUT_PARTIAL>;
1144
+ output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1145
+ /**
1146
+ Optional specification for parsing structured outputs from the LLM response.
1147
+
1148
+ @deprecated Use `output` instead.
1149
+ */
1150
+ experimental_output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1138
1151
  /**
1139
1152
  Custom download function to use for URLs.
1140
1153
 
@@ -1332,7 +1345,7 @@ If set and supported by the model, calls will generate deterministic results.
1332
1345
  @return
1333
1346
  A result object for accessing different stream types and additional information.
1334
1347
  */
1335
- declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
1348
+ declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
1336
1349
  /**
1337
1350
  The language model to use.
1338
1351
  */
@@ -1374,6 +1387,12 @@ functionality that can be fully encapsulated in the provider.
1374
1387
  /**
1375
1388
  Optional specification for parsing structured outputs from the LLM response.
1376
1389
  */
1390
+ output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1391
+ /**
1392
+ Optional specification for parsing structured outputs from the LLM response.
1393
+
1394
+ @deprecated Use `output` instead.
1395
+ */
1377
1396
  experimental_output?: Output<OUTPUT, PARTIAL_OUTPUT>;
1378
1397
  /**
1379
1398
  Optional function that you can use to provide different settings for a step.
@@ -2301,10 +2320,16 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2301
2320
  */
2302
2321
  readonly fullStream: AsyncIterableStream<TextStreamPart<TOOLS>>;
2303
2322
  /**
2304
- A stream of partial outputs. It uses the `experimental_output` specification.
2323
+ * A stream of partial outputs. It uses the `output` specification.
2324
+ *
2325
+ * @deprecated Use `partialOutputStream` instead.
2305
2326
  */
2306
2327
  readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2307
2328
  /**
2329
+ * A stream of partial outputs. It uses the `output` specification.
2330
+ */
2331
+ readonly partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2332
+ /**
2308
2333
  Consumes the stream without processing the parts.
2309
2334
  This is useful to force the stream to finish.
2310
2335
  It effectively removes the backpressure and allows the stream to finish,
@@ -2553,9 +2578,9 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT
2553
2578
  */
2554
2579
  activeTools?: Array<keyof NoInfer<TOOLS>>;
2555
2580
  /**
2556
- Optional specification for parsing structured outputs from the LLM response.
2581
+ Optional specification for generating structured outputs.
2557
2582
  */
2558
- experimental_output?: OUTPUT;
2583
+ output?: OUTPUT;
2559
2584
  /**
2560
2585
  Optional function that you can use to provide different settings for a step.
2561
2586
  */
package/dist/index.js CHANGED
@@ -876,7 +876,7 @@ function detectMediaType({
876
876
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
877
877
 
878
878
  // src/version.ts
879
- var VERSION = true ? "6.0.0-beta.70" : "0.0.0-test";
879
+ var VERSION = true ? "6.0.0-beta.71" : "0.0.0-test";
880
880
 
881
881
  // src/util/download/download.ts
882
882
  var download = async ({ url }) => {
@@ -2647,7 +2647,8 @@ async function generateText({
2647
2647
  abortSignal,
2648
2648
  headers,
2649
2649
  stopWhen = stepCountIs(1),
2650
- experimental_output: output,
2650
+ experimental_output,
2651
+ output = experimental_output,
2651
2652
  experimental_telemetry: telemetry,
2652
2653
  providerOptions,
2653
2654
  experimental_activeTools,
@@ -3158,6 +3159,9 @@ var DefaultGenerateTextResult = class {
3158
3159
  return this.finalStep.usage;
3159
3160
  }
3160
3161
  get experimental_output() {
3162
+ return this.output;
3163
+ }
3164
+ get output() {
3161
3165
  if (this.resolvedOutput == null) {
3162
3166
  throw new NoOutputSpecifiedError();
3163
3167
  }
@@ -4937,7 +4941,8 @@ function streamText({
4937
4941
  abortSignal,
4938
4942
  headers,
4939
4943
  stopWhen = stepCountIs(1),
4940
- experimental_output: output,
4944
+ experimental_output,
4945
+ output = experimental_output,
4941
4946
  experimental_telemetry: telemetry,
4942
4947
  prepareStep,
4943
4948
  providerOptions,
@@ -5988,6 +5993,9 @@ var DefaultStreamTextResult = class {
5988
5993
  }
5989
5994
  }
5990
5995
  get experimental_partialOutputStream() {
5996
+ return this.partialOutputStream;
5997
+ }
5998
+ get partialOutputStream() {
5991
5999
  if (this.output == null) {
5992
6000
  throw new NoOutputSpecifiedError();
5993
6001
  }