ai 3.3.16 → 3.3.17

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schema, DeepPartial, Attachment, JSONValue as JSONValue$1, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
2
2
  export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, Schema, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, jsonSchema, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
3
- import { AttributeValue, Span } from '@opentelemetry/api';
4
- import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1ProviderMetadata, JSONValue, LanguageModelV1StreamPart, AISDKError } from '@ai-sdk/provider';
3
+ import { AttributeValue } from '@opentelemetry/api';
4
+ import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1ProviderMetadata, JSONValue, AISDKError } from '@ai-sdk/provider';
5
5
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, LoadAPIKeyError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
6
6
  import { z } from 'zod';
7
7
  import { ServerResponse } from 'http';
@@ -595,7 +595,7 @@ This function does not stream the output. If you want to stream the output, use
595
595
  @returns
596
596
  A result object that contains the generated object, the finish reason, the token usage, and additional information.
597
597
  */
598
- declare function generateObject<T>(options: Omit<CallSettings, 'stopSequences'> & Prompt & {
598
+ declare function generateObject<OBJECT>(options: Omit<CallSettings, 'stopSequences'> & Prompt & {
599
599
  output?: 'object' | undefined;
600
600
  /**
601
601
  The language model to use.
@@ -604,7 +604,7 @@ The language model to use.
604
604
  /**
605
605
  The schema of the object that the model should generate.
606
606
  */
607
- schema: z.Schema<T, z.ZodTypeDef, any> | Schema<T>;
607
+ schema: z.Schema<OBJECT, z.ZodTypeDef, any> | Schema<OBJECT>;
608
608
  /**
609
609
  Optional name of the output that should be generated.
610
610
  Used by some providers for additional LLM guidance, e.g.
@@ -635,7 +635,56 @@ Default and recommended: 'auto' (best mode for the model).
635
635
  Optional telemetry configuration (experimental).
636
636
  */
637
637
  experimental_telemetry?: TelemetrySettings;
638
- }): Promise<DefaultGenerateObjectResult<T>>;
638
+ }): Promise<GenerateObjectResult<OBJECT>>;
639
+ /**
640
+ Generate an array with structured, typed elements for a given prompt and element schema using a language model.
641
+
642
+ This function does not stream the output. If you want to stream the output, use `streamObject` instead.
643
+
644
+ @return
645
+ A result object that contains the generated object, the finish reason, the token usage, and additional information.
646
+ */
647
+ declare function generateObject<ELEMENT>(options: Omit<CallSettings, 'stopSequences'> & Prompt & {
648
+ output: 'array';
649
+ /**
650
+ The language model to use.
651
+ */
652
+ model: LanguageModel;
653
+ /**
654
+ The element schema of the array that the model should generate.
655
+ */
656
+ schema: z.Schema<ELEMENT, z.ZodTypeDef, any> | Schema<ELEMENT>;
657
+ /**
658
+ Optional name of the array that should be generated.
659
+ Used by some providers for additional LLM guidance, e.g.
660
+ via tool or schema name.
661
+ */
662
+ schemaName?: string;
663
+ /**
664
+ Optional description of the array that should be generated.
665
+ Used by some providers for additional LLM guidance, e.g.
666
+ via tool or schema description.
667
+ */
668
+ schemaDescription?: string;
669
+ /**
670
+ The mode to use for object generation.
671
+
672
+ The schema is converted in a JSON schema and used in one of the following ways
673
+
674
+ - 'auto': The provider will choose the best mode for the model.
675
+ - 'tool': A tool with the JSON schema as parameters is is provided and the provider is instructed to use it.
676
+ - 'json': The JSON schema and an instruction is injected into the prompt. If the provider supports JSON mode, it is enabled. If the provider supports JSON grammars, the grammar is used.
677
+
678
+ Please note that most providers do not support all modes.
679
+
680
+ Default and recommended: 'auto' (best mode for the model).
681
+ */
682
+ mode?: 'auto' | 'json' | 'tool';
683
+ /**
684
+ Optional telemetry configuration (experimental).
685
+ */
686
+ experimental_telemetry?: TelemetrySettings;
687
+ }): Promise<GenerateObjectResult<Array<ELEMENT>>>;
639
688
  /**
640
689
  Generate JSON with any schema for a given prompt using a language model.
641
690
 
@@ -658,26 +707,7 @@ The mode to use for object generation. Must be "json" for no-schema output.
658
707
  Optional telemetry configuration (experimental).
659
708
  */
660
709
  experimental_telemetry?: TelemetrySettings;
661
- }): Promise<DefaultGenerateObjectResult<JSONValue>>;
662
- declare class DefaultGenerateObjectResult<T> implements GenerateObjectResult<T> {
663
- readonly object: GenerateObjectResult<T>['object'];
664
- readonly finishReason: GenerateObjectResult<T>['finishReason'];
665
- readonly usage: GenerateObjectResult<T>['usage'];
666
- readonly warnings: GenerateObjectResult<T>['warnings'];
667
- readonly rawResponse: GenerateObjectResult<T>['rawResponse'];
668
- readonly logprobs: GenerateObjectResult<T>['logprobs'];
669
- readonly experimental_providerMetadata: GenerateObjectResult<T>['experimental_providerMetadata'];
670
- constructor(options: {
671
- object: GenerateObjectResult<T>['object'];
672
- finishReason: GenerateObjectResult<T>['finishReason'];
673
- usage: GenerateObjectResult<T>['usage'];
674
- warnings: GenerateObjectResult<T>['warnings'];
675
- rawResponse: GenerateObjectResult<T>['rawResponse'];
676
- logprobs: GenerateObjectResult<T>['logprobs'];
677
- providerMetadata: GenerateObjectResult<T>['experimental_providerMetadata'];
678
- });
679
- toJsonResponse(init?: ResponseInit): Response;
680
- }
710
+ }): Promise<GenerateObjectResult<JSONValue>>;
681
711
  /**
682
712
  * @deprecated Use `generateObject` instead.
683
713
  */
@@ -688,7 +718,7 @@ type AsyncIterableStream<T> = AsyncIterable<T> & ReadableStream<T>;
688
718
  /**
689
719
  The result of a `streamObject` call that contains the partial object stream and additional information.
690
720
  */
691
- interface StreamObjectResult<T> {
721
+ interface StreamObjectResult<PARTIAL, RESULT, ELEMENT_STREAM> {
692
722
  /**
693
723
  Warnings from the model provider (e.g. unsupported settings)
694
724
  */
@@ -715,14 +745,18 @@ interface StreamObjectResult<T> {
715
745
  /**
716
746
  The generated object (typed according to the schema). Resolved when the response is finished.
717
747
  */
718
- readonly object: Promise<T>;
748
+ readonly object: Promise<RESULT>;
719
749
  /**
720
750
  Stream of partial objects. It gets more complete as the stream progresses.
721
751
 
722
752
  Note that the partial object is not validated.
723
753
  If you want to be certain that the actual content matches your schema, you need to implement your own validation for partial results.
724
754
  */
725
- readonly partialObjectStream: AsyncIterableStream<DeepPartial<T>>;
755
+ readonly partialObjectStream: AsyncIterableStream<PARTIAL>;
756
+ /**
757
+ * Stream over complete array elements. Only available if the output strategy is set to `array`.
758
+ */
759
+ readonly elementStream: ELEMENT_STREAM;
726
760
  /**
727
761
  Text stream of the JSON representation of the generated object. It contains text chunks.
728
762
  When the stream is finished, the object is valid JSON that can be parsed.
@@ -732,7 +766,7 @@ interface StreamObjectResult<T> {
732
766
  Stream of different types of events, including partial objects, errors, and finish events.
733
767
  Only errors that stop the stream, such as network errors, are thrown.
734
768
  */
735
- readonly fullStream: AsyncIterableStream<ObjectStreamPart<T>>;
769
+ readonly fullStream: AsyncIterableStream<ObjectStreamPart<PARTIAL>>;
736
770
  /**
737
771
  Writes text delta output to a Node.js response-like object.
738
772
  It sets a `Content-Type` header to `text/plain; charset=utf-8` and
@@ -769,14 +803,47 @@ type ObjectStreamInputPart = {
769
803
  };
770
804
  providerMetadata?: ProviderMetadata;
771
805
  };
772
- type ObjectStreamPart<T> = ObjectStreamInputPart | {
806
+ type ObjectStreamPart<PARTIAL> = ObjectStreamInputPart | {
773
807
  type: 'object';
774
- object: DeepPartial<T>;
808
+ object: PARTIAL;
775
809
  } | {
776
810
  type: 'text-delta';
777
811
  textDelta: string;
778
812
  };
779
813
 
814
+ type OnFinishCallback<RESULT> = (event: {
815
+ /**
816
+ The token usage of the generated response.
817
+ */
818
+ usage: CompletionTokenUsage$1;
819
+ /**
820
+ The generated object. Can be undefined if the final object does not match the schema.
821
+ */
822
+ object: RESULT | undefined;
823
+ /**
824
+ Optional error object. This is e.g. a TypeValidationError when the final object does not match the schema.
825
+ */
826
+ error: unknown | undefined;
827
+ /**
828
+ Optional raw response data.
829
+ */
830
+ rawResponse?: {
831
+ /**
832
+ Response headers.
833
+ */
834
+ headers?: Record<string, string>;
835
+ };
836
+ /**
837
+ Warnings from the model provider (e.g. unsupported settings).
838
+ */
839
+ warnings?: CallWarning[];
840
+ /**
841
+ Additional provider-specific metadata. They are passed through
842
+ from the provider to the AI SDK and enable provider-specific
843
+ results that can be fully encapsulated in the provider.
844
+ */
845
+ experimental_providerMetadata: ProviderMetadata | undefined;
846
+ }) => Promise<void> | void;
780
847
  /**
781
848
  Generate a structured, typed object for a given prompt and schema using a language model.
782
849
 
@@ -785,7 +852,8 @@ This function streams the output. If you do not want to stream the output, use `
785
852
  @return
786
853
  A result object for accessing the partial object stream and additional information.
787
854
  */
788
- declare function streamObject<T>(options: Omit<CallSettings, 'stopSequences'> & Prompt & {
855
+ declare function streamObject<OBJECT>(options: Omit<CallSettings, 'stopSequences'> & Prompt & {
856
+ output?: 'object' | undefined;
789
857
  /**
790
858
  The language model to use.
791
859
  */
@@ -793,7 +861,7 @@ The language model to use.
793
861
  /**
794
862
  The schema of the object that the model should generate.
795
863
  */
796
- schema: z.Schema<T, z.ZodTypeDef, any> | Schema<T>;
864
+ schema: z.Schema<OBJECT, z.ZodTypeDef, any> | Schema<OBJECT>;
797
865
  /**
798
866
  Optional name of the output that should be generated.
799
867
  Used by some providers for additional LLM guidance, e.g.
@@ -827,40 +895,61 @@ Optional telemetry configuration (experimental).
827
895
  /**
828
896
  Callback that is called when the LLM response and the final object validation are finished.
829
897
  */
830
- onFinish?: (event: {
831
- /**
832
- The token usage of the generated response.
898
+ onFinish?: OnFinishCallback<OBJECT>;
899
+ }): Promise<StreamObjectResult<DeepPartial<OBJECT>, OBJECT, never>>;
900
+ /**
901
+ Generate an array with structured, typed elements for a given prompt and element schema using a language model.
902
+
903
+ This function streams the output. If you do not want to stream the output, use `generateObject` instead.
904
+
905
+ @return
906
+ A result object for accessing the partial object stream and additional information.
907
+ */
908
+ declare function streamObject<ELEMENT>(options: Omit<CallSettings, 'stopSequences'> & Prompt & {
909
+ output: 'array';
910
+ /**
911
+ The language model to use.
912
+ */
913
+ model: LanguageModel;
914
+ /**
915
+ The element schema of the array that the model should generate.
833
916
  */
834
- usage: CompletionTokenUsage$1;
835
- /**
836
- The generated object (typed according to the schema). Can be undefined if the final object does not match the schema.
917
+ schema: z.Schema<ELEMENT, z.ZodTypeDef, any> | Schema<ELEMENT>;
918
+ /**
919
+ Optional name of the array that should be generated.
920
+ Used by some providers for additional LLM guidance, e.g.
921
+ via tool or schema name.
837
922
  */
838
- object: T | undefined;
839
- /**
840
- Optional error object. This is e.g. a TypeValidationError when the final object does not match the schema.
923
+ schemaName?: string;
924
+ /**
925
+ Optional description of the array that should be generated.
926
+ Used by some providers for additional LLM guidance, e.g.
927
+ via tool or schema description.
928
+ */
929
+ schemaDescription?: string;
930
+ /**
931
+ The mode to use for object generation.
932
+
933
+ The schema is converted in a JSON schema and used in one of the following ways
934
+
935
+ - 'auto': The provider will choose the best mode for the model.
936
+ - 'tool': A tool with the JSON schema as parameters is is provided and the provider is instructed to use it.
937
+ - 'json': The JSON schema and an instruction is injected into the prompt. If the provider supports JSON mode, it is enabled. If the provider supports JSON grammars, the grammar is used.
938
+
939
+ Please note that most providers do not support all modes.
940
+
941
+ Default and recommended: 'auto' (best mode for the model).
841
942
  */
842
- error: unknown | undefined;
843
- /**
844
- Optional raw response data.
943
+ mode?: 'auto' | 'json' | 'tool';
944
+ /**
945
+ Optional telemetry configuration (experimental).
845
946
  */
846
- rawResponse?: {
847
- /**
848
- Response headers.
849
- */
850
- headers?: Record<string, string>;
851
- };
852
- /**
853
- Warnings from the model provider (e.g. unsupported settings).
854
- */
855
- warnings?: CallWarning[];
856
- /**
857
- Additional provider-specific metadata. They are passed through
858
- from the provider to the AI SDK and enable provider-specific
859
- results that can be fully encapsulated in the provider.
947
+ experimental_telemetry?: TelemetrySettings;
948
+ /**
949
+ Callback that is called when the LLM response and the final object validation are finished.
860
950
  */
861
- experimental_providerMetadata: ProviderMetadata | undefined;
862
- }) => Promise<void> | void;
863
- }): Promise<DefaultStreamObjectResult<T>>;
951
+ onFinish?: OnFinishCallback<Array<ELEMENT>>;
952
+ }): Promise<StreamObjectResult<Array<ELEMENT>, Array<ELEMENT>, AsyncIterableStream<ELEMENT>>>;
864
953
  /**
865
954
  Generate JSON with any schema for a given prompt using a language model.
866
955
 
@@ -886,82 +975,22 @@ Optional telemetry configuration (experimental).
886
975
  /**
887
976
  Callback that is called when the LLM response and the final object validation are finished.
888
977
  */
889
- onFinish?: (event: {
890
- /**
891
- The token usage of the generated response.
892
- */
893
- usage: CompletionTokenUsage$1;
894
- /**
895
- The generated object (typed according to the schema). Can be undefined if the final object does not match the schema.
896
- */
897
- object: JSONValue | undefined;
898
- /**
899
- Optional error object. This is e.g. a TypeValidationError when the final object does not match the schema.
900
- */
901
- error: unknown | undefined;
902
- /**
903
- Optional raw response data.
904
- */
905
- rawResponse?: {
906
- /**
907
- Response headers.
908
- */
909
- headers?: Record<string, string>;
910
- };
911
- /**
912
- Warnings from the model provider (e.g. unsupported settings).
913
- */
914
- warnings?: CallWarning[];
915
- /**
916
- Additional provider-specific metadata. They are passed through
917
- from the provider to the AI SDK and enable provider-specific
918
- results that can be fully encapsulated in the provider.
919
- */
920
- experimental_providerMetadata: ProviderMetadata | undefined;
921
- }) => Promise<void> | void;
922
- }): Promise<DefaultStreamObjectResult<JSONValue>>;
923
- declare class DefaultStreamObjectResult<T> implements StreamObjectResult<T> {
924
- private readonly originalStream;
925
- private readonly objectPromise;
926
- readonly warnings: StreamObjectResult<T>['warnings'];
927
- readonly usage: StreamObjectResult<T>['usage'];
928
- readonly experimental_providerMetadata: StreamObjectResult<T>['experimental_providerMetadata'];
929
- readonly rawResponse: StreamObjectResult<T>['rawResponse'];
930
- constructor({ stream, warnings, rawResponse, schema, onFinish, rootSpan, doStreamSpan, telemetry, startTimestamp, }: {
931
- stream: ReadableStream<string | Omit<LanguageModelV1StreamPart, 'text-delta'>>;
932
- warnings: StreamObjectResult<T>['warnings'];
933
- rawResponse?: StreamObjectResult<T>['rawResponse'];
934
- schema: z.Schema<T, z.ZodTypeDef, any> | Schema<T>;
935
- onFinish: Parameters<typeof streamObject<T>>[0]['onFinish'];
936
- rootSpan: Span;
937
- doStreamSpan: Span;
938
- telemetry: TelemetrySettings | undefined;
939
- startTimestamp: number;
940
- });
941
- get object(): Promise<T>;
942
- get partialObjectStream(): AsyncIterableStream<DeepPartial<T>>;
943
- get textStream(): AsyncIterableStream<string>;
944
- get fullStream(): AsyncIterableStream<ObjectStreamPart<T>>;
945
- pipeTextStreamToResponse(response: ServerResponse, init?: {
946
- headers?: Record<string, string>;
947
- status?: number;
948
- }): void;
949
- toTextStreamResponse(init?: ResponseInit): Response;
950
- }
978
+ onFinish?: OnFinishCallback<JSONValue>;
979
+ }): Promise<StreamObjectResult<JSONValue, JSONValue, never>>;
951
980
  /**
952
981
  * @deprecated Use `streamObject` instead.
953
982
  */
954
983
  declare const experimental_streamObject: typeof streamObject;
955
984
 
956
- type Parameters$1 = z.ZodTypeAny | Schema<any>;
957
- type inferParameters<PARAMETERS extends Parameters$1> = PARAMETERS extends Schema<any> ? PARAMETERS['_type'] : PARAMETERS extends z.ZodTypeAny ? z.infer<PARAMETERS> : never;
985
+ type Parameters = z.ZodTypeAny | Schema<any>;
986
+ type inferParameters<PARAMETERS extends Parameters> = PARAMETERS extends Schema<any> ? PARAMETERS['_type'] : PARAMETERS extends z.ZodTypeAny ? z.infer<PARAMETERS> : never;
958
987
  /**
959
988
  A tool contains the description and the schema of the input that the tool expects.
960
989
  This enables the language model to generate the input.
961
990
 
962
991
  The tool can also contain an optional execute function for the actual execution function of the tool.
963
992
  */
964
- interface CoreTool<PARAMETERS extends Parameters$1 = any, RESULT = any> {
993
+ interface CoreTool<PARAMETERS extends Parameters = any, RESULT = any> {
965
994
  /**
966
995
  An optional description of what the tool does. Will be used by the language model to decide whether to use the tool.
967
996
  */
@@ -981,12 +1010,12 @@ interface CoreTool<PARAMETERS extends Parameters$1 = any, RESULT = any> {
981
1010
  /**
982
1011
  Helper function for inferring the execute args of a tool.
983
1012
  */
984
- declare function tool<PARAMETERS extends Parameters$1, RESULT>(tool: CoreTool<PARAMETERS, RESULT> & {
1013
+ declare function tool<PARAMETERS extends Parameters, RESULT>(tool: CoreTool<PARAMETERS, RESULT> & {
985
1014
  execute: (args: inferParameters<PARAMETERS>) => PromiseLike<RESULT>;
986
1015
  }): CoreTool<PARAMETERS, RESULT> & {
987
1016
  execute: (args: inferParameters<PARAMETERS>) => PromiseLike<RESULT>;
988
1017
  };
989
- declare function tool<PARAMETERS extends Parameters$1, RESULT>(tool: CoreTool<PARAMETERS, RESULT> & {
1018
+ declare function tool<PARAMETERS extends Parameters, RESULT>(tool: CoreTool<PARAMETERS, RESULT> & {
990
1019
  execute?: undefined;
991
1020
  }): CoreTool<PARAMETERS, RESULT> & {
992
1021
  execute: undefined;
@@ -1421,6 +1450,7 @@ interface StreamTextResult<TOOLS extends Record<string, CoreTool>> {
1421
1450
  toDataStreamResponse(options?: ResponseInit | {
1422
1451
  init?: ResponseInit;
1423
1452
  data?: StreamData;
1453
+ getErrorMessage?: (error: unknown) => string;
1424
1454
  }): Response;
1425
1455
  /**
1426
1456
  Creates a simple text stream response.
@@ -1580,64 +1610,7 @@ Callback that is called when the LLM response and all request tool executions
1580
1610
  */
1581
1611
  readonly experimental_providerMetadata: ProviderMetadata | undefined;
1582
1612
  }) => Promise<void> | void;
1583
- }): Promise<DefaultStreamTextResult<TOOLS>>;
1584
- declare class DefaultStreamTextResult<TOOLS extends Record<string, CoreTool>> implements StreamTextResult<TOOLS> {
1585
- private originalStream;
1586
- readonly warnings: StreamTextResult<TOOLS>['warnings'];
1587
- readonly usage: StreamTextResult<TOOLS>['usage'];
1588
- readonly finishReason: StreamTextResult<TOOLS>['finishReason'];
1589
- readonly experimental_providerMetadata: StreamTextResult<TOOLS>['experimental_providerMetadata'];
1590
- readonly text: StreamTextResult<TOOLS>['text'];
1591
- readonly toolCalls: StreamTextResult<TOOLS>['toolCalls'];
1592
- readonly toolResults: StreamTextResult<TOOLS>['toolResults'];
1593
- readonly rawResponse: StreamTextResult<TOOLS>['rawResponse'];
1594
- constructor({ stream, warnings, rawResponse, onChunk, onFinish, rootSpan, doStreamSpan, telemetry, startTimestamp, }: {
1595
- stream: ReadableStream<TextStreamPart<TOOLS>>;
1596
- warnings: StreamTextResult<TOOLS>['warnings'];
1597
- rawResponse: StreamTextResult<TOOLS>['rawResponse'];
1598
- onChunk: Parameters<typeof streamText>[0]['onChunk'];
1599
- onFinish: Parameters<typeof streamText>[0]['onFinish'];
1600
- rootSpan: Span;
1601
- doStreamSpan: Span;
1602
- telemetry: TelemetrySettings | undefined;
1603
- startTimestamp: number;
1604
- });
1605
- /**
1606
- Split out a new stream from the original stream.
1607
- The original stream is replaced to allow for further splitting,
1608
- since we do not know how many times the stream will be split.
1609
-
1610
- Note: this leads to buffering the stream content on the server.
1611
- However, the LLM results are expected to be small enough to not cause issues.
1612
- */
1613
- private teeStream;
1614
- get textStream(): AsyncIterableStream<string>;
1615
- get fullStream(): AsyncIterableStream<TextStreamPart<TOOLS>>;
1616
- toAIStream(callbacks?: AIStreamCallbacksAndOptions): ReadableStream<Uint8Array>;
1617
- private toDataStream;
1618
- pipeAIStreamToResponse(response: ServerResponse$1, init?: {
1619
- headers?: Record<string, string>;
1620
- status?: number;
1621
- }): void;
1622
- pipeDataStreamToResponse(response: ServerResponse$1, init?: {
1623
- headers?: Record<string, string>;
1624
- status?: number;
1625
- }): void;
1626
- pipeTextStreamToResponse(response: ServerResponse$1, init?: {
1627
- headers?: Record<string, string>;
1628
- status?: number;
1629
- }): void;
1630
- toAIStreamResponse(options?: ResponseInit | {
1631
- init?: ResponseInit;
1632
- data?: StreamData;
1633
- }): Response;
1634
- toDataStreamResponse(options?: ResponseInit | {
1635
- init?: ResponseInit;
1636
- data?: StreamData;
1637
- getErrorMessage?: (error: unknown) => string;
1638
- }): Response;
1639
- toTextStreamResponse(init?: ResponseInit): Response;
1640
- }
1613
+ }): Promise<StreamTextResult<TOOLS>>;
1641
1614
  /**
1642
1615
  * @deprecated Use `streamText` instead.
1643
1616
  */