ai 5.0.55 → 5.1.0-beta.0

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,77 +1,17 @@
1
1
  # ai
2
2
 
3
- ## 5.0.55
3
+ ## 5.1.0-beta.0
4
4
 
5
- ### Patch Changes
6
-
7
- - 85da29e: fix(ai): remove outdated jsdoc param descriptions
8
-
9
- ## 5.0.54
10
-
11
- ### Patch Changes
12
-
13
- - bc5ed71: chore: update zod peer depenedency version
14
- - Updated dependencies [bc5ed71]
15
- - @ai-sdk/provider-utils@3.0.10
16
- - @ai-sdk/gateway@1.0.30
17
-
18
- ## 5.0.53
19
-
20
- ### Patch Changes
21
-
22
- - d335191: Extend addToolResult to support error results
23
-
24
- ## 5.0.52
25
-
26
- ### Patch Changes
27
-
28
- - c56822d: fix(ai): update `uiMessageChunkSchema` to satisfy the `UIMessageChunk` type
29
- - 930399b: fix(ai): download files when intermediate file cannot be downloaded
30
- - Updated dependencies [7ca78f1]
31
- - @ai-sdk/gateway@1.0.29
32
-
33
- ## 5.0.51
34
-
35
- ### Patch Changes
36
-
37
- - 27645bb: Export `parseJsonEventStream` and `uiMessageChunkSchema` from "ai" package
38
- - Updated dependencies [322901b]
39
- - @ai-sdk/gateway@1.0.28
40
-
41
- ## 5.0.50
42
-
43
- ### Patch Changes
44
-
45
- - Updated dependencies [c5f403a]
46
- - @ai-sdk/gateway@1.0.27
47
-
48
- ## 5.0.49
49
-
50
- ### Patch Changes
51
-
52
- - Updated dependencies [e304478]
53
- - @ai-sdk/gateway@1.0.26
54
-
55
- ## 5.0.48
56
-
57
- ### Patch Changes
58
-
59
- - Updated dependencies [4d3ff64]
60
- - @ai-sdk/gateway@1.0.25
61
-
62
- ## 5.0.47
63
-
64
- ### Patch Changes
65
-
66
- - Updated dependencies [c86e0f7]
67
- - Updated dependencies [6bbae01]
68
- - @ai-sdk/gateway@1.0.24
5
+ ### Minor Changes
69
6
 
70
- ## 5.0.46
7
+ - 78928cb: release: start 5.1 beta
71
8
 
72
9
  ### Patch Changes
73
10
 
74
- - c580fbd: Add safeValidateUIMessages utility to validate UI messages without throwing, returning a success/failure result object like Zod’s safeParse
11
+ - Updated dependencies [78928cb]
12
+ - @ai-sdk/gateway@1.1.0-beta.0
13
+ - @ai-sdk/provider@2.1.0-beta.0
14
+ - @ai-sdk/provider-utils@3.1.0-beta.0
75
15
 
76
16
  ## 5.0.45
77
17
 
package/dist/index.d.mts CHANGED
@@ -1,8 +1,7 @@
1
1
  export { createGateway, gateway } from '@ai-sdk/gateway';
2
2
  import { ModelMessage, Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, Schema, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, InferSchema, FlexibleSchema, DataContent, Validator, StandardSchemaV1, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
- export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
3
+ export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, tool, zodSchema } from '@ai-sdk/provider-utils';
4
4
  import { AttributeValue, Tracer } from '@opentelemetry/api';
5
- import * as _ai_sdk_provider from '@ai-sdk/provider';
6
5
  import { EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2CallWarning, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, SpeechModelV2CallWarning, TranscriptionModelV2, TranscriptionModelV2CallWarning, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, ProviderV2, NoSuchModelError, JSONObject } from '@ai-sdk/provider';
7
6
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
8
7
  import * as z3 from 'zod/v3';
@@ -1594,115 +1593,6 @@ type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
1594
1593
  dynamic: true;
1595
1594
  });
1596
1595
 
1597
- declare const uiMessageChunkSchema: z.ZodUnion<readonly [z.ZodObject<{
1598
- type: z.ZodLiteral<"text-start">;
1599
- id: z.ZodString;
1600
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1601
- }, z.core.$strict>, z.ZodObject<{
1602
- type: z.ZodLiteral<"text-delta">;
1603
- id: z.ZodString;
1604
- delta: z.ZodString;
1605
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1606
- }, z.core.$strict>, z.ZodObject<{
1607
- type: z.ZodLiteral<"text-end">;
1608
- id: z.ZodString;
1609
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1610
- }, z.core.$strict>, z.ZodObject<{
1611
- type: z.ZodLiteral<"error">;
1612
- errorText: z.ZodString;
1613
- }, z.core.$strict>, z.ZodObject<{
1614
- type: z.ZodLiteral<"tool-input-start">;
1615
- toolCallId: z.ZodString;
1616
- toolName: z.ZodString;
1617
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1618
- dynamic: z.ZodOptional<z.ZodBoolean>;
1619
- }, z.core.$strict>, z.ZodObject<{
1620
- type: z.ZodLiteral<"tool-input-delta">;
1621
- toolCallId: z.ZodString;
1622
- inputTextDelta: z.ZodString;
1623
- }, z.core.$strict>, z.ZodObject<{
1624
- type: z.ZodLiteral<"tool-input-available">;
1625
- toolCallId: z.ZodString;
1626
- toolName: z.ZodString;
1627
- input: z.ZodUnknown;
1628
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1629
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1630
- dynamic: z.ZodOptional<z.ZodBoolean>;
1631
- }, z.core.$strict>, z.ZodObject<{
1632
- type: z.ZodLiteral<"tool-input-error">;
1633
- toolCallId: z.ZodString;
1634
- toolName: z.ZodString;
1635
- input: z.ZodUnknown;
1636
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1637
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1638
- dynamic: z.ZodOptional<z.ZodBoolean>;
1639
- errorText: z.ZodString;
1640
- }, z.core.$strict>, z.ZodObject<{
1641
- type: z.ZodLiteral<"tool-output-available">;
1642
- toolCallId: z.ZodString;
1643
- output: z.ZodUnknown;
1644
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1645
- dynamic: z.ZodOptional<z.ZodBoolean>;
1646
- preliminary: z.ZodOptional<z.ZodBoolean>;
1647
- }, z.core.$strict>, z.ZodObject<{
1648
- type: z.ZodLiteral<"tool-output-error">;
1649
- toolCallId: z.ZodString;
1650
- errorText: z.ZodString;
1651
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1652
- dynamic: z.ZodOptional<z.ZodBoolean>;
1653
- }, z.core.$strict>, z.ZodObject<{
1654
- type: z.ZodLiteral<"reasoning-start">;
1655
- id: z.ZodString;
1656
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1657
- }, z.core.$strict>, z.ZodObject<{
1658
- type: z.ZodLiteral<"reasoning-delta">;
1659
- id: z.ZodString;
1660
- delta: z.ZodString;
1661
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1662
- }, z.core.$strict>, z.ZodObject<{
1663
- type: z.ZodLiteral<"reasoning-end">;
1664
- id: z.ZodString;
1665
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1666
- }, z.core.$strict>, z.ZodObject<{
1667
- type: z.ZodLiteral<"source-url">;
1668
- sourceId: z.ZodString;
1669
- url: z.ZodString;
1670
- title: z.ZodOptional<z.ZodString>;
1671
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1672
- }, z.core.$strict>, z.ZodObject<{
1673
- type: z.ZodLiteral<"source-document">;
1674
- sourceId: z.ZodString;
1675
- mediaType: z.ZodString;
1676
- title: z.ZodString;
1677
- filename: z.ZodOptional<z.ZodString>;
1678
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1679
- }, z.core.$strict>, z.ZodObject<{
1680
- type: z.ZodLiteral<"file">;
1681
- url: z.ZodString;
1682
- mediaType: z.ZodString;
1683
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1684
- }, z.core.$strict>, z.ZodObject<{
1685
- type: z.ZodCustom<`data-${string}`, `data-${string}`>;
1686
- id: z.ZodOptional<z.ZodString>;
1687
- data: z.ZodUnknown;
1688
- transient: z.ZodOptional<z.ZodBoolean>;
1689
- }, z.core.$strict>, z.ZodObject<{
1690
- type: z.ZodLiteral<"start-step">;
1691
- }, z.core.$strict>, z.ZodObject<{
1692
- type: z.ZodLiteral<"finish-step">;
1693
- }, z.core.$strict>, z.ZodObject<{
1694
- type: z.ZodLiteral<"start">;
1695
- messageId: z.ZodOptional<z.ZodString>;
1696
- messageMetadata: z.ZodOptional<z.ZodUnknown>;
1697
- }, z.core.$strict>, z.ZodObject<{
1698
- type: z.ZodLiteral<"finish">;
1699
- messageMetadata: z.ZodOptional<z.ZodUnknown>;
1700
- }, z.core.$strict>, z.ZodObject<{
1701
- type: z.ZodLiteral<"abort">;
1702
- }, z.core.$strict>, z.ZodObject<{
1703
- type: z.ZodLiteral<"message-metadata">;
1704
- messageMetadata: z.ZodUnknown;
1705
- }, z.core.$strict>]>;
1706
1596
  type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
1707
1597
  [NAME in keyof DATA_TYPES & string]: {
1708
1598
  type: `data-${NAME}`;
@@ -1797,7 +1687,6 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
1797
1687
  type: 'file';
1798
1688
  url: string;
1799
1689
  mediaType: string;
1800
- providerMetadata?: ProviderMetadata;
1801
1690
  } | DataUIMessageChunk<DATA_TYPES> | {
1802
1691
  type: 'start-step';
1803
1692
  } | {
@@ -2072,28 +1961,47 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2072
1961
  */
2073
1962
  consumeStream(options?: ConsumeStreamOptions): Promise<void>;
2074
1963
  /**
2075
- Converts the result to a UI message stream.
1964
+ Converts the result to a UI message stream.
1965
+
1966
+ @param options.getErrorMessage an optional function that converts an error to an error message.
1967
+ @param options.sendUsage whether to send the usage information to the client. Defaults to true.
1968
+ @param options.sendReasoning whether to send the reasoning information to the client. Defaults to false.
1969
+ @param options.sendSources whether to send the sources information to the client. Defaults to false.
1970
+ @param options.experimental_sendFinish whether to send the finish information to the client. Defaults to true.
1971
+ @param options.experimental_sendStart whether to send the start information to the client. Defaults to true.
2076
1972
 
2077
- @return A UI message stream.
1973
+ @return A UI message stream.
2078
1974
  */
2079
1975
  toUIMessageStream<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamOptions<UI_MESSAGE>): AsyncIterableStream<InferUIMessageChunk<UI_MESSAGE>>;
2080
1976
  /**
2081
- *Writes UI message stream output to a Node.js response-like object.
2082
- */
1977
+ Writes UI message stream output to a Node.js response-like object.
1978
+ @param response A Node.js response-like object (ServerResponse).
1979
+ @param options.status The status code.
1980
+ @param options.statusText The status text.
1981
+ @param options.headers The headers.
1982
+ @param options.getErrorMessage An optional function that converts an error to an error message.
1983
+ @param options.sendUsage Whether to send the usage information to the client. Defaults to true.
1984
+ @param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
1985
+ */
2083
1986
  pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): void;
2084
1987
  /**
2085
- Writes text delta output to a Node.js response-like object.
2086
- It sets a `Content-Type` header to `text/plain; charset=utf-8` and
2087
- writes each text delta as a separate chunk.
2088
-
2089
- @param response A Node.js response-like object (ServerResponse).
2090
- @param init Optional headers, status code, and status text.
1988
+ Writes text delta output to a Node.js response-like object.
1989
+ It sets a `Content-Type` header to `text/plain; charset=utf-8` and
1990
+ writes each text delta as a separate chunk.
1991
+ @param response A Node.js response-like object (ServerResponse).
1992
+ @param init Optional headers, status code, and status text.
2091
1993
  */
2092
1994
  pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): void;
2093
1995
  /**
2094
- Converts the result to a streamed response object with a stream data part stream.
1996
+ Converts the result to a streamed response object with a stream data part stream.
2095
1997
 
2096
- @return A response object.
1998
+ @param options.status The status code.
1999
+ @param options.statusText The status text.
2000
+ @param options.headers The headers.
2001
+ @param options.getErrorMessage An optional function that converts an error to an error message.
2002
+ @param options.sendUsage Whether to send the usage information to the client. Defaults to true.
2003
+ @param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
2004
+ @return A response object.
2097
2005
  */
2098
2006
  toUIMessageStreamResponse<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): Response;
2099
2007
  /**
@@ -4308,18 +4216,10 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
4308
4216
  * Clear the error state and set the status to ready if the chat is in an error state.
4309
4217
  */
4310
4218
  clearError: () => void;
4311
- addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
4312
- state?: "output-available";
4219
+ addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ tool, toolCallId, output, }: {
4313
4220
  tool: TOOL;
4314
4221
  toolCallId: string;
4315
4222
  output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
4316
- errorText?: never;
4317
- } | {
4318
- state: "output-error";
4319
- tool: TOOL;
4320
- toolCallId: string;
4321
- output?: never;
4322
- errorText: string;
4323
4223
  }) => Promise<void>;
4324
4224
  /**
4325
4225
  * Abort the current request immediately, keep the generated tokens if any.
@@ -4550,28 +4450,6 @@ type UseCompletionOptions = {
4550
4450
  fetch?: FetchFunction;
4551
4451
  };
4552
4452
 
4553
- type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
4554
- success: true;
4555
- data: Array<UI_MESSAGE>;
4556
- } | {
4557
- success: false;
4558
- error: Error;
4559
- };
4560
- /**
4561
- * Validates a list of UI messages like `validateUIMessages`,
4562
- * but instead of throwing it returns `{ success: true, data }`
4563
- * or `{ success: false, error }`.
4564
- */
4565
- declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
4566
- messages: unknown;
4567
- metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
4568
- dataSchemas?: {
4569
- [NAME in keyof InferUIMessageData<UI_MESSAGE> & string]?: Validator<InferUIMessageData<UI_MESSAGE>[NAME]> | StandardSchemaV1<unknown, InferUIMessageData<UI_MESSAGE>[NAME]>;
4570
- };
4571
- tools?: {
4572
- [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
4573
- };
4574
- }): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
4575
4453
  /**
4576
4454
  * Validates a list of UI messages.
4577
4455
  *
@@ -4610,4 +4488,4 @@ declare global {
4610
4488
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
4611
4489
  }
4612
4490
 
4613
- export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
4491
+ export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  export { createGateway, gateway } from '@ai-sdk/gateway';
2
2
  import { ModelMessage, Tool, InferToolInput, InferToolOutput, AssistantModelMessage, ToolModelMessage, ReasoningPart, Schema, SystemModelMessage, UserModelMessage, ProviderOptions, IdGenerator, ToolCall, InferSchema, FlexibleSchema, DataContent, Validator, StandardSchemaV1, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
- export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
3
+ export { AssistantContent, AssistantModelMessage, DataContent, FilePart, IdGenerator, ImagePart, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolCallOptions, ToolCallPart, ToolContent, ToolExecuteFunction, ToolModelMessage, ToolResultPart, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, generateId, jsonSchema, tool, zodSchema } from '@ai-sdk/provider-utils';
4
4
  import { AttributeValue, Tracer } from '@opentelemetry/api';
5
- import * as _ai_sdk_provider from '@ai-sdk/provider';
6
5
  import { EmbeddingModelV2, EmbeddingModelV2Embedding, ImageModelV2, ImageModelV2CallWarning, ImageModelV2ProviderMetadata, JSONValue as JSONValue$1, LanguageModelV2, LanguageModelV2FinishReason, LanguageModelV2CallWarning, LanguageModelV2Source, LanguageModelV2Middleware, SharedV2ProviderMetadata, SpeechModelV2, SpeechModelV2CallWarning, TranscriptionModelV2, TranscriptionModelV2CallWarning, LanguageModelV2Usage, LanguageModelV2CallOptions, AISDKError, LanguageModelV2ToolCall, JSONSchema7, JSONParseError, TypeValidationError, ProviderV2, NoSuchModelError, JSONObject } from '@ai-sdk/provider';
7
6
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, NoContentGeneratedError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
8
7
  import * as z3 from 'zod/v3';
@@ -1594,115 +1593,6 @@ type InferUIMessageToolCall<UI_MESSAGE extends UIMessage> = ValueOf<{
1594
1593
  dynamic: true;
1595
1594
  });
1596
1595
 
1597
- declare const uiMessageChunkSchema: z.ZodUnion<readonly [z.ZodObject<{
1598
- type: z.ZodLiteral<"text-start">;
1599
- id: z.ZodString;
1600
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1601
- }, z.core.$strict>, z.ZodObject<{
1602
- type: z.ZodLiteral<"text-delta">;
1603
- id: z.ZodString;
1604
- delta: z.ZodString;
1605
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1606
- }, z.core.$strict>, z.ZodObject<{
1607
- type: z.ZodLiteral<"text-end">;
1608
- id: z.ZodString;
1609
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1610
- }, z.core.$strict>, z.ZodObject<{
1611
- type: z.ZodLiteral<"error">;
1612
- errorText: z.ZodString;
1613
- }, z.core.$strict>, z.ZodObject<{
1614
- type: z.ZodLiteral<"tool-input-start">;
1615
- toolCallId: z.ZodString;
1616
- toolName: z.ZodString;
1617
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1618
- dynamic: z.ZodOptional<z.ZodBoolean>;
1619
- }, z.core.$strict>, z.ZodObject<{
1620
- type: z.ZodLiteral<"tool-input-delta">;
1621
- toolCallId: z.ZodString;
1622
- inputTextDelta: z.ZodString;
1623
- }, z.core.$strict>, z.ZodObject<{
1624
- type: z.ZodLiteral<"tool-input-available">;
1625
- toolCallId: z.ZodString;
1626
- toolName: z.ZodString;
1627
- input: z.ZodUnknown;
1628
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1629
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1630
- dynamic: z.ZodOptional<z.ZodBoolean>;
1631
- }, z.core.$strict>, z.ZodObject<{
1632
- type: z.ZodLiteral<"tool-input-error">;
1633
- toolCallId: z.ZodString;
1634
- toolName: z.ZodString;
1635
- input: z.ZodUnknown;
1636
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1637
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1638
- dynamic: z.ZodOptional<z.ZodBoolean>;
1639
- errorText: z.ZodString;
1640
- }, z.core.$strict>, z.ZodObject<{
1641
- type: z.ZodLiteral<"tool-output-available">;
1642
- toolCallId: z.ZodString;
1643
- output: z.ZodUnknown;
1644
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1645
- dynamic: z.ZodOptional<z.ZodBoolean>;
1646
- preliminary: z.ZodOptional<z.ZodBoolean>;
1647
- }, z.core.$strict>, z.ZodObject<{
1648
- type: z.ZodLiteral<"tool-output-error">;
1649
- toolCallId: z.ZodString;
1650
- errorText: z.ZodString;
1651
- providerExecuted: z.ZodOptional<z.ZodBoolean>;
1652
- dynamic: z.ZodOptional<z.ZodBoolean>;
1653
- }, z.core.$strict>, z.ZodObject<{
1654
- type: z.ZodLiteral<"reasoning-start">;
1655
- id: z.ZodString;
1656
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1657
- }, z.core.$strict>, z.ZodObject<{
1658
- type: z.ZodLiteral<"reasoning-delta">;
1659
- id: z.ZodString;
1660
- delta: z.ZodString;
1661
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1662
- }, z.core.$strict>, z.ZodObject<{
1663
- type: z.ZodLiteral<"reasoning-end">;
1664
- id: z.ZodString;
1665
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1666
- }, z.core.$strict>, z.ZodObject<{
1667
- type: z.ZodLiteral<"source-url">;
1668
- sourceId: z.ZodString;
1669
- url: z.ZodString;
1670
- title: z.ZodOptional<z.ZodString>;
1671
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1672
- }, z.core.$strict>, z.ZodObject<{
1673
- type: z.ZodLiteral<"source-document">;
1674
- sourceId: z.ZodString;
1675
- mediaType: z.ZodString;
1676
- title: z.ZodString;
1677
- filename: z.ZodOptional<z.ZodString>;
1678
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1679
- }, z.core.$strict>, z.ZodObject<{
1680
- type: z.ZodLiteral<"file">;
1681
- url: z.ZodString;
1682
- mediaType: z.ZodString;
1683
- providerMetadata: z.ZodOptional<z.ZodType<_ai_sdk_provider.SharedV2ProviderMetadata, unknown, z.core.$ZodTypeInternals<_ai_sdk_provider.SharedV2ProviderMetadata, unknown>>>;
1684
- }, z.core.$strict>, z.ZodObject<{
1685
- type: z.ZodCustom<`data-${string}`, `data-${string}`>;
1686
- id: z.ZodOptional<z.ZodString>;
1687
- data: z.ZodUnknown;
1688
- transient: z.ZodOptional<z.ZodBoolean>;
1689
- }, z.core.$strict>, z.ZodObject<{
1690
- type: z.ZodLiteral<"start-step">;
1691
- }, z.core.$strict>, z.ZodObject<{
1692
- type: z.ZodLiteral<"finish-step">;
1693
- }, z.core.$strict>, z.ZodObject<{
1694
- type: z.ZodLiteral<"start">;
1695
- messageId: z.ZodOptional<z.ZodString>;
1696
- messageMetadata: z.ZodOptional<z.ZodUnknown>;
1697
- }, z.core.$strict>, z.ZodObject<{
1698
- type: z.ZodLiteral<"finish">;
1699
- messageMetadata: z.ZodOptional<z.ZodUnknown>;
1700
- }, z.core.$strict>, z.ZodObject<{
1701
- type: z.ZodLiteral<"abort">;
1702
- }, z.core.$strict>, z.ZodObject<{
1703
- type: z.ZodLiteral<"message-metadata">;
1704
- messageMetadata: z.ZodUnknown;
1705
- }, z.core.$strict>]>;
1706
1596
  type DataUIMessageChunk<DATA_TYPES extends UIDataTypes> = ValueOf<{
1707
1597
  [NAME in keyof DATA_TYPES & string]: {
1708
1598
  type: `data-${NAME}`;
@@ -1797,7 +1687,6 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
1797
1687
  type: 'file';
1798
1688
  url: string;
1799
1689
  mediaType: string;
1800
- providerMetadata?: ProviderMetadata;
1801
1690
  } | DataUIMessageChunk<DATA_TYPES> | {
1802
1691
  type: 'start-step';
1803
1692
  } | {
@@ -2072,28 +1961,47 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2072
1961
  */
2073
1962
  consumeStream(options?: ConsumeStreamOptions): Promise<void>;
2074
1963
  /**
2075
- Converts the result to a UI message stream.
1964
+ Converts the result to a UI message stream.
1965
+
1966
+ @param options.getErrorMessage an optional function that converts an error to an error message.
1967
+ @param options.sendUsage whether to send the usage information to the client. Defaults to true.
1968
+ @param options.sendReasoning whether to send the reasoning information to the client. Defaults to false.
1969
+ @param options.sendSources whether to send the sources information to the client. Defaults to false.
1970
+ @param options.experimental_sendFinish whether to send the finish information to the client. Defaults to true.
1971
+ @param options.experimental_sendStart whether to send the start information to the client. Defaults to true.
2076
1972
 
2077
- @return A UI message stream.
1973
+ @return A UI message stream.
2078
1974
  */
2079
1975
  toUIMessageStream<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamOptions<UI_MESSAGE>): AsyncIterableStream<InferUIMessageChunk<UI_MESSAGE>>;
2080
1976
  /**
2081
- *Writes UI message stream output to a Node.js response-like object.
2082
- */
1977
+ Writes UI message stream output to a Node.js response-like object.
1978
+ @param response A Node.js response-like object (ServerResponse).
1979
+ @param options.status The status code.
1980
+ @param options.statusText The status text.
1981
+ @param options.headers The headers.
1982
+ @param options.getErrorMessage An optional function that converts an error to an error message.
1983
+ @param options.sendUsage Whether to send the usage information to the client. Defaults to true.
1984
+ @param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
1985
+ */
2083
1986
  pipeUIMessageStreamToResponse<UI_MESSAGE extends UIMessage>(response: ServerResponse, options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): void;
2084
1987
  /**
2085
- Writes text delta output to a Node.js response-like object.
2086
- It sets a `Content-Type` header to `text/plain; charset=utf-8` and
2087
- writes each text delta as a separate chunk.
2088
-
2089
- @param response A Node.js response-like object (ServerResponse).
2090
- @param init Optional headers, status code, and status text.
1988
+ Writes text delta output to a Node.js response-like object.
1989
+ It sets a `Content-Type` header to `text/plain; charset=utf-8` and
1990
+ writes each text delta as a separate chunk.
1991
+ @param response A Node.js response-like object (ServerResponse).
1992
+ @param init Optional headers, status code, and status text.
2091
1993
  */
2092
1994
  pipeTextStreamToResponse(response: ServerResponse, init?: ResponseInit): void;
2093
1995
  /**
2094
- Converts the result to a streamed response object with a stream data part stream.
1996
+ Converts the result to a streamed response object with a stream data part stream.
2095
1997
 
2096
- @return A response object.
1998
+ @param options.status The status code.
1999
+ @param options.statusText The status text.
2000
+ @param options.headers The headers.
2001
+ @param options.getErrorMessage An optional function that converts an error to an error message.
2002
+ @param options.sendUsage Whether to send the usage information to the client. Defaults to true.
2003
+ @param options.sendReasoning Whether to send the reasoning information to the client. Defaults to false.
2004
+ @return A response object.
2097
2005
  */
2098
2006
  toUIMessageStreamResponse<UI_MESSAGE extends UIMessage>(options?: UIMessageStreamResponseInit & UIMessageStreamOptions<UI_MESSAGE>): Response;
2099
2007
  /**
@@ -4308,18 +4216,10 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
4308
4216
  * Clear the error state and set the status to ready if the chat is in an error state.
4309
4217
  */
4310
4218
  clearError: () => void;
4311
- addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
4312
- state?: "output-available";
4219
+ addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ tool, toolCallId, output, }: {
4313
4220
  tool: TOOL;
4314
4221
  toolCallId: string;
4315
4222
  output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
4316
- errorText?: never;
4317
- } | {
4318
- state: "output-error";
4319
- tool: TOOL;
4320
- toolCallId: string;
4321
- output?: never;
4322
- errorText: string;
4323
4223
  }) => Promise<void>;
4324
4224
  /**
4325
4225
  * Abort the current request immediately, keep the generated tokens if any.
@@ -4550,28 +4450,6 @@ type UseCompletionOptions = {
4550
4450
  fetch?: FetchFunction;
4551
4451
  };
4552
4452
 
4553
- type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
4554
- success: true;
4555
- data: Array<UI_MESSAGE>;
4556
- } | {
4557
- success: false;
4558
- error: Error;
4559
- };
4560
- /**
4561
- * Validates a list of UI messages like `validateUIMessages`,
4562
- * but instead of throwing it returns `{ success: true, data }`
4563
- * or `{ success: false, error }`.
4564
- */
4565
- declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
4566
- messages: unknown;
4567
- metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
4568
- dataSchemas?: {
4569
- [NAME in keyof InferUIMessageData<UI_MESSAGE> & string]?: Validator<InferUIMessageData<UI_MESSAGE>[NAME]> | StandardSchemaV1<unknown, InferUIMessageData<UI_MESSAGE>[NAME]>;
4570
- };
4571
- tools?: {
4572
- [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
4573
- };
4574
- }): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
4575
4453
  /**
4576
4454
  * Validates a list of UI messages.
4577
4455
  *
@@ -4610,4 +4488,4 @@ declare global {
4610
4488
  var AI_SDK_LOG_WARNINGS: LogWarningsFunction | undefined | false;
4611
4489
  }
4612
4490
 
4613
- export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };
4491
+ export { AbstractChat, AsyncIterableStream, CallSettings, CallWarning, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, ErrorHandler, Agent as Experimental_Agent, AgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, Warning as Experimental_Warning, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolInputError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RetryError, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StaticToolCall, StaticToolError, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, TypedToolCall, TypedToolError, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamOnFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, assistantModelMessageSchema, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultSettingsMiddleware, embed, embedMany, MCPClient as experimental_MCPClient, MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isDeepEqualData, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, readUIMessageStream, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, userModelMessageSchema, validateUIMessages, wrapLanguageModel, wrapProvider };