ai 6.0.0-beta.69 → 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 +12 -0
 - package/dist/index.d.mts +53 -7
 - package/dist/index.d.ts +53 -7
 - package/dist/index.js +89 -4
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +89 -4
 - package/dist/index.mjs.map +1 -1
 - package/dist/internal/index.js +1 -1
 - package/dist/internal/index.mjs +1 -1
 - package/package.json +1 -1
 
    
        package/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,5 +1,17 @@ 
     | 
|
| 
       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 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## 6.0.0-beta.70
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ### Patch Changes
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            - d7bae86: feat(ai): add Output.choice()
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       3 
15 
     | 
    
         
             
            ## 6.0.0-beta.69
         
     | 
| 
       4 
16 
     | 
    
         | 
| 
       5 
17 
     | 
    
         
             
            ### 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 ` 
     | 
| 
      
 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 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -672,12 +679,14 @@ interface Output<OUTPUT = any, PARTIAL = any> { 
     | 
|
| 
       672 
679 
     | 
    
         
             
            }
         
     | 
| 
       673 
680 
     | 
    
         
             
            /**
         
     | 
| 
       674 
681 
     | 
    
         
             
             * Output specification for text generation.
         
     | 
| 
      
 682 
     | 
    
         
            +
             * This is the default output mode that generates plain text.
         
     | 
| 
       675 
683 
     | 
    
         
             
             *
         
     | 
| 
       676 
684 
     | 
    
         
             
             * @returns An output specification for generating text.
         
     | 
| 
       677 
685 
     | 
    
         
             
             */
         
     | 
| 
       678 
686 
     | 
    
         
             
            declare const text: () => Output<string, string>;
         
     | 
| 
       679 
687 
     | 
    
         
             
            /**
         
     | 
| 
       680 
688 
     | 
    
         
             
             * Output specification for typed object generation using schemas.
         
     | 
| 
      
 689 
     | 
    
         
            +
             * When the model generates a text response, it will return an object that matches the schema.
         
     | 
| 
       681 
690 
     | 
    
         
             
             *
         
     | 
| 
       682 
691 
     | 
    
         
             
             * @param schema - The schema of the object to generate.
         
     | 
| 
       683 
692 
     | 
    
         
             
             *
         
     | 
| 
         @@ -686,18 +695,37 @@ declare const text: () => Output<string, string>; 
     | 
|
| 
       686 
695 
     | 
    
         
             
            declare const object: <OUTPUT>({ schema: inputSchema, }: {
         
     | 
| 
       687 
696 
     | 
    
         
             
                schema: FlexibleSchema<OUTPUT>;
         
     | 
| 
       688 
697 
     | 
    
         
             
            }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
         
     | 
| 
      
 698 
     | 
    
         
            +
            /**
         
     | 
| 
      
 699 
     | 
    
         
            +
             * Array output specification for text generation.
         
     | 
| 
      
 700 
     | 
    
         
            +
             * When the model generates a text response, it will return an array of elements.
         
     | 
| 
      
 701 
     | 
    
         
            +
             *
         
     | 
| 
      
 702 
     | 
    
         
            +
             * @param element - The schema of the element to generate.
         
     | 
| 
      
 703 
     | 
    
         
            +
             * @returns An output specification for generating an array of elements.
         
     | 
| 
      
 704 
     | 
    
         
            +
             */
         
     | 
| 
       689 
705 
     | 
    
         
             
            declare const array: <ELEMENT>({ element: inputElementSchema, }: {
         
     | 
| 
       690 
706 
     | 
    
         
             
                element: FlexibleSchema<ELEMENT>;
         
     | 
| 
       691 
707 
     | 
    
         
             
            }) => Output<Array<ELEMENT>, Array<ELEMENT>>;
         
     | 
| 
      
 708 
     | 
    
         
            +
            /**
         
     | 
| 
      
 709 
     | 
    
         
            +
             * Choice output specification for text generation.
         
     | 
| 
      
 710 
     | 
    
         
            +
             * When the model generates a text response, it will return a one of the choice options.
         
     | 
| 
      
 711 
     | 
    
         
            +
             *
         
     | 
| 
      
 712 
     | 
    
         
            +
             * @param options - The options to choose from.
         
     | 
| 
      
 713 
     | 
    
         
            +
             * @returns An output specification for generating a choice.
         
     | 
| 
      
 714 
     | 
    
         
            +
             */
         
     | 
| 
      
 715 
     | 
    
         
            +
            declare const choice: <ELEMENT extends string>({ options: choiceOptions, }: {
         
     | 
| 
      
 716 
     | 
    
         
            +
                options: Array<ELEMENT>;
         
     | 
| 
      
 717 
     | 
    
         
            +
            }) => Output<ELEMENT, ELEMENT>;
         
     | 
| 
       692 
718 
     | 
    
         | 
| 
       693 
719 
     | 
    
         
             
            type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
         
     | 
| 
       694 
720 
     | 
    
         
             
            declare const output_array: typeof array;
         
     | 
| 
      
 721 
     | 
    
         
            +
            declare const output_choice: typeof choice;
         
     | 
| 
       695 
722 
     | 
    
         
             
            declare const output_object: typeof object;
         
     | 
| 
       696 
723 
     | 
    
         
             
            declare const output_text: typeof text;
         
     | 
| 
       697 
724 
     | 
    
         
             
            declare namespace output {
         
     | 
| 
       698 
725 
     | 
    
         
             
              export {
         
     | 
| 
       699 
726 
     | 
    
         
             
                output_Output as Output,
         
     | 
| 
       700 
727 
     | 
    
         
             
                output_array as array,
         
     | 
| 
      
 728 
     | 
    
         
            +
                output_choice as choice,
         
     | 
| 
       701 
729 
     | 
    
         
             
                output_object as object,
         
     | 
| 
       702 
730 
     | 
    
         
             
                output_text as text,
         
     | 
| 
       703 
731 
     | 
    
         
             
              };
         
     | 
| 
         @@ -1071,7 +1099,7 @@ If set and supported by the model, calls will generate deterministic results. 
     | 
|
| 
       1071 
1099 
     | 
    
         
             
            @returns
         
     | 
| 
       1072 
1100 
     | 
    
         
             
            A result object that contains the generated text, the results of the tool calls, and additional information.
         
     | 
| 
       1073 
1101 
     | 
    
         
             
             */
         
     | 
| 
       1074 
     | 
    
         
            -
            declare function generateText<TOOLS extends ToolSet, OUTPUT = never,  
     | 
| 
      
 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 & {
         
     | 
| 
       1075 
1103 
     | 
    
         
             
                /**
         
     | 
| 
       1076 
1104 
     | 
    
         
             
            The language model to use.
         
     | 
| 
       1077 
1105 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -1113,7 +1141,13 @@ changing the tool call and result types in the result. 
     | 
|
| 
       1113 
1141 
     | 
    
         
             
                /**
         
     | 
| 
       1114 
1142 
     | 
    
         
             
            Optional specification for parsing structured outputs from the LLM response.
         
     | 
| 
       1115 
1143 
     | 
    
         
             
                 */
         
     | 
| 
       1116 
     | 
    
         
            -
                 
     | 
| 
      
 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>;
         
     | 
| 
       1117 
1151 
     | 
    
         
             
                /**
         
     | 
| 
       1118 
1152 
     | 
    
         
             
            Custom download function to use for URLs.
         
     | 
| 
       1119 
1153 
     | 
    
         | 
| 
         @@ -1311,7 +1345,7 @@ If set and supported by the model, calls will generate deterministic results. 
     | 
|
| 
       1311 
1345 
     | 
    
         
             
            @return
         
     | 
| 
       1312 
1346 
     | 
    
         
             
            A result object for accessing different stream types and additional information.
         
     | 
| 
       1313 
1347 
     | 
    
         
             
             */
         
     | 
| 
       1314 
     | 
    
         
            -
            declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output 
     | 
| 
      
 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 & {
         
     | 
| 
       1315 
1349 
     | 
    
         
             
                /**
         
     | 
| 
       1316 
1350 
     | 
    
         
             
            The language model to use.
         
     | 
| 
       1317 
1351 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -1353,6 +1387,12 @@ functionality that can be fully encapsulated in the provider. 
     | 
|
| 
       1353 
1387 
     | 
    
         
             
                /**
         
     | 
| 
       1354 
1388 
     | 
    
         
             
            Optional specification for parsing structured outputs from the LLM response.
         
     | 
| 
       1355 
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 
     | 
    
         
            +
             */
         
     | 
| 
       1356 
1396 
     | 
    
         
             
                experimental_output?: Output<OUTPUT, PARTIAL_OUTPUT>;
         
     | 
| 
       1357 
1397 
     | 
    
         
             
                /**
         
     | 
| 
       1358 
1398 
     | 
    
         
             
            Optional function that you can use to provide different settings for a step.
         
     | 
| 
         @@ -2280,10 +2320,16 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> { 
     | 
|
| 
       2280 
2320 
     | 
    
         
             
                   */
         
     | 
| 
       2281 
2321 
     | 
    
         
             
                readonly fullStream: AsyncIterableStream<TextStreamPart<TOOLS>>;
         
     | 
| 
       2282 
2322 
     | 
    
         
             
                /**
         
     | 
| 
       2283 
     | 
    
         
            -
             
     | 
| 
      
 2323 
     | 
    
         
            +
                 * A stream of partial outputs. It uses the `output` specification.
         
     | 
| 
      
 2324 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2325 
     | 
    
         
            +
                 * @deprecated Use `partialOutputStream` instead.
         
     | 
| 
       2284 
2326 
     | 
    
         
             
                 */
         
     | 
| 
       2285 
2327 
     | 
    
         
             
                readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
         
     | 
| 
       2286 
2328 
     | 
    
         
             
                /**
         
     | 
| 
      
 2329 
     | 
    
         
            +
                 * A stream of partial outputs. It uses the `output` specification.
         
     | 
| 
      
 2330 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2331 
     | 
    
         
            +
                readonly partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
         
     | 
| 
      
 2332 
     | 
    
         
            +
                /**
         
     | 
| 
       2287 
2333 
     | 
    
         
             
              Consumes the stream without processing the parts.
         
     | 
| 
       2288 
2334 
     | 
    
         
             
              This is useful to force the stream to finish.
         
     | 
| 
       2289 
2335 
     | 
    
         
             
              It effectively removes the backpressure and allows the stream to finish,
         
     | 
| 
         @@ -2532,9 +2578,9 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT 
     | 
|
| 
       2532 
2578 
     | 
    
         
             
                 */
         
     | 
| 
       2533 
2579 
     | 
    
         
             
                activeTools?: Array<keyof NoInfer<TOOLS>>;
         
     | 
| 
       2534 
2580 
     | 
    
         
             
                /**
         
     | 
| 
       2535 
     | 
    
         
            -
              Optional specification for  
     | 
| 
      
 2581 
     | 
    
         
            +
              Optional specification for generating structured outputs.
         
     | 
| 
       2536 
2582 
     | 
    
         
             
                 */
         
     | 
| 
       2537 
     | 
    
         
            -
                 
     | 
| 
      
 2583 
     | 
    
         
            +
                output?: OUTPUT;
         
     | 
| 
       2538 
2584 
     | 
    
         
             
                /**
         
     | 
| 
       2539 
2585 
     | 
    
         
             
              Optional function that you can use to provide different settings for a step.
         
     | 
| 
       2540 
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 ` 
     | 
| 
      
 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 
     | 
    
         
             
            /**
         
     | 
| 
         @@ -672,12 +679,14 @@ interface Output<OUTPUT = any, PARTIAL = any> { 
     | 
|
| 
       672 
679 
     | 
    
         
             
            }
         
     | 
| 
       673 
680 
     | 
    
         
             
            /**
         
     | 
| 
       674 
681 
     | 
    
         
             
             * Output specification for text generation.
         
     | 
| 
      
 682 
     | 
    
         
            +
             * This is the default output mode that generates plain text.
         
     | 
| 
       675 
683 
     | 
    
         
             
             *
         
     | 
| 
       676 
684 
     | 
    
         
             
             * @returns An output specification for generating text.
         
     | 
| 
       677 
685 
     | 
    
         
             
             */
         
     | 
| 
       678 
686 
     | 
    
         
             
            declare const text: () => Output<string, string>;
         
     | 
| 
       679 
687 
     | 
    
         
             
            /**
         
     | 
| 
       680 
688 
     | 
    
         
             
             * Output specification for typed object generation using schemas.
         
     | 
| 
      
 689 
     | 
    
         
            +
             * When the model generates a text response, it will return an object that matches the schema.
         
     | 
| 
       681 
690 
     | 
    
         
             
             *
         
     | 
| 
       682 
691 
     | 
    
         
             
             * @param schema - The schema of the object to generate.
         
     | 
| 
       683 
692 
     | 
    
         
             
             *
         
     | 
| 
         @@ -686,18 +695,37 @@ declare const text: () => Output<string, string>; 
     | 
|
| 
       686 
695 
     | 
    
         
             
            declare const object: <OUTPUT>({ schema: inputSchema, }: {
         
     | 
| 
       687 
696 
     | 
    
         
             
                schema: FlexibleSchema<OUTPUT>;
         
     | 
| 
       688 
697 
     | 
    
         
             
            }) => Output<OUTPUT, DeepPartial<OUTPUT>>;
         
     | 
| 
      
 698 
     | 
    
         
            +
            /**
         
     | 
| 
      
 699 
     | 
    
         
            +
             * Array output specification for text generation.
         
     | 
| 
      
 700 
     | 
    
         
            +
             * When the model generates a text response, it will return an array of elements.
         
     | 
| 
      
 701 
     | 
    
         
            +
             *
         
     | 
| 
      
 702 
     | 
    
         
            +
             * @param element - The schema of the element to generate.
         
     | 
| 
      
 703 
     | 
    
         
            +
             * @returns An output specification for generating an array of elements.
         
     | 
| 
      
 704 
     | 
    
         
            +
             */
         
     | 
| 
       689 
705 
     | 
    
         
             
            declare const array: <ELEMENT>({ element: inputElementSchema, }: {
         
     | 
| 
       690 
706 
     | 
    
         
             
                element: FlexibleSchema<ELEMENT>;
         
     | 
| 
       691 
707 
     | 
    
         
             
            }) => Output<Array<ELEMENT>, Array<ELEMENT>>;
         
     | 
| 
      
 708 
     | 
    
         
            +
            /**
         
     | 
| 
      
 709 
     | 
    
         
            +
             * Choice output specification for text generation.
         
     | 
| 
      
 710 
     | 
    
         
            +
             * When the model generates a text response, it will return a one of the choice options.
         
     | 
| 
      
 711 
     | 
    
         
            +
             *
         
     | 
| 
      
 712 
     | 
    
         
            +
             * @param options - The options to choose from.
         
     | 
| 
      
 713 
     | 
    
         
            +
             * @returns An output specification for generating a choice.
         
     | 
| 
      
 714 
     | 
    
         
            +
             */
         
     | 
| 
      
 715 
     | 
    
         
            +
            declare const choice: <ELEMENT extends string>({ options: choiceOptions, }: {
         
     | 
| 
      
 716 
     | 
    
         
            +
                options: Array<ELEMENT>;
         
     | 
| 
      
 717 
     | 
    
         
            +
            }) => Output<ELEMENT, ELEMENT>;
         
     | 
| 
       692 
718 
     | 
    
         | 
| 
       693 
719 
     | 
    
         
             
            type output_Output<OUTPUT = any, PARTIAL = any> = Output<OUTPUT, PARTIAL>;
         
     | 
| 
       694 
720 
     | 
    
         
             
            declare const output_array: typeof array;
         
     | 
| 
      
 721 
     | 
    
         
            +
            declare const output_choice: typeof choice;
         
     | 
| 
       695 
722 
     | 
    
         
             
            declare const output_object: typeof object;
         
     | 
| 
       696 
723 
     | 
    
         
             
            declare const output_text: typeof text;
         
     | 
| 
       697 
724 
     | 
    
         
             
            declare namespace output {
         
     | 
| 
       698 
725 
     | 
    
         
             
              export {
         
     | 
| 
       699 
726 
     | 
    
         
             
                output_Output as Output,
         
     | 
| 
       700 
727 
     | 
    
         
             
                output_array as array,
         
     | 
| 
      
 728 
     | 
    
         
            +
                output_choice as choice,
         
     | 
| 
       701 
729 
     | 
    
         
             
                output_object as object,
         
     | 
| 
       702 
730 
     | 
    
         
             
                output_text as text,
         
     | 
| 
       703 
731 
     | 
    
         
             
              };
         
     | 
| 
         @@ -1071,7 +1099,7 @@ If set and supported by the model, calls will generate deterministic results. 
     | 
|
| 
       1071 
1099 
     | 
    
         
             
            @returns
         
     | 
| 
       1072 
1100 
     | 
    
         
             
            A result object that contains the generated text, the results of the tool calls, and additional information.
         
     | 
| 
       1073 
1101 
     | 
    
         
             
             */
         
     | 
| 
       1074 
     | 
    
         
            -
            declare function generateText<TOOLS extends ToolSet, OUTPUT = never,  
     | 
| 
      
 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 & {
         
     | 
| 
       1075 
1103 
     | 
    
         
             
                /**
         
     | 
| 
       1076 
1104 
     | 
    
         
             
            The language model to use.
         
     | 
| 
       1077 
1105 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -1113,7 +1141,13 @@ changing the tool call and result types in the result. 
     | 
|
| 
       1113 
1141 
     | 
    
         
             
                /**
         
     | 
| 
       1114 
1142 
     | 
    
         
             
            Optional specification for parsing structured outputs from the LLM response.
         
     | 
| 
       1115 
1143 
     | 
    
         
             
                 */
         
     | 
| 
       1116 
     | 
    
         
            -
                 
     | 
| 
      
 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>;
         
     | 
| 
       1117 
1151 
     | 
    
         
             
                /**
         
     | 
| 
       1118 
1152 
     | 
    
         
             
            Custom download function to use for URLs.
         
     | 
| 
       1119 
1153 
     | 
    
         | 
| 
         @@ -1311,7 +1345,7 @@ If set and supported by the model, calls will generate deterministic results. 
     | 
|
| 
       1311 
1345 
     | 
    
         
             
            @return
         
     | 
| 
       1312 
1346 
     | 
    
         
             
            A result object for accessing different stream types and additional information.
         
     | 
| 
       1313 
1347 
     | 
    
         
             
             */
         
     | 
| 
       1314 
     | 
    
         
            -
            declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output 
     | 
| 
      
 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 & {
         
     | 
| 
       1315 
1349 
     | 
    
         
             
                /**
         
     | 
| 
       1316 
1350 
     | 
    
         
             
            The language model to use.
         
     | 
| 
       1317 
1351 
     | 
    
         
             
                 */
         
     | 
| 
         @@ -1353,6 +1387,12 @@ functionality that can be fully encapsulated in the provider. 
     | 
|
| 
       1353 
1387 
     | 
    
         
             
                /**
         
     | 
| 
       1354 
1388 
     | 
    
         
             
            Optional specification for parsing structured outputs from the LLM response.
         
     | 
| 
       1355 
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 
     | 
    
         
            +
             */
         
     | 
| 
       1356 
1396 
     | 
    
         
             
                experimental_output?: Output<OUTPUT, PARTIAL_OUTPUT>;
         
     | 
| 
       1357 
1397 
     | 
    
         
             
                /**
         
     | 
| 
       1358 
1398 
     | 
    
         
             
            Optional function that you can use to provide different settings for a step.
         
     | 
| 
         @@ -2280,10 +2320,16 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> { 
     | 
|
| 
       2280 
2320 
     | 
    
         
             
                   */
         
     | 
| 
       2281 
2321 
     | 
    
         
             
                readonly fullStream: AsyncIterableStream<TextStreamPart<TOOLS>>;
         
     | 
| 
       2282 
2322 
     | 
    
         
             
                /**
         
     | 
| 
       2283 
     | 
    
         
            -
             
     | 
| 
      
 2323 
     | 
    
         
            +
                 * A stream of partial outputs. It uses the `output` specification.
         
     | 
| 
      
 2324 
     | 
    
         
            +
                 *
         
     | 
| 
      
 2325 
     | 
    
         
            +
                 * @deprecated Use `partialOutputStream` instead.
         
     | 
| 
       2284 
2326 
     | 
    
         
             
                 */
         
     | 
| 
       2285 
2327 
     | 
    
         
             
                readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
         
     | 
| 
       2286 
2328 
     | 
    
         
             
                /**
         
     | 
| 
      
 2329 
     | 
    
         
            +
                 * A stream of partial outputs. It uses the `output` specification.
         
     | 
| 
      
 2330 
     | 
    
         
            +
                 */
         
     | 
| 
      
 2331 
     | 
    
         
            +
                readonly partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
         
     | 
| 
      
 2332 
     | 
    
         
            +
                /**
         
     | 
| 
       2287 
2333 
     | 
    
         
             
              Consumes the stream without processing the parts.
         
     | 
| 
       2288 
2334 
     | 
    
         
             
              This is useful to force the stream to finish.
         
     | 
| 
       2289 
2335 
     | 
    
         
             
              It effectively removes the backpressure and allows the stream to finish,
         
     | 
| 
         @@ -2532,9 +2578,9 @@ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUT 
     | 
|
| 
       2532 
2578 
     | 
    
         
             
                 */
         
     | 
| 
       2533 
2579 
     | 
    
         
             
                activeTools?: Array<keyof NoInfer<TOOLS>>;
         
     | 
| 
       2534 
2580 
     | 
    
         
             
                /**
         
     | 
| 
       2535 
     | 
    
         
            -
              Optional specification for  
     | 
| 
      
 2581 
     | 
    
         
            +
              Optional specification for generating structured outputs.
         
     | 
| 
       2536 
2582 
     | 
    
         
             
                 */
         
     | 
| 
       2537 
     | 
    
         
            -
                 
     | 
| 
      
 2583 
     | 
    
         
            +
                output?: OUTPUT;
         
     | 
| 
       2538 
2584 
     | 
    
         
             
                /**
         
     | 
| 
       2539 
2585 
     | 
    
         
             
              Optional function that you can use to provide different settings for a step.
         
     | 
| 
       2540 
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. 
     | 
| 
      
 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 
     | 
| 
      
 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 
     | 
| 
      
 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 
     | 
    
         
             
                }
         
     | 
| 
         @@ -9120,6 +9128,7 @@ var DefaultSpeechResult = class { 
     | 
|
| 
       9120 
9128 
     | 
    
         
             
            var output_exports = {};
         
     | 
| 
       9121 
9129 
     | 
    
         
             
            __export(output_exports, {
         
     | 
| 
       9122 
9130 
     | 
    
         
             
              array: () => array,
         
     | 
| 
      
 9131 
     | 
    
         
            +
              choice: () => choice,
         
     | 
| 
       9123 
9132 
     | 
    
         
             
              object: () => object,
         
     | 
| 
       9124 
9133 
     | 
    
         
             
              text: () => text
         
     | 
| 
       9125 
9134 
     | 
    
         
             
            });
         
     | 
| 
         @@ -9201,7 +9210,7 @@ var array = ({ 
     | 
|
| 
       9201 
9210 
     | 
    
         
             
              const elementSchema = (0, import_provider_utils29.asSchema)(inputElementSchema);
         
     | 
| 
       9202 
9211 
     | 
    
         
             
              return {
         
     | 
| 
       9203 
9212 
     | 
    
         
             
                type: "object",
         
     | 
| 
       9204 
     | 
    
         
            -
                //  
     | 
| 
      
 9213 
     | 
    
         
            +
                // JSON schema that describes an array of elements:
         
     | 
| 
       9205 
9214 
     | 
    
         
             
                responseFormat: (0, import_provider_utils29.resolve)(elementSchema.jsonSchema).then((jsonSchema3) => {
         
     | 
| 
       9206 
9215 
     | 
    
         
             
                  const { $schema, ...itemSchema } = jsonSchema3;
         
     | 
| 
       9207 
9216 
     | 
    
         
             
                  return {
         
     | 
| 
         @@ -9295,6 +9304,82 @@ var array = ({ 
     | 
|
| 
       9295 
9304 
     | 
    
         
             
                }
         
     | 
| 
       9296 
9305 
     | 
    
         
             
              };
         
     | 
| 
       9297 
9306 
     | 
    
         
             
            };
         
     | 
| 
      
 9307 
     | 
    
         
            +
            var choice = ({
         
     | 
| 
      
 9308 
     | 
    
         
            +
              options: choiceOptions
         
     | 
| 
      
 9309 
     | 
    
         
            +
            }) => {
         
     | 
| 
      
 9310 
     | 
    
         
            +
              return {
         
     | 
| 
      
 9311 
     | 
    
         
            +
                type: "object",
         
     | 
| 
      
 9312 
     | 
    
         
            +
                // JSON schema that describes an enumeration:
         
     | 
| 
      
 9313 
     | 
    
         
            +
                responseFormat: Promise.resolve({
         
     | 
| 
      
 9314 
     | 
    
         
            +
                  type: "json",
         
     | 
| 
      
 9315 
     | 
    
         
            +
                  schema: {
         
     | 
| 
      
 9316 
     | 
    
         
            +
                    $schema: "http://json-schema.org/draft-07/schema#",
         
     | 
| 
      
 9317 
     | 
    
         
            +
                    type: "object",
         
     | 
| 
      
 9318 
     | 
    
         
            +
                    properties: {
         
     | 
| 
      
 9319 
     | 
    
         
            +
                      result: { type: "string", enum: choiceOptions }
         
     | 
| 
      
 9320 
     | 
    
         
            +
                    },
         
     | 
| 
      
 9321 
     | 
    
         
            +
                    required: ["result"],
         
     | 
| 
      
 9322 
     | 
    
         
            +
                    additionalProperties: false
         
     | 
| 
      
 9323 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9324 
     | 
    
         
            +
                }),
         
     | 
| 
      
 9325 
     | 
    
         
            +
                async parseOutput({ text: text2 }, context) {
         
     | 
| 
      
 9326 
     | 
    
         
            +
                  const parseResult = await (0, import_provider_utils29.safeParseJSON)({ text: text2 });
         
     | 
| 
      
 9327 
     | 
    
         
            +
                  if (!parseResult.success) {
         
     | 
| 
      
 9328 
     | 
    
         
            +
                    throw new NoObjectGeneratedError({
         
     | 
| 
      
 9329 
     | 
    
         
            +
                      message: "No object generated: could not parse the response.",
         
     | 
| 
      
 9330 
     | 
    
         
            +
                      cause: parseResult.error,
         
     | 
| 
      
 9331 
     | 
    
         
            +
                      text: text2,
         
     | 
| 
      
 9332 
     | 
    
         
            +
                      response: context.response,
         
     | 
| 
      
 9333 
     | 
    
         
            +
                      usage: context.usage,
         
     | 
| 
      
 9334 
     | 
    
         
            +
                      finishReason: context.finishReason
         
     | 
| 
      
 9335 
     | 
    
         
            +
                    });
         
     | 
| 
      
 9336 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9337 
     | 
    
         
            +
                  const outerValue = parseResult.value;
         
     | 
| 
      
 9338 
     | 
    
         
            +
                  if (outerValue == null || typeof outerValue !== "object" || !("result" in outerValue) || typeof outerValue.result !== "string" || !choiceOptions.includes(outerValue.result)) {
         
     | 
| 
      
 9339 
     | 
    
         
            +
                    throw new NoObjectGeneratedError({
         
     | 
| 
      
 9340 
     | 
    
         
            +
                      message: "No object generated: response did not match schema.",
         
     | 
| 
      
 9341 
     | 
    
         
            +
                      cause: new import_provider28.TypeValidationError({
         
     | 
| 
      
 9342 
     | 
    
         
            +
                        value: outerValue,
         
     | 
| 
      
 9343 
     | 
    
         
            +
                        cause: "response must be an object that contains a choice value."
         
     | 
| 
      
 9344 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 9345 
     | 
    
         
            +
                      text: text2,
         
     | 
| 
      
 9346 
     | 
    
         
            +
                      response: context.response,
         
     | 
| 
      
 9347 
     | 
    
         
            +
                      usage: context.usage,
         
     | 
| 
      
 9348 
     | 
    
         
            +
                      finishReason: context.finishReason
         
     | 
| 
      
 9349 
     | 
    
         
            +
                    });
         
     | 
| 
      
 9350 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9351 
     | 
    
         
            +
                  return outerValue.result;
         
     | 
| 
      
 9352 
     | 
    
         
            +
                },
         
     | 
| 
      
 9353 
     | 
    
         
            +
                async parsePartial({ text: text2 }) {
         
     | 
| 
      
 9354 
     | 
    
         
            +
                  const result = await parsePartialJson(text2);
         
     | 
| 
      
 9355 
     | 
    
         
            +
                  switch (result.state) {
         
     | 
| 
      
 9356 
     | 
    
         
            +
                    case "failed-parse":
         
     | 
| 
      
 9357 
     | 
    
         
            +
                    case "undefined-input": {
         
     | 
| 
      
 9358 
     | 
    
         
            +
                      return void 0;
         
     | 
| 
      
 9359 
     | 
    
         
            +
                    }
         
     | 
| 
      
 9360 
     | 
    
         
            +
                    case "repaired-parse":
         
     | 
| 
      
 9361 
     | 
    
         
            +
                    case "successful-parse": {
         
     | 
| 
      
 9362 
     | 
    
         
            +
                      const outerValue = result.value;
         
     | 
| 
      
 9363 
     | 
    
         
            +
                      if (outerValue == null || typeof outerValue !== "object" || !("result" in outerValue) || typeof outerValue.result !== "string") {
         
     | 
| 
      
 9364 
     | 
    
         
            +
                        return void 0;
         
     | 
| 
      
 9365 
     | 
    
         
            +
                      }
         
     | 
| 
      
 9366 
     | 
    
         
            +
                      const potentialMatches = choiceOptions.filter(
         
     | 
| 
      
 9367 
     | 
    
         
            +
                        (choiceOption) => choiceOption.startsWith(outerValue.result)
         
     | 
| 
      
 9368 
     | 
    
         
            +
                      );
         
     | 
| 
      
 9369 
     | 
    
         
            +
                      if (result.state === "successful-parse") {
         
     | 
| 
      
 9370 
     | 
    
         
            +
                        return potentialMatches.includes(outerValue.result) ? { partial: outerValue.result } : void 0;
         
     | 
| 
      
 9371 
     | 
    
         
            +
                      } else {
         
     | 
| 
      
 9372 
     | 
    
         
            +
                        return potentialMatches.length === 1 ? { partial: potentialMatches[0] } : void 0;
         
     | 
| 
      
 9373 
     | 
    
         
            +
                      }
         
     | 
| 
      
 9374 
     | 
    
         
            +
                    }
         
     | 
| 
      
 9375 
     | 
    
         
            +
                    default: {
         
     | 
| 
      
 9376 
     | 
    
         
            +
                      const _exhaustiveCheck = result.state;
         
     | 
| 
      
 9377 
     | 
    
         
            +
                      throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);
         
     | 
| 
      
 9378 
     | 
    
         
            +
                    }
         
     | 
| 
      
 9379 
     | 
    
         
            +
                  }
         
     | 
| 
      
 9380 
     | 
    
         
            +
                }
         
     | 
| 
      
 9381 
     | 
    
         
            +
              };
         
     | 
| 
      
 9382 
     | 
    
         
            +
            };
         
     | 
| 
       9298 
9383 
     | 
    
         | 
| 
       9299 
9384 
     | 
    
         
             
            // src/generate-text/prune-messages.ts
         
     | 
| 
       9300 
9385 
     | 
    
         
             
            function pruneMessages({
         
     |