ai 5.0.0-alpha.2 → 5.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.0-alpha.4
4
+
5
+ ### Major Changes
6
+
7
+ - 72d7d72: chore (ai): stable activeTools
8
+ - 9315076: chore (ai): rename continueUntil to stopWhen. Rename maxSteps stop condition to stepCountIs.
9
+
10
+ ### Patch Changes
11
+
12
+ - b32c141: feat (ai): add array support to stopWhen
13
+ - 7d97ab6: release alpha.4
14
+ - 37a916d: feat (ai): add prepareSteps to streamText
15
+ - 5f2b3d4: chore (ai): stable prepareStep
16
+ - Updated dependencies [dc714f3]
17
+ - @ai-sdk/provider@2.0.0-alpha.4
18
+ - @ai-sdk/provider-utils@3.0.0-alpha.4
19
+
20
+ ## 5.0.0-alpha.3
21
+
22
+ ### Major Changes
23
+
24
+ - ab7ccef: chore (ai): change source ui message parts to source-url
25
+ - 257224b: chore (ai): separate TextStreamChatTransport
26
+ - 0463011: fix (ai): update source url stream part
27
+ - d306260: feat (ai): replace maxSteps with continueUntil (streamText)
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [6b98118]
32
+ - @ai-sdk/provider@2.0.0-alpha.3
33
+ - @ai-sdk/provider-utils@3.0.0-alpha.3
34
+
3
35
  ## 5.0.0-alpha.2
4
36
 
5
37
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2154,7 +2154,7 @@ interface UIMessage<METADATA = unknown, DATA_PARTS extends UIDataTypes = UIDataT
2154
2154
  */
2155
2155
  parts: Array<UIMessagePart<DATA_PARTS>>;
2156
2156
  }
2157
- type UIMessagePart<DATA_TYPES extends UIDataTypes> = TextUIPart | ReasoningUIPart | ToolInvocationUIPart | SourceUIPart | FileUIPart | DataUIPart<DATA_TYPES> | StepStartUIPart;
2157
+ type UIMessagePart<DATA_TYPES extends UIDataTypes> = TextUIPart | ReasoningUIPart | ToolInvocationUIPart | SourceUrlUIPart | FileUIPart | DataUIPart<DATA_TYPES> | StepStartUIPart;
2158
2158
  type DataUIPart<DATA_TYPES extends UIDataTypes> = ValueOf<{
2159
2159
  [NAME in keyof DATA_TYPES & string]: {
2160
2160
  type: `data-${NAME}`;
@@ -2199,18 +2199,12 @@ type ToolInvocationUIPart = {
2199
2199
  /**
2200
2200
  * A source part of a message.
2201
2201
  */
2202
- type SourceUIPart = {
2203
- type: 'source';
2204
- /**
2205
- * The source.
2206
- */
2207
- source: {
2208
- sourceType: 'url';
2209
- id: string;
2210
- url: string;
2211
- title?: string;
2212
- providerMetadata?: Record<string, any>;
2213
- };
2202
+ type SourceUrlUIPart = {
2203
+ type: 'source-url';
2204
+ sourceId: string;
2205
+ url: string;
2206
+ title?: string;
2207
+ providerMetadata?: Record<string, any>;
2214
2208
  };
2215
2209
  /**
2216
2210
  * A file part of a message.
@@ -2702,7 +2696,7 @@ declare namespace output {
2702
2696
  type StopCondition<TOOLS extends ToolSet> = (options: {
2703
2697
  steps: Array<StepResult<TOOLS>>;
2704
2698
  }) => PromiseLike<boolean> | boolean;
2705
- declare function maxSteps(maxSteps: number): StopCondition<any>;
2699
+ declare function stepCountIs(stepCount: number): StopCondition<any>;
2706
2700
  declare function hasToolCall(toolName: string): StopCondition<any>;
2707
2701
 
2708
2702
  /**
@@ -2757,7 +2751,7 @@ If set and supported by the model, calls will generate deterministic results.
2757
2751
  @returns
2758
2752
  A result object that contains the generated text, the results of the tool calls, and additional information.
2759
2753
  */
2760
- declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, continueUntil, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools: activeTools, experimental_prepareStep: prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
2754
+ declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, 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, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
2761
2755
  /**
2762
2756
  The language model to use.
2763
2757
  */
@@ -2770,7 +2764,13 @@ The tools that the model can call. The model needs to support calling tools.
2770
2764
  The tool choice strategy. Default: 'auto'.
2771
2765
  */
2772
2766
  toolChoice?: ToolChoice<NoInfer<TOOLS>>;
2773
- continueUntil?: StopCondition<NoInfer<TOOLS>>;
2767
+ /**
2768
+ Condition for stopping the generation when there are tool results in the last step.
2769
+ When the condition is an array, any of the conditions can be met to stop the generation.
2770
+
2771
+ @default stepCountIs(1)
2772
+ */
2773
+ stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
2774
2774
  /**
2775
2775
  Optional telemetry configuration (experimental).
2776
2776
  */
@@ -2782,15 +2782,31 @@ functionality that can be fully encapsulated in the provider.
2782
2782
  */
2783
2783
  providerOptions?: ProviderOptions;
2784
2784
  /**
2785
+ * @deprecated Use `activeTools` instead.
2786
+ */
2787
+ experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
2788
+ /**
2785
2789
  Limits the tools that are available for the model to call without
2786
2790
  changing the tool call and result types in the result.
2787
2791
  */
2788
- experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
2792
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
2789
2793
  /**
2790
2794
  Optional specification for parsing structured outputs from the LLM response.
2791
2795
  */
2792
2796
  experimental_output?: Output$1<OUTPUT, OUTPUT_PARTIAL>;
2793
2797
  /**
2798
+ * @deprecated Use `prepareStep` instead.
2799
+ */
2800
+ experimental_prepareStep?: (options: {
2801
+ steps: Array<StepResult<NoInfer<TOOLS>>>;
2802
+ stepNumber: number;
2803
+ model: LanguageModel;
2804
+ }) => PromiseLike<{
2805
+ model?: LanguageModel;
2806
+ toolChoice?: ToolChoice<NoInfer<TOOLS>>;
2807
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
2808
+ } | undefined>;
2809
+ /**
2794
2810
  Optional function that you can use to provide different settings for a step.
2795
2811
 
2796
2812
  @param options - The options for the step.
@@ -2801,14 +2817,14 @@ Optional function that you can use to provide different settings for a step.
2801
2817
  @returns An object that contains the settings for the step.
2802
2818
  If you return undefined (or for undefined settings), the settings from the outer level will be used.
2803
2819
  */
2804
- experimental_prepareStep?: (options: {
2820
+ prepareStep?: (options: {
2805
2821
  steps: Array<StepResult<NoInfer<TOOLS>>>;
2806
2822
  stepNumber: number;
2807
2823
  model: LanguageModel;
2808
2824
  }) => PromiseLike<{
2809
2825
  model?: LanguageModel;
2810
2826
  toolChoice?: ToolChoice<NoInfer<TOOLS>>;
2811
- experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
2827
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
2812
2828
  } | undefined>;
2813
2829
  /**
2814
2830
  A function that attempts to repair a tool call that failed to parse.
@@ -3247,7 +3263,7 @@ If set and supported by the model, calls will generate deterministic results.
3247
3263
  @return
3248
3264
  A result object for accessing different stream types and additional information.
3249
3265
  */
3250
- declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
3266
+ 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_toolCallStreaming, toolCallStreaming, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
3251
3267
  /**
3252
3268
  The language model to use.
3253
3269
  */
@@ -3261,13 +3277,12 @@ The tool choice strategy. Default: 'auto'.
3261
3277
  */
3262
3278
  toolChoice?: ToolChoice<TOOLS>;
3263
3279
  /**
3264
- Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.
3265
-
3266
- A maximum number is required to prevent infinite loops in the case of misconfigured tools.
3280
+ Condition for stopping the generation when there are tool results in the last step.
3281
+ When the condition is an array, any of the conditions can be met to stop the generation.
3267
3282
 
3268
- By default, it's set to 1, which means that only a single LLM call is made.
3269
- */
3270
- maxSteps?: number;
3283
+ @default stepCountIs(1)
3284
+ */
3285
+ stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
3271
3286
  /**
3272
3287
  Optional telemetry configuration (experimental).
3273
3288
  */
@@ -3279,15 +3294,39 @@ functionality that can be fully encapsulated in the provider.
3279
3294
  */
3280
3295
  providerOptions?: ProviderOptions;
3281
3296
  /**
3282
- Limits the tools that are available for the model to call without
3283
- changing the tool call and result types in the result.
3297
+ * @deprecated Use `activeTools` instead.
3284
3298
  */
3285
- experimental_activeTools?: Array<keyof TOOLS>;
3299
+ experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
3300
+ /**
3301
+ Limits the tools that are available for the model to call without
3302
+ changing the tool call and result types in the result.
3303
+ */
3304
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
3286
3305
  /**
3287
3306
  Optional specification for parsing structured outputs from the LLM response.
3288
3307
  */
3289
3308
  experimental_output?: Output$1<OUTPUT, PARTIAL_OUTPUT>;
3290
3309
  /**
3310
+ Optional function that you can use to provide different settings for a step.
3311
+
3312
+ @param options - The options for the step.
3313
+ @param options.steps - The steps that have been executed so far.
3314
+ @param options.stepNumber - The number of the step that is being executed.
3315
+ @param options.model - The model that is being used.
3316
+
3317
+ @returns An object that contains the settings for the step.
3318
+ If you return undefined (or for undefined settings), the settings from the outer level will be used.
3319
+ */
3320
+ prepareStep?: (options: {
3321
+ steps: Array<StepResult<NoInfer<TOOLS>>>;
3322
+ stepNumber: number;
3323
+ model: LanguageModel;
3324
+ }) => PromiseLike<{
3325
+ model?: LanguageModel;
3326
+ toolChoice?: ToolChoice<NoInfer<TOOLS>>;
3327
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
3328
+ } | undefined>;
3329
+ /**
3291
3330
  A function that attempts to repair a tool call that failed to parse.
3292
3331
  */
3293
3332
  experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
@@ -4311,9 +4350,8 @@ type UIMessageStreamPart = {
4311
4350
  text: string;
4312
4351
  providerMetadata?: ProviderMetadata;
4313
4352
  } | {
4314
- type: 'source';
4315
- sourceType: 'url';
4316
- id: string;
4353
+ type: 'source-url';
4354
+ sourceId: string;
4317
4355
  url: string;
4318
4356
  title?: string;
4319
4357
  providerMetadata?: ProviderMetadata;
@@ -4400,10 +4438,9 @@ declare class DefaultChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTy
4400
4438
  private credentials?;
4401
4439
  private headers?;
4402
4440
  private body?;
4403
- private streamProtocol?;
4404
4441
  private fetch?;
4405
4442
  private prepareRequestBody?;
4406
- constructor({ api, credentials, headers, body, streamProtocol, fetch, prepareRequestBody, }: {
4443
+ constructor({ api, credentials, headers, body, fetch, prepareRequestBody, }: {
4407
4444
  api: string;
4408
4445
  /**
4409
4446
  * The credentials mode to be used for the fetch request.
@@ -4429,9 +4466,59 @@ declare class DefaultChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTy
4429
4466
  */
4430
4467
  body?: object;
4431
4468
  /**
4432
- Streaming protocol that is used. Defaults to `ui-message`.
4469
+ Custom fetch implementation. You can use it as a middleware to intercept requests,
4470
+ or to provide a custom fetch implementation for e.g. testing.
4471
+ */
4472
+ fetch?: FetchFunction;
4473
+ /**
4474
+ * When a function is provided, it will be used
4475
+ * to prepare the request body for the chat API. This can be useful for
4476
+ * customizing the request body based on the messages and data in the chat.
4477
+ *
4478
+ * @param id The id of the chat.
4479
+ * @param messages The current messages in the chat.
4480
+ * @param requestBody The request body object passed in the chat request.
4481
+ */
4482
+ prepareRequestBody?: (options: {
4483
+ chatId: string;
4484
+ messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[];
4485
+ requestBody?: object;
4486
+ }) => unknown;
4487
+ });
4488
+ submitMessages({ chatId, messages, abortController, body, headers, requestType, }: Parameters<ChatTransport<MESSAGE_METADATA, DATA_TYPES>['submitMessages']>[0]): Promise<ReadableStream<UIMessageStreamPart>>;
4489
+ }
4490
+ declare class TextStreamChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes> implements ChatTransport<MESSAGE_METADATA, DATA_TYPES> {
4491
+ private api;
4492
+ private credentials?;
4493
+ private headers?;
4494
+ private body?;
4495
+ private fetch?;
4496
+ private prepareRequestBody?;
4497
+ constructor({ api, credentials, headers, body, fetch, prepareRequestBody, }: {
4498
+ api: string;
4499
+ /**
4500
+ * The credentials mode to be used for the fetch request.
4501
+ * Possible values are: 'omit', 'same-origin', 'include'.
4502
+ * Defaults to 'same-origin'.
4503
+ */
4504
+ credentials?: RequestCredentials;
4505
+ /**
4506
+ * HTTP headers to be sent with the API request.
4433
4507
  */
4434
- streamProtocol?: 'ui-message' | 'text';
4508
+ headers?: Record<string, string> | Headers;
4509
+ /**
4510
+ * Extra body object to be sent with the API request.
4511
+ * @example
4512
+ * Send a `sessionId` to the API along with the messages.
4513
+ * ```js
4514
+ * useChat({
4515
+ * body: {
4516
+ * sessionId: '123',
4517
+ * }
4518
+ * })
4519
+ * ```
4520
+ */
4521
+ body?: object;
4435
4522
  /**
4436
4523
  Custom fetch implementation. You can use it as a middleware to intercept requests,
4437
4524
  or to provide a custom fetch implementation for e.g. testing.
@@ -4773,7 +4860,7 @@ declare function convertToModelMessages<TOOLS extends ToolSet = never>(messages:
4773
4860
  */
4774
4861
  declare const convertToCoreMessages: typeof convertToModelMessages;
4775
4862
 
4776
- declare function defaultChatStore<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas>({ api, fetch, streamProtocol, credentials, headers, body, prepareRequestBody, generateId, dataPartSchemas, messageMetadataSchema, maxSteps, chats, }: {
4863
+ declare function defaultChatStore<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas>({ api, fetch, credentials, headers, body, prepareRequestBody, generateId, dataPartSchemas, messageMetadataSchema, maxSteps, chats, }: {
4777
4864
  /**
4778
4865
  * Schema for the message metadata. Validates the message metadata.
4779
4866
  * Message metadata can be undefined or must match the schema.
@@ -4816,10 +4903,6 @@ declare function defaultChatStore<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends
4816
4903
  * ```
4817
4904
  */
4818
4905
  body?: object;
4819
- /**
4820
- Streaming protocol that is used. Defaults to `ui-message`.
4821
- */
4822
- streamProtocol?: 'ui-message' | 'text';
4823
4906
  /**
4824
4907
  Custom fetch implementation. You can use it as a middleware to intercept requests,
4825
4908
  or to provide a custom fetch implementation for e.g. testing.
@@ -4961,4 +5044,4 @@ type UseCompletionOptions = {
4961
5044
  fetch?: FetchFunction;
4962
5045
  };
4963
5046
 
4964
- export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, maxSteps, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
5047
+ export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
package/dist/index.d.ts CHANGED
@@ -2154,7 +2154,7 @@ interface UIMessage<METADATA = unknown, DATA_PARTS extends UIDataTypes = UIDataT
2154
2154
  */
2155
2155
  parts: Array<UIMessagePart<DATA_PARTS>>;
2156
2156
  }
2157
- type UIMessagePart<DATA_TYPES extends UIDataTypes> = TextUIPart | ReasoningUIPart | ToolInvocationUIPart | SourceUIPart | FileUIPart | DataUIPart<DATA_TYPES> | StepStartUIPart;
2157
+ type UIMessagePart<DATA_TYPES extends UIDataTypes> = TextUIPart | ReasoningUIPart | ToolInvocationUIPart | SourceUrlUIPart | FileUIPart | DataUIPart<DATA_TYPES> | StepStartUIPart;
2158
2158
  type DataUIPart<DATA_TYPES extends UIDataTypes> = ValueOf<{
2159
2159
  [NAME in keyof DATA_TYPES & string]: {
2160
2160
  type: `data-${NAME}`;
@@ -2199,18 +2199,12 @@ type ToolInvocationUIPart = {
2199
2199
  /**
2200
2200
  * A source part of a message.
2201
2201
  */
2202
- type SourceUIPart = {
2203
- type: 'source';
2204
- /**
2205
- * The source.
2206
- */
2207
- source: {
2208
- sourceType: 'url';
2209
- id: string;
2210
- url: string;
2211
- title?: string;
2212
- providerMetadata?: Record<string, any>;
2213
- };
2202
+ type SourceUrlUIPart = {
2203
+ type: 'source-url';
2204
+ sourceId: string;
2205
+ url: string;
2206
+ title?: string;
2207
+ providerMetadata?: Record<string, any>;
2214
2208
  };
2215
2209
  /**
2216
2210
  * A file part of a message.
@@ -2702,7 +2696,7 @@ declare namespace output {
2702
2696
  type StopCondition<TOOLS extends ToolSet> = (options: {
2703
2697
  steps: Array<StepResult<TOOLS>>;
2704
2698
  }) => PromiseLike<boolean> | boolean;
2705
- declare function maxSteps(maxSteps: number): StopCondition<any>;
2699
+ declare function stepCountIs(stepCount: number): StopCondition<any>;
2706
2700
  declare function hasToolCall(toolName: string): StopCondition<any>;
2707
2701
 
2708
2702
  /**
@@ -2757,7 +2751,7 @@ If set and supported by the model, calls will generate deterministic results.
2757
2751
  @returns
2758
2752
  A result object that contains the generated text, the results of the tool calls, and additional information.
2759
2753
  */
2760
- declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, continueUntil, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools: activeTools, experimental_prepareStep: prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
2754
+ declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, 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, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
2761
2755
  /**
2762
2756
  The language model to use.
2763
2757
  */
@@ -2770,7 +2764,13 @@ The tools that the model can call. The model needs to support calling tools.
2770
2764
  The tool choice strategy. Default: 'auto'.
2771
2765
  */
2772
2766
  toolChoice?: ToolChoice<NoInfer<TOOLS>>;
2773
- continueUntil?: StopCondition<NoInfer<TOOLS>>;
2767
+ /**
2768
+ Condition for stopping the generation when there are tool results in the last step.
2769
+ When the condition is an array, any of the conditions can be met to stop the generation.
2770
+
2771
+ @default stepCountIs(1)
2772
+ */
2773
+ stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
2774
2774
  /**
2775
2775
  Optional telemetry configuration (experimental).
2776
2776
  */
@@ -2782,15 +2782,31 @@ functionality that can be fully encapsulated in the provider.
2782
2782
  */
2783
2783
  providerOptions?: ProviderOptions;
2784
2784
  /**
2785
+ * @deprecated Use `activeTools` instead.
2786
+ */
2787
+ experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
2788
+ /**
2785
2789
  Limits the tools that are available for the model to call without
2786
2790
  changing the tool call and result types in the result.
2787
2791
  */
2788
- experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
2792
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
2789
2793
  /**
2790
2794
  Optional specification for parsing structured outputs from the LLM response.
2791
2795
  */
2792
2796
  experimental_output?: Output$1<OUTPUT, OUTPUT_PARTIAL>;
2793
2797
  /**
2798
+ * @deprecated Use `prepareStep` instead.
2799
+ */
2800
+ experimental_prepareStep?: (options: {
2801
+ steps: Array<StepResult<NoInfer<TOOLS>>>;
2802
+ stepNumber: number;
2803
+ model: LanguageModel;
2804
+ }) => PromiseLike<{
2805
+ model?: LanguageModel;
2806
+ toolChoice?: ToolChoice<NoInfer<TOOLS>>;
2807
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
2808
+ } | undefined>;
2809
+ /**
2794
2810
  Optional function that you can use to provide different settings for a step.
2795
2811
 
2796
2812
  @param options - The options for the step.
@@ -2801,14 +2817,14 @@ Optional function that you can use to provide different settings for a step.
2801
2817
  @returns An object that contains the settings for the step.
2802
2818
  If you return undefined (or for undefined settings), the settings from the outer level will be used.
2803
2819
  */
2804
- experimental_prepareStep?: (options: {
2820
+ prepareStep?: (options: {
2805
2821
  steps: Array<StepResult<NoInfer<TOOLS>>>;
2806
2822
  stepNumber: number;
2807
2823
  model: LanguageModel;
2808
2824
  }) => PromiseLike<{
2809
2825
  model?: LanguageModel;
2810
2826
  toolChoice?: ToolChoice<NoInfer<TOOLS>>;
2811
- experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
2827
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
2812
2828
  } | undefined>;
2813
2829
  /**
2814
2830
  A function that attempts to repair a tool call that failed to parse.
@@ -3247,7 +3263,7 @@ If set and supported by the model, calls will generate deterministic results.
3247
3263
  @return
3248
3264
  A result object for accessing different stream types and additional information.
3249
3265
  */
3250
- declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, maxSteps, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools: activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
3266
+ 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_toolCallStreaming, toolCallStreaming, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
3251
3267
  /**
3252
3268
  The language model to use.
3253
3269
  */
@@ -3261,13 +3277,12 @@ The tool choice strategy. Default: 'auto'.
3261
3277
  */
3262
3278
  toolChoice?: ToolChoice<TOOLS>;
3263
3279
  /**
3264
- Maximum number of sequential LLM calls (steps), e.g. when you use tool calls. Must be at least 1.
3265
-
3266
- A maximum number is required to prevent infinite loops in the case of misconfigured tools.
3280
+ Condition for stopping the generation when there are tool results in the last step.
3281
+ When the condition is an array, any of the conditions can be met to stop the generation.
3267
3282
 
3268
- By default, it's set to 1, which means that only a single LLM call is made.
3269
- */
3270
- maxSteps?: number;
3283
+ @default stepCountIs(1)
3284
+ */
3285
+ stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
3271
3286
  /**
3272
3287
  Optional telemetry configuration (experimental).
3273
3288
  */
@@ -3279,15 +3294,39 @@ functionality that can be fully encapsulated in the provider.
3279
3294
  */
3280
3295
  providerOptions?: ProviderOptions;
3281
3296
  /**
3282
- Limits the tools that are available for the model to call without
3283
- changing the tool call and result types in the result.
3297
+ * @deprecated Use `activeTools` instead.
3284
3298
  */
3285
- experimental_activeTools?: Array<keyof TOOLS>;
3299
+ experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
3300
+ /**
3301
+ Limits the tools that are available for the model to call without
3302
+ changing the tool call and result types in the result.
3303
+ */
3304
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
3286
3305
  /**
3287
3306
  Optional specification for parsing structured outputs from the LLM response.
3288
3307
  */
3289
3308
  experimental_output?: Output$1<OUTPUT, PARTIAL_OUTPUT>;
3290
3309
  /**
3310
+ Optional function that you can use to provide different settings for a step.
3311
+
3312
+ @param options - The options for the step.
3313
+ @param options.steps - The steps that have been executed so far.
3314
+ @param options.stepNumber - The number of the step that is being executed.
3315
+ @param options.model - The model that is being used.
3316
+
3317
+ @returns An object that contains the settings for the step.
3318
+ If you return undefined (or for undefined settings), the settings from the outer level will be used.
3319
+ */
3320
+ prepareStep?: (options: {
3321
+ steps: Array<StepResult<NoInfer<TOOLS>>>;
3322
+ stepNumber: number;
3323
+ model: LanguageModel;
3324
+ }) => PromiseLike<{
3325
+ model?: LanguageModel;
3326
+ toolChoice?: ToolChoice<NoInfer<TOOLS>>;
3327
+ activeTools?: Array<keyof NoInfer<TOOLS>>;
3328
+ } | undefined>;
3329
+ /**
3291
3330
  A function that attempts to repair a tool call that failed to parse.
3292
3331
  */
3293
3332
  experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
@@ -4311,9 +4350,8 @@ type UIMessageStreamPart = {
4311
4350
  text: string;
4312
4351
  providerMetadata?: ProviderMetadata;
4313
4352
  } | {
4314
- type: 'source';
4315
- sourceType: 'url';
4316
- id: string;
4353
+ type: 'source-url';
4354
+ sourceId: string;
4317
4355
  url: string;
4318
4356
  title?: string;
4319
4357
  providerMetadata?: ProviderMetadata;
@@ -4400,10 +4438,9 @@ declare class DefaultChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTy
4400
4438
  private credentials?;
4401
4439
  private headers?;
4402
4440
  private body?;
4403
- private streamProtocol?;
4404
4441
  private fetch?;
4405
4442
  private prepareRequestBody?;
4406
- constructor({ api, credentials, headers, body, streamProtocol, fetch, prepareRequestBody, }: {
4443
+ constructor({ api, credentials, headers, body, fetch, prepareRequestBody, }: {
4407
4444
  api: string;
4408
4445
  /**
4409
4446
  * The credentials mode to be used for the fetch request.
@@ -4429,9 +4466,59 @@ declare class DefaultChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTy
4429
4466
  */
4430
4467
  body?: object;
4431
4468
  /**
4432
- Streaming protocol that is used. Defaults to `ui-message`.
4469
+ Custom fetch implementation. You can use it as a middleware to intercept requests,
4470
+ or to provide a custom fetch implementation for e.g. testing.
4471
+ */
4472
+ fetch?: FetchFunction;
4473
+ /**
4474
+ * When a function is provided, it will be used
4475
+ * to prepare the request body for the chat API. This can be useful for
4476
+ * customizing the request body based on the messages and data in the chat.
4477
+ *
4478
+ * @param id The id of the chat.
4479
+ * @param messages The current messages in the chat.
4480
+ * @param requestBody The request body object passed in the chat request.
4481
+ */
4482
+ prepareRequestBody?: (options: {
4483
+ chatId: string;
4484
+ messages: UIMessage<MESSAGE_METADATA, DATA_TYPES>[];
4485
+ requestBody?: object;
4486
+ }) => unknown;
4487
+ });
4488
+ submitMessages({ chatId, messages, abortController, body, headers, requestType, }: Parameters<ChatTransport<MESSAGE_METADATA, DATA_TYPES>['submitMessages']>[0]): Promise<ReadableStream<UIMessageStreamPart>>;
4489
+ }
4490
+ declare class TextStreamChatTransport<MESSAGE_METADATA, DATA_TYPES extends UIDataTypes> implements ChatTransport<MESSAGE_METADATA, DATA_TYPES> {
4491
+ private api;
4492
+ private credentials?;
4493
+ private headers?;
4494
+ private body?;
4495
+ private fetch?;
4496
+ private prepareRequestBody?;
4497
+ constructor({ api, credentials, headers, body, fetch, prepareRequestBody, }: {
4498
+ api: string;
4499
+ /**
4500
+ * The credentials mode to be used for the fetch request.
4501
+ * Possible values are: 'omit', 'same-origin', 'include'.
4502
+ * Defaults to 'same-origin'.
4503
+ */
4504
+ credentials?: RequestCredentials;
4505
+ /**
4506
+ * HTTP headers to be sent with the API request.
4433
4507
  */
4434
- streamProtocol?: 'ui-message' | 'text';
4508
+ headers?: Record<string, string> | Headers;
4509
+ /**
4510
+ * Extra body object to be sent with the API request.
4511
+ * @example
4512
+ * Send a `sessionId` to the API along with the messages.
4513
+ * ```js
4514
+ * useChat({
4515
+ * body: {
4516
+ * sessionId: '123',
4517
+ * }
4518
+ * })
4519
+ * ```
4520
+ */
4521
+ body?: object;
4435
4522
  /**
4436
4523
  Custom fetch implementation. You can use it as a middleware to intercept requests,
4437
4524
  or to provide a custom fetch implementation for e.g. testing.
@@ -4773,7 +4860,7 @@ declare function convertToModelMessages<TOOLS extends ToolSet = never>(messages:
4773
4860
  */
4774
4861
  declare const convertToCoreMessages: typeof convertToModelMessages;
4775
4862
 
4776
- declare function defaultChatStore<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas>({ api, fetch, streamProtocol, credentials, headers, body, prepareRequestBody, generateId, dataPartSchemas, messageMetadataSchema, maxSteps, chats, }: {
4863
+ declare function defaultChatStore<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends UIDataPartSchemas>({ api, fetch, credentials, headers, body, prepareRequestBody, generateId, dataPartSchemas, messageMetadataSchema, maxSteps, chats, }: {
4777
4864
  /**
4778
4865
  * Schema for the message metadata. Validates the message metadata.
4779
4866
  * Message metadata can be undefined or must match the schema.
@@ -4816,10 +4903,6 @@ declare function defaultChatStore<MESSAGE_METADATA, UI_DATA_PART_SCHEMAS extends
4816
4903
  * ```
4817
4904
  */
4818
4905
  body?: object;
4819
- /**
4820
- Streaming protocol that is used. Defaults to `ui-message`.
4821
- */
4822
- streamProtocol?: 'ui-message' | 'text';
4823
4906
  /**
4824
4907
  Custom fetch implementation. You can use it as a middleware to intercept requests,
4825
4908
  or to provide a custom fetch implementation for e.g. testing.
@@ -4961,4 +5044,4 @@ type UseCompletionOptions = {
4961
5044
  fetch?: FetchFunction;
4962
5045
  };
4963
5046
 
4964
- export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, maxSteps, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
5047
+ export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };