@mastra/voice-google 0.14.3-alpha.0 → 0.14.4-alpha.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.
@@ -19,7 +19,11 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
19
19
  private onData?;
20
20
  private sendAutomaticallyWhen?;
21
21
  private activeResponse;
22
+ private activeResumeRequest;
23
+ private resumableStreamState;
22
24
  private jobExecutor;
25
+ private activeStopCount;
26
+ private stopGeneration;
23
27
  constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
24
28
  state: ChatState<UI_MESSAGE>;
25
29
  });
@@ -105,10 +109,14 @@ export declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
105
109
  errorText: string;
106
110
  }) => Promise<void>;
107
111
  /**
108
- * Abort the current request immediately, keep the generated tokens if any.
112
+ * Abort the current request, keep the generated tokens if any, and wait for
113
+ * the request pipeline to finish.
109
114
  */
110
115
  stop: () => Promise<void>;
116
+ private shouldSendAutomatically;
117
+ private runAutomaticRequest;
111
118
  private makeRequest;
119
+ private makeRequestImpl;
112
120
  }
113
121
 
114
122
  declare namespace _ai_sdk_provider_utils {
@@ -183,6 +191,7 @@ declare namespace _ai_sdk_provider_utils {
183
191
  dynamicTool,
184
192
  executeTool,
185
193
  extractResponseHeaders,
194
+ fetchWithValidatedEndpoint,
186
195
  fetchWithValidatedRedirects,
187
196
  generateId,
188
197
  getErrorMessage,
@@ -260,38 +269,6 @@ export declare class AISDKError extends Error {
260
269
  protected static hasMarker(error: unknown, marker: string): boolean;
261
270
  }
262
271
 
263
- /**
264
- * Custom error class for AI SDK related errors.
265
- * @extends Error
266
- */
267
- declare class AISDKError_2 extends Error {
268
- private readonly [symbol$d_2];
269
- /**
270
- * The underlying cause of the error, if any.
271
- */
272
- readonly cause?: unknown;
273
- /**
274
- * Creates an AI SDK Error.
275
- *
276
- * @param {Object} params - The parameters for creating the error.
277
- * @param {string} params.name - The name of the error.
278
- * @param {string} params.message - The error message.
279
- * @param {unknown} [params.cause] - The underlying cause of the error.
280
- */
281
- constructor({ name, message, cause, }: {
282
- name: string;
283
- message: string;
284
- cause?: unknown;
285
- });
286
- /**
287
- * Checks if the given error is an AI SDK Error.
288
- * @param {unknown} error - The error to check.
289
- * @returns {boolean} True if the error is an AI SDK Error, false otherwise.
290
- */
291
- static isInstance(error: unknown): error is AISDKError_2;
292
- protected static hasMarker(error: unknown, marker: string): boolean;
293
- }
294
-
295
272
  export declare class APICallError extends AISDKError {
296
273
  private readonly [symbol$c];
297
274
  readonly url: string;
@@ -316,30 +293,6 @@ export declare class APICallError extends AISDKError {
316
293
  static isInstance(error: unknown): error is APICallError;
317
294
  }
318
295
 
319
- declare class APICallError_2 extends AISDKError_2 {
320
- private readonly [symbol$c_2];
321
- readonly url: string;
322
- readonly requestBodyValues: unknown;
323
- readonly statusCode?: number;
324
- readonly responseHeaders?: Record<string, string>;
325
- readonly responseBody?: string;
326
- readonly isRetryable: boolean;
327
- readonly data?: unknown;
328
- constructor({ message, url, requestBodyValues, statusCode, responseHeaders, responseBody, cause, isRetryable, // server error
329
- data, }: {
330
- message: string;
331
- url: string;
332
- requestBodyValues: unknown;
333
- statusCode?: number;
334
- responseHeaders?: Record<string, string>;
335
- responseBody?: string;
336
- cause?: unknown;
337
- isRetryable?: boolean;
338
- data?: unknown;
339
- });
340
- static isInstance(error: unknown): error is APICallError_2;
341
- }
342
-
343
296
  export declare function asSchema<OBJECT>(schema: FlexibleSchema<OBJECT> | undefined): Schema<OBJECT>;
344
297
 
345
298
  /**
@@ -658,6 +611,7 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
658
611
  *
659
612
  * @param options - Configuration object containing:
660
613
  * @param options.chatId - Unique identifier for the chat session to reconnect to
614
+ * @param options.abortSignal - Signal to abort the reconnection request if needed
661
615
  * @param options.headers - Additional HTTP headers to include in the reconnection request
662
616
  * @param options.body - Additional JSON properties to include in the request body
663
617
  * @param options.metadata - Custom metadata to attach to the request
@@ -671,6 +625,8 @@ export declare interface ChatTransport<UI_MESSAGE extends UIMessage> {
671
625
  reconnectToStream: (options: {
672
626
  /** Unique identifier for the chat session to reconnect to */
673
627
  chatId: string;
628
+ /** Signal to abort the reconnection request if needed */
629
+ abortSignal?: AbortSignal;
674
630
  } & ChatRequestOptions) => Promise<ReadableStream<UIMessageChunk> | null>;
675
631
  }
676
632
 
@@ -706,9 +662,10 @@ export declare type CompletionRequestOptions = {
706
662
  * @param {ReadableStream} stream - The ReadableStream to be consumed.
707
663
  * @returns {Promise<void>} A promise that resolves when the stream is fully consumed.
708
664
  */
709
- export declare function consumeStream({ stream, onError, }: {
665
+ export declare function consumeStream({ stream, onError, abortSignal, }: {
710
666
  stream: ReadableStream;
711
667
  onError?: (error: unknown) => void;
668
+ abortSignal?: AbortSignal;
712
669
  }): Promise<void>;
713
670
 
714
671
  declare type ConsumeStreamOptions = {
@@ -916,7 +873,7 @@ declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage,
916
873
  errorSchema: FlexibleValidator<T>;
917
874
  errorToMessage: (error: T) => string;
918
875
  isRetryable?: (response: Response, error?: T) => boolean;
919
- }) => ResponseHandler<APICallError_2>;
876
+ }) => ResponseHandler<APICallError>;
920
877
 
921
878
  declare const createJsonResponseHandler: <T>(responseSchema: FlexibleValidator<T>) => ResponseHandler<T>;
922
879
 
@@ -952,7 +909,7 @@ export declare function createProviderRegistry<PROVIDERS extends Record<string,
952
909
  languageModelMiddleware?: LanguageModelMiddleware | LanguageModelMiddleware[];
953
910
  }): ProviderRegistryProvider<PROVIDERS, SEPARATOR>;
954
911
 
955
- declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError_2>;
912
+ declare const createStatusCodeErrorResponseHandler: () => ResponseHandler<APICallError>;
956
913
 
957
914
  export declare function createTextStreamResponse({ status, statusText, headers, textStream, }: ResponseInit & {
958
915
  textStream: ReadableStream<string>;
@@ -979,7 +936,7 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
979
936
  export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
980
937
  originalMessages, onFinish, generateId, }: {
981
938
  execute: (options: {
982
- writer: UIMessageStreamWriter<UI_MESSAGE>;
939
+ writer: UIMessageStreamWriterWithOutcome<UI_MESSAGE>;
983
940
  }) => Promise<void> | void;
984
941
  onError?: (error: unknown) => string;
985
942
  /**
@@ -991,7 +948,7 @@ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ ex
991
948
  generateId?: IdGenerator;
992
949
  }): ReadableStream<InferUIMessageChunk<UI_MESSAGE>>;
993
950
 
994
- export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, consumeSseStream, }: UIMessageStreamResponseInit & {
951
+ export declare function createUIMessageStreamResponse({ status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: UIMessageStreamResponseInit & {
995
952
  stream: ReadableStream<UIMessageChunk>;
996
953
  }): Response;
997
954
 
@@ -1140,7 +1097,7 @@ export declare class DownloadError extends AISDKError {
1140
1097
  static isInstance(error: unknown): error is DownloadError;
1141
1098
  }
1142
1099
 
1143
- declare class DownloadError_2 extends AISDKError_2 {
1100
+ declare class DownloadError_2 extends AISDKError {
1144
1101
  private readonly [symbol_2];
1145
1102
  readonly url: string;
1146
1103
  readonly statusCode?: number;
@@ -1163,7 +1120,7 @@ export declare function dynamicTool(tool: {
1163
1120
  providerOptions?: ProviderOptions;
1164
1121
  inputSchema: FlexibleSchema<unknown>;
1165
1122
  execute: ToolExecuteFunction<unknown, unknown>;
1166
- toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart_2['output'];
1123
+ toModelOutput?: (output: unknown) => LanguageModelV2ToolResultPart['output'];
1167
1124
  }): Tool<unknown, unknown> & {
1168
1125
  type: 'dynamic';
1169
1126
  };
@@ -1212,6 +1169,13 @@ export declare type DynamicToolResult = {
1212
1169
 
1213
1170
  export declare type DynamicToolUIPart = {
1214
1171
  type: 'dynamic-tool';
1172
+ /**
1173
+ * `false` when a static tool part was normalized to a dynamic tool part
1174
+ * because its current tool schema was unavailable or incompatible.
1175
+ *
1176
+ * This preserves its static origin across persistence boundaries.
1177
+ */
1178
+ dynamic?: false;
1215
1179
  /**
1216
1180
  * Name of the tool that is being called.
1217
1181
  */
@@ -1228,6 +1192,13 @@ export declare type DynamicToolUIPart = {
1228
1192
  } & ({
1229
1193
  state: 'input-streaming';
1230
1194
  input: unknown | undefined;
1195
+ /**
1196
+ * The raw tool input text received so far.
1197
+ *
1198
+ * This is used to continue input streaming when a message is persisted
1199
+ * and later resumed.
1200
+ */
1201
+ rawInput?: string;
1231
1202
  output?: never;
1232
1203
  errorText?: never;
1233
1204
  } | {
@@ -1431,8 +1402,9 @@ declare type EmbeddingModelV2Embedding = Array<number>;
1431
1402
  Embed several values using an embedding model. The type of the value is defined
1432
1403
  by the embedding model.
1433
1404
 
1434
- `embedMany` automatically splits large requests into smaller chunks if the model
1435
- has a limit on how many embeddings can be generated in a single call.
1405
+ `embedMany` automatically splits large requests into smaller chunks when the
1406
+ model has a limit on either the number of embeddings or the UTF-8 input bytes
1407
+ that can be processed in a single call.
1436
1408
 
1437
1409
  @param model - The embedding model to use.
1438
1410
  @param values - The values that should be embedded.
@@ -1565,6 +1537,10 @@ export declare class EmptyResponseBodyError extends AISDKError {
1565
1537
  static isInstance(error: unknown): error is EmptyResponseBodyError;
1566
1538
  }
1567
1539
 
1540
+ declare type EnforcedToolChoice = Extract<LanguageModelV2ToolChoice, {
1541
+ type: 'none';
1542
+ }>;
1543
+
1568
1544
  export declare type ErrorHandler = (error: unknown) => void;
1569
1545
 
1570
1546
  /**
@@ -1606,7 +1582,7 @@ declare interface EventSourceMessage {
1606
1582
  * const eventStream =
1607
1583
  * response.body
1608
1584
  * .pipeThrough(new TextDecoderStream())
1609
- * .pipeThrough(new EventSourceParserStream({terminateOnError: true}))
1585
+ * .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))
1610
1586
  * ```
1611
1587
  *
1612
1588
  * @public
@@ -1615,7 +1591,7 @@ declare class EventSourceParserStream extends TransformStream<
1615
1591
  string,
1616
1592
  EventSourceMessage
1617
1593
  > {
1618
- constructor({ onError, onRetry, onComment }?: StreamOptions);
1594
+ constructor({ onError, onRetry, onComment, maxBufferSize }?: StreamOptions);
1619
1595
  }
1620
1596
 
1621
1597
  /**
@@ -1736,7 +1712,7 @@ export declare type Experimental_AgentSettings<TOOLS extends ToolSet, OUTPUT = n
1736
1712
  /**
1737
1713
  Optional specification for parsing structured outputs from the LLM response.
1738
1714
  */
1739
- experimental_output?: Output_2<OUTPUT, OUTPUT_PARTIAL>;
1715
+ experimental_output?: OutputInterface<OUTPUT, OUTPUT_PARTIAL>;
1740
1716
  /**
1741
1717
  * @deprecated Use `prepareStep` instead.
1742
1718
  */
@@ -1816,7 +1792,7 @@ export declare type Experimental_DownloadFunction = (options: Array<{
1816
1792
  @param seed - Seed for the image generation.
1817
1793
  @param providerOptions - Additional provider-specific options that are passed through to the provider
1818
1794
  as body parameters.
1819
- @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
1795
+ @param maxRetries - Maximum number of retries per image model call, including retries after unclassified empty responses. Empty responses marked as not retryable by the provider are not retried. Set to 0 to disable retries. Default: 2.
1820
1796
  @param abortSignal - An optional abort signal that can be used to cancel the call.
1821
1797
  @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
1822
1798
 
@@ -1867,7 +1843,9 @@ export declare function experimental_generateImage({ model: modelArg, prompt, n,
1867
1843
  */
1868
1844
  providerOptions?: ProviderOptions;
1869
1845
  /**
1870
- Maximum number of retries per embedding model call. Set to 0 to disable retries.
1846
+ Maximum number of retries per image model call, including retries after
1847
+ unclassified empty responses. Empty responses marked as not retryable by the
1848
+ provider are not retried. Set to 0 to disable retries.
1871
1849
 
1872
1850
  @default 2
1873
1851
  */
@@ -2158,6 +2136,26 @@ declare function extractResponseHeaders(response: Response): {
2158
2136
  */
2159
2137
  declare type FetchFunction = typeof globalThis.fetch;
2160
2138
 
2139
+ /**
2140
+ * Fetches one validated URL without following redirects.
2141
+ *
2142
+ * On Node.js, the default fetch validates and pins DNS results at connect time.
2143
+ * An injected fetch is responsible for equivalent connect-time validation.
2144
+ * Redirects are rejected by default. Callers using `redirect: 'manual'` must
2145
+ * validate the Location target before issuing another request.
2146
+ */
2147
+ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
2148
+ url: string | URL;
2149
+ init?: RequestInit;
2150
+ fetch?: FetchFunction;
2151
+ /**
2152
+ * A developer-configured origin that may legitimately resolve to a private
2153
+ * address. This must never be derived from untrusted response data.
2154
+ */
2155
+ trustedOrigin?: string;
2156
+ redirect?: 'error' | 'manual';
2157
+ }): Promise<Response>;
2158
+
2161
2159
  /**
2162
2160
  * Fetches a URL while enforcing the SSRF download guard on every hop.
2163
2161
  *
@@ -2175,6 +2173,13 @@ declare type FetchFunction = typeof globalThis.fetch;
2175
2173
  * runtime we cannot validate the hop, so we fail closed rather than follow it
2176
2174
  * blindly and bypass the SSRF guard.
2177
2175
  *
2176
+ * A hop that is same-origin with `trustedOrigin` (the developer-configured
2177
+ * endpoint) skips target validation: that origin is exactly what an
2178
+ * unvalidated, config-derived request would fetch anyway, and validating it
2179
+ * would break legitimate self-hosted / localhost deployments whose response
2180
+ * URLs point back at the configured host. Hops on any other origin are always
2181
+ * validated.
2182
+ *
2178
2183
  * The returned response is the final (non-redirect) response. The caller is
2179
2184
  * responsible for checking `response.ok` and reading the body.
2180
2185
  *
@@ -2186,11 +2191,17 @@ declare type FetchFunction = typeof globalThis.fetch;
2186
2191
  * @throws DownloadError if a hop is unsafe, the redirect limit is exceeded, or
2187
2192
  * a redirect cannot be validated on a non-browser runtime.
2188
2193
  */
2189
- declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, }: {
2194
+ declare function fetchWithValidatedRedirects({ url, headers, abortSignal, maxRedirects, fetch: customFetch, trustedOrigin, }: {
2190
2195
  url: string;
2191
2196
  headers?: HeadersInit;
2192
2197
  abortSignal?: AbortSignal;
2193
2198
  maxRedirects?: number;
2199
+ fetch?: FetchFunction;
2200
+ /**
2201
+ * A developer-configured origin whose hops skip target validation. Must
2202
+ * never be derived from response data.
2203
+ */
2204
+ trustedOrigin?: string;
2194
2205
  }): Promise<Response>;
2195
2206
 
2196
2207
  /**
@@ -2275,7 +2286,7 @@ declare interface GatewayCreditsResponse {
2275
2286
  totalUsed: string;
2276
2287
  }
2277
2288
 
2278
- declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
2289
+ declare type GatewayEmbeddingModelId = 'alibaba/qwen3-embedding-0.6b' | 'alibaba/qwen3-embedding-4b' | 'alibaba/qwen3-embedding-8b' | 'amazon/titan-embed-text-v2' | 'cohere/embed-v4.0' | 'cohere/embed-v5.0-fast' | 'cohere/embed-v5.0-pro' | 'google/gemini-embedding-001' | 'google/gemini-embedding-2' | 'google/text-embedding-005' | 'google/text-multilingual-embedding-002' | 'mistral/codestral-embed' | 'mistral/mistral-embed' | 'openai/text-embedding-3-large' | 'openai/text-embedding-3-small' | 'openai/text-embedding-ada-002' | 'perplexity/pplx-embed-v1-0.6b' | 'perplexity/pplx-embed-v1-4b' | 'voyage/voyage-3-large' | 'voyage/voyage-3.5' | 'voyage/voyage-3.5-lite' | 'voyage/voyage-4' | 'voyage/voyage-4-large' | 'voyage/voyage-4-lite' | 'voyage/voyage-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
2279
2290
 
2280
2291
  declare interface GatewayFetchMetadataResponse {
2281
2292
  models: GatewayLanguageModelEntry[];
@@ -2325,7 +2336,7 @@ declare interface GatewayGenerationInfoParams {
2325
2336
  id: string;
2326
2337
  }
2327
2338
 
2328
- declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'xai/grok-imagine-image' | (string & {});
2339
+ declare type GatewayImageModelId = 'bfl/flux-2-flex' | 'bfl/flux-2-klein-4b' | 'bfl/flux-2-klein-9b' | 'bfl/flux-2-max' | 'bfl/flux-2-pro' | 'bfl/flux-3-image' | 'bfl/flux-kontext-max' | 'bfl/flux-kontext-pro' | 'bfl/flux-pro-1.0-fill' | 'bfl/flux-pro-1.1' | 'bfl/flux-pro-1.1-ultra' | 'bytedance/seedream-4.0' | 'bytedance/seedream-4.5' | 'bytedance/seedream-5.0-lite' | 'bytedance/seedream-5.0-pro' | 'meta/muse-image-1.0' | 'microsoft/mai-image-2.6' | 'microsoft/mai-image-2.6-flash' | 'openai/gpt-image-1' | 'openai/gpt-image-1-mini' | 'openai/gpt-image-1.5' | 'openai/gpt-image-2' | 'openai/gpt-image-2.5-flare' | 'openai/gpt-image-2.5-sunburst' | 'prodia/flux-fast-schnell' | 'quiverai/arrow-1.1' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'recraft/recraft-v4.1' | 'recraft/recraft-v4.1-flash' | 'recraft/recraft-v4.1-pro' | 'recraft/recraft-v4.1-utility' | 'recraft/recraft-v4.1-utility-pro' | 'spacexai/grok-imagine-image' | 'spacexai/grok-imagine-image-2.0' | 'topaz/wonder-3.5' | (string & {});
2329
2340
 
2330
2341
  declare interface GatewayLanguageModelEntry {
2331
2342
  /**
@@ -2376,7 +2387,7 @@ declare interface GatewayLanguageModelEntry {
2376
2387
 
2377
2388
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV2, 'specificationVersion' | 'provider' | 'modelId'>;
2378
2389
 
2379
- export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen-3.6-max-preview' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-coder-plus' | 'alibaba/qwen3-max' | 'alibaba/qwen3-max-preview' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-235b-a22b-instruct' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-fable-5' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-5' | 'arcee-ai/trinity-large-thinking' | 'arcee-ai/trinity-mini' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.1-terminus' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-pro' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.6-flash' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash-free' | 'interfaze/interfaze-beta' | 'kwaipilot/kat-coder-air-v2.5' | 'kwaipilot/kat-coder-pro-v1' | 'kwaipilot/kat-coder-pro-v2' | 'kwaipilot/kat-coder-pro-v2.5' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-spark-1.1' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small-2' | 'mistral/magistral-medium' | 'mistral/magistral-small' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-medium' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mistral/pixtral-12b' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-nano' | 'openai/gpt-4o' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-search-preview' | 'openai/gpt-5' | 'openai/gpt-5-codex' | 'openai/gpt-5-mini' | 'openai/gpt-5-nano' | 'openai/gpt-5-pro' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-instant' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.2' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.4' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-terra' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-deep-research' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'perplexity/sonar' | 'perplexity/sonar-pro' | 'perplexity/sonar-reasoning-pro' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'sakana/fugu-ultra' | 'stepfun/step-3.5-flash' | 'stepfun/step-3.7-flash' | 'tencent/hy3' | 'thinkingmachines/inkling' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-4.20-multi-agent' | 'xai/grok-4.20-multi-agent-beta' | 'xai/grok-4.20-non-reasoning' | 'xai/grok-4.20-non-reasoning-beta' | 'xai/grok-4.20-reasoning' | 'xai/grok-4.20-reasoning-beta' | 'xai/grok-4.3' | 'xai/grok-4.5' | 'xai/grok-build-0.1' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.6v' | 'zai/glm-4.6v-flash' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5v-turbo' | (string & {});
2390
+ export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | 'alibaba/qwen3-coder-next' | 'alibaba/qwen3-max-thinking' | 'alibaba/qwen3-next-80b-a3b-instruct' | 'alibaba/qwen3-next-80b-a3b-thinking' | 'alibaba/qwen3-vl-instruct' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'alibaba/qwen3.6-27b' | 'alibaba/qwen3.6-plus' | 'alibaba/qwen3.7-flash' | 'alibaba/qwen3.7-max' | 'alibaba/qwen3.7-plus' | 'alibaba/qwen3.8-2.4t-a95b' | 'alibaba/qwen3.8-27b' | 'alibaba/qwen3.8-flash' | 'alibaba/qwen3.8-max' | 'alibaba/qwen3.8-max-0902' | 'alibaba/qwen3.8-max-prime' | 'alibaba/qwen3.8-omni-flash' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-fable-5' | 'anthropic/claude-fable-5-batch' | 'anthropic/claude-fable-5.1' | 'anthropic/claude-fable-5.1-batch' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-haiku-4.5-batch' | 'anthropic/claude-haiku-5.5' | 'anthropic/claude-haiku-5.5-batch' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-opus-4.5-batch' | 'anthropic/claude-opus-4.6' | 'anthropic/claude-opus-4.6-batch' | 'anthropic/claude-opus-4.7' | 'anthropic/claude-opus-4.7-batch' | 'anthropic/claude-opus-4.8' | 'anthropic/claude-opus-4.8-batch' | 'anthropic/claude-opus-4.8-fast' | 'anthropic/claude-opus-5' | 'anthropic/claude-opus-5-batch' | 'anthropic/claude-opus-5-fast' | 'anthropic/claude-opus-5.5' | 'anthropic/claude-opus-5.5-batch' | 'anthropic/claude-opus-5.5-fast' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.5-batch' | 'anthropic/claude-sonnet-4.6' | 'anthropic/claude-sonnet-4.6-batch' | 'anthropic/claude-sonnet-5' | 'anthropic/claude-sonnet-5-batch' | 'anthropic/claude-sonnet-5.5' | 'anthropic/claude-sonnet-5.5-batch' | 'arcee-ai/trinity-large-thinking' | 'bytedance/seed-1.6' | 'bytedance/seed-1.8' | 'bytedance/seed-2.1-turbo' | 'callstack/apex' | 'cohere/command-a' | 'deepseek/deepseek-r1' | 'deepseek/deepseek-v3.1' | 'deepseek/deepseek-v3.2' | 'deepseek/deepseek-v3.2-thinking' | 'deepseek/deepseek-v4-flash' | 'deepseek/deepseek-v4-flash-0731' | 'deepseek/deepseek-v4-flash-vision-exp' | 'deepseek/deepseek-v4-pro' | 'deepseek/deepseek-v4-pro-0813' | 'deepseek/deepseek-v4.1-flash' | 'deepseek/deepseek-v4.1-flash-fast' | 'fireworks/ember-1' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-batch' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-batch' | 'google/gemini-2.5-pro' | 'google/gemini-2.5-pro-batch' | 'google/gemini-3-flash' | 'google/gemini-3-flash-batch' | 'google/gemini-3-pro-image' | 'google/gemini-3.1-flash-image' | 'google/gemini-3.1-flash-image-preview' | 'google/gemini-3.1-flash-lite' | 'google/gemini-3.1-flash-lite-batch' | 'google/gemini-3.1-flash-lite-image' | 'google/gemini-3.1-pro-preview' | 'google/gemini-3.1-pro-preview-batch' | 'google/gemini-3.5-flash' | 'google/gemini-3.5-flash-batch' | 'google/gemini-3.5-flash-lite' | 'google/gemini-3.5-flash-lite-batch' | 'google/gemini-3.6-flash' | 'google/gemini-3.6-flash-batch' | 'google/gemini-3.7-flash' | 'google/gemini-3.7-flash-batch' | 'google/gemini-3.8-flash' | 'google/gemini-4-argon' | 'google/gemini-nano-banana-2.1' | 'google/gemini-omni-flash-preview' | 'google/gemma-4-26b-a4b-it' | 'google/gemma-4-31b-it' | 'inception/mercury-2' | 'inception/mercury-2.5' | 'inception/mercury-coder-small' | 'inclusionai/ling-3.0-flash' | 'inclusionai/ling-3.0-flash-fin' | 'inclusionai/ling-3.0-flash-sante' | 'inclusionai/ling-3.0-flash-vl' | 'inclusionai/ling-3.1-flash' | 'inference-net/schematron-v2-small' | 'inference-net/schematron-v2-turbo' | 'interfaze/interfaze-beta' | 'liquid/lfm2.5-24b-a2b' | 'meituan/longcat-2.5-preview' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'meta/muse-glimmer-30b' | 'meta/muse-spark-1.1' | 'meta/muse-spark-1.2' | 'meta/muse-spark-1.2-contributor' | 'meta/muse-spark-1.3' | 'meta/muse-spark-1.3-contributor' | 'meta/muse-wonder-1.0' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'minimax/minimax-m2.5-highspeed' | 'minimax/minimax-m2.7' | 'minimax/minimax-m2.7-highspeed' | 'minimax/minimax-m3' | 'mistral/codestral' | 'mistral/ministral-14b' | 'mistral/ministral-3b' | 'mistral/ministral-8b' | 'mistral/mistral-large-3' | 'mistral/mistral-large-4' | 'mistral/mistral-medium-3.5' | 'mistral/mistral-nemo' | 'mistral/mistral-small' | 'mixedbread/toast-1' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2.5' | 'moonshotai/kimi-k2.6' | 'moonshotai/kimi-k2.7-code' | 'moonshotai/kimi-k2.7-code-highspeed' | 'moonshotai/kimi-k3' | 'moonshotai/kimi-k3-fast' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-3-super-120b-a12b' | 'nvidia/nemotron-3-ultra-550b-a55b' | 'nvidia/nemotron-3.5-lightning' | 'nvidia/nemotron-3.5-lightning-free' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/gpt-3.5-turbo' | 'openai/gpt-4-turbo' | 'openai/gpt-4.1' | 'openai/gpt-4.1-batch' | 'openai/gpt-4.1-fast' | 'openai/gpt-4.1-mini' | 'openai/gpt-4.1-mini-batch' | 'openai/gpt-4.1-mini-fast' | 'openai/gpt-4.1-nano' | 'openai/gpt-4.1-nano-batch' | 'openai/gpt-4.1-nano-fast' | 'openai/gpt-4o' | 'openai/gpt-4o-batch' | 'openai/gpt-4o-fast' | 'openai/gpt-4o-mini' | 'openai/gpt-4o-mini-batch' | 'openai/gpt-4o-mini-fast' | 'openai/gpt-5' | 'openai/gpt-5-batch' | 'openai/gpt-5-codex' | 'openai/gpt-5-fast' | 'openai/gpt-5-mini' | 'openai/gpt-5-mini-batch' | 'openai/gpt-5-mini-fast' | 'openai/gpt-5-nano' | 'openai/gpt-5-nano-batch' | 'openai/gpt-5-pro' | 'openai/gpt-5-pro-batch' | 'openai/gpt-5.1-codex' | 'openai/gpt-5.1-codex-max' | 'openai/gpt-5.1-codex-mini' | 'openai/gpt-5.1-thinking' | 'openai/gpt-5.1-thinking-fast' | 'openai/gpt-5.2' | 'openai/gpt-5.2-batch' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-fast' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-codex' | 'openai/gpt-5.3-codex-fast' | 'openai/gpt-5.4' | 'openai/gpt-5.4-batch' | 'openai/gpt-5.4-fast' | 'openai/gpt-5.4-mini' | 'openai/gpt-5.4-mini-batch' | 'openai/gpt-5.4-mini-fast' | 'openai/gpt-5.4-nano' | 'openai/gpt-5.4-nano-batch' | 'openai/gpt-5.4-pro' | 'openai/gpt-5.5' | 'openai/gpt-5.5-batch' | 'openai/gpt-5.5-fast' | 'openai/gpt-5.5-pro' | 'openai/gpt-5.5-pro-batch' | 'openai/gpt-5.6-luna' | 'openai/gpt-5.6-luna-batch' | 'openai/gpt-5.6-luna-fast' | 'openai/gpt-5.6-sol' | 'openai/gpt-5.6-sol-batch' | 'openai/gpt-5.6-sol-fast' | 'openai/gpt-5.6-terra' | 'openai/gpt-5.6-terra-batch' | 'openai/gpt-5.6-terra-fast' | 'openai/gpt-6-astra' | 'openai/gpt-6-astra-batch' | 'openai/gpt-6-astra-fast' | 'openai/gpt-6-luna' | 'openai/gpt-6-luna-batch' | 'openai/gpt-6-luna-fast' | 'openai/gpt-6-sol' | 'openai/gpt-6-sol-batch' | 'openai/gpt-6-sol-fast' | 'openai/gpt-6.1-sol' | 'openai/gpt-6.1-sol-batch' | 'openai/gpt-6.1-sol-fast' | 'openai/gpt-oss-120b' | 'openai/gpt-oss-20b' | 'openai/gpt-oss-safeguard-120b' | 'openai/gpt-oss-safeguard-20b' | 'openai/o1' | 'openai/o3' | 'openai/o3-fast' | 'openai/o3-mini' | 'openai/o3-pro' | 'openai/o4-mini' | 'openai/o4-mini-fast' | 'perplexity/sonar' | 'poolside/laguna-s-2.1' | 'poolside/laguna-s-2.1-free' | 'quiverai/arrow-2' | 'quiverai/arrow-2-telos' | 'sakana/fugu-max' | 'sakana/fugu-ultra' | 'sakana/fugu-ultra-v2' | 'sakana/namazu' | 'spacexai/grok-4.1-fast-non-reasoning' | 'spacexai/grok-4.1-fast-reasoning' | 'spacexai/grok-4.20-multi-agent' | 'spacexai/grok-4.20-multi-agent-batch' | 'spacexai/grok-4.20-multi-agent-beta' | 'spacexai/grok-4.20-non-reasoning' | 'spacexai/grok-4.20-non-reasoning-batch' | 'spacexai/grok-4.20-non-reasoning-beta' | 'spacexai/grok-4.20-reasoning' | 'spacexai/grok-4.20-reasoning-batch' | 'spacexai/grok-4.20-reasoning-beta' | 'spacexai/grok-4.3' | 'spacexai/grok-4.3-batch' | 'spacexai/grok-4.5' | 'spacexai/grok-4.6' | 'spacexai/grok-4.7' | 'spacexai/grok-build-0.1' | 'stealth/glyph-cluster' | 'stepfun/step-3.7-flash' | 'stepfun/step-5-preview' | 'tencent/hy-mt2-lite' | 'tencent/hy-mt2-plus' | 'tencent/hy-mt2-pro' | 'tencent/hy3' | 'tencent/hy4-preview' | 'thinkingmachines/inkling' | 'thinkingmachines/inkling-small' | 'xiaomi/mimo-v2.5' | 'xiaomi/mimo-v2.5-pro' | 'xiaomi/mimo-v2.6-flash' | 'xiaomi/mimo-v2.6-pro' | 'xiaomi/mimo-v2.6-pro-ultraspeed' | 'zai/glm-4.5' | 'zai/glm-4.5-air' | 'zai/glm-4.5v' | 'zai/glm-4.6' | 'zai/glm-4.7' | 'zai/glm-4.7-flash' | 'zai/glm-4.7-flashx' | 'zai/glm-5' | 'zai/glm-5-turbo' | 'zai/glm-5.1' | 'zai/glm-5.2' | 'zai/glm-5.2-fast' | 'zai/glm-5.3' | 'zai/glm-5.3-fast' | 'zai/glm-5.3-flash' | 'zai/glm-5.3-flashx' | 'zai/glm-5v-turbo' | (string & {});
2380
2391
 
2381
2392
  declare interface GatewayProvider extends ProviderV2 {
2382
2393
  (modelId: GatewayModelId): LanguageModelV2;
@@ -2821,7 +2832,7 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTP
2821
2832
  /**
2822
2833
  Optional specification for parsing structured outputs from the LLM response.
2823
2834
  */
2824
- experimental_output?: Output_2<OUTPUT, OUTPUT_PARTIAL>;
2835
+ experimental_output?: OutputInterface<OUTPUT, OUTPUT_PARTIAL>;
2825
2836
  /**
2826
2837
  Custom download function to use for URLs.
2827
2838
 
@@ -3190,6 +3201,11 @@ declare type ImageModelV2 = {
3190
3201
  be returned as binary data.
3191
3202
  */
3192
3203
  images: Array<string> | Array<Uint8Array>;
3204
+ /**
3205
+ Whether an unsuccessful result, such as an empty image result, can be
3206
+ retried. When omitted, the result is unclassified.
3207
+ */
3208
+ isRetryable?: boolean;
3193
3209
  /**
3194
3210
  Warnings for the call, e.g. unsupported settings.
3195
3211
  */
@@ -3381,14 +3397,14 @@ export declare type InferUITools<TOOLS extends ToolSet> = {
3381
3397
  declare type InferValidator<SCHEMA> = SCHEMA extends StandardSchemaV1<unknown, infer T> ? T : SCHEMA extends LazyValidator<infer T> ? T : SCHEMA extends Validator<infer T> ? T : never;
3382
3398
 
3383
3399
  declare function injectJsonInstructionIntoMessages({ messages, schema, schemaPrefix, schemaSuffix, }: {
3384
- messages: LanguageModelV2Prompt_2;
3400
+ messages: LanguageModelV2Prompt;
3385
3401
  schema?: JSONSchema7;
3386
3402
  schemaPrefix?: string;
3387
3403
  schemaSuffix?: string;
3388
- }): LanguageModelV2Prompt_2;
3404
+ }): LanguageModelV2Prompt;
3389
3405
 
3390
3406
  export declare class InvalidArgumentError extends AISDKError {
3391
- private readonly [symbol$c_3];
3407
+ private readonly [symbol$d_2];
3392
3408
  readonly parameter: string;
3393
3409
  readonly value: unknown;
3394
3410
  constructor({ parameter, value, message, }: {
@@ -3450,7 +3466,7 @@ export declare class InvalidResponseDataError extends AISDKError {
3450
3466
  }
3451
3467
 
3452
3468
  export declare class InvalidStreamPartError extends AISDKError {
3453
- private readonly [symbol$b_2];
3469
+ private readonly [symbol$c_2];
3454
3470
  readonly chunk: SingleRequestTextStreamPart<any>;
3455
3471
  constructor({ chunk, message, }: {
3456
3472
  chunk: SingleRequestTextStreamPart<any>;
@@ -3460,7 +3476,7 @@ export declare class InvalidStreamPartError extends AISDKError {
3460
3476
  }
3461
3477
 
3462
3478
  export declare class InvalidToolInputError extends AISDKError {
3463
- private readonly [symbol$e];
3479
+ private readonly [symbol$f];
3464
3480
  readonly toolName: string;
3465
3481
  readonly toolInput: string;
3466
3482
  constructor({ toolInput, toolName, cause, message, }: {
@@ -3498,6 +3514,8 @@ export declare function isDataUIPart<DATA_TYPES extends UIDataTypes>(part: UIMes
3498
3514
  */
3499
3515
  export declare function isDeepEqualData(obj1: any, obj2: any): boolean;
3500
3516
 
3517
+ export declare function isDynamicToolUIPart(part: UIMessagePart<UIDataTypes, UITools>): part is DynamicToolUIPart;
3518
+
3501
3519
  /**
3502
3520
  * Type guard to check if a message part is a file part.
3503
3521
  */
@@ -3556,16 +3574,10 @@ declare type Job = () => Promise<void>;
3556
3574
 
3557
3575
  declare type JSONArray = JSONValue_2[];
3558
3576
 
3559
- declare type JSONArray_2 = JSONValue_3[];
3560
-
3561
3577
  declare type JSONObject = {
3562
3578
  [key: string]: JSONValue_2;
3563
3579
  };
3564
3580
 
3565
- declare type JSONObject_2 = {
3566
- [key: string]: JSONValue_3;
3567
- };
3568
-
3569
3581
  export declare class JSONParseError extends AISDKError {
3570
3582
  private readonly [symbol$7];
3571
3583
  readonly text: string;
@@ -3576,16 +3588,6 @@ export declare class JSONParseError extends AISDKError {
3576
3588
  static isInstance(error: unknown): error is JSONParseError;
3577
3589
  }
3578
3590
 
3579
- declare class JSONParseError_2 extends AISDKError_2 {
3580
- private readonly [symbol$7_2];
3581
- readonly text: string;
3582
- constructor({ text, cause }: {
3583
- text: string;
3584
- cause: unknown;
3585
- });
3586
- static isInstance(error: unknown): error is JSONParseError_2;
3587
- }
3588
-
3589
3591
  /**
3590
3592
  * Create a schema using a JSON Schema.
3591
3593
  *
@@ -3610,12 +3612,6 @@ export declare type JSONValue = JSONValue_2;
3610
3612
  */
3611
3613
  declare type JSONValue_2 = null | string | number | boolean | JSONObject | JSONArray;
3612
3614
 
3613
- /**
3614
- A JSON value can be a string, number, boolean, object, array, or null.
3615
- JSON values can be serialized and deserialized by the JSON.stringify and JSON.parse methods.
3616
- */
3617
- declare type JSONValue_3 = null | string | number | boolean | JSONObject_2 | JSONArray_2;
3618
-
3619
3615
  declare const KNOWN_MODEL_TYPES: readonly ["embedding", "image", "language"];
3620
3616
 
3621
3617
  declare type KnownModelType = (typeof KNOWN_MODEL_TYPES)[number];
@@ -3871,107 +3867,6 @@ declare type LanguageModelV2CallOptions = {
3871
3867
  providerOptions?: SharedV2ProviderOptions;
3872
3868
  };
3873
3869
 
3874
- declare type LanguageModelV2CallOptions_2 = {
3875
- /**
3876
- A language mode prompt is a standardized prompt type.
3877
-
3878
- Note: This is **not** the user-facing prompt. The AI SDK methods will map the
3879
- user-facing prompt types such as chat or instruction prompts to this format.
3880
- That approach allows us to evolve the user facing prompts without breaking
3881
- the language model interface.
3882
- */
3883
- prompt: LanguageModelV2Prompt_2;
3884
- /**
3885
- Maximum number of tokens to generate.
3886
- */
3887
- maxOutputTokens?: number;
3888
- /**
3889
- Temperature setting. The range depends on the provider and model.
3890
- */
3891
- temperature?: number;
3892
- /**
3893
- Stop sequences.
3894
- If set, the model will stop generating text when one of the stop sequences is generated.
3895
- Providers may have limits on the number of stop sequences.
3896
- */
3897
- stopSequences?: string[];
3898
- /**
3899
- Nucleus sampling.
3900
- */
3901
- topP?: number;
3902
- /**
3903
- Only sample from the top K options for each subsequent token.
3904
-
3905
- Used to remove "long tail" low probability responses.
3906
- Recommended for advanced use cases only. You usually only need to use temperature.
3907
- */
3908
- topK?: number;
3909
- /**
3910
- Presence penalty setting. It affects the likelihood of the model to
3911
- repeat information that is already in the prompt.
3912
- */
3913
- presencePenalty?: number;
3914
- /**
3915
- Frequency penalty setting. It affects the likelihood of the model
3916
- to repeatedly use the same words or phrases.
3917
- */
3918
- frequencyPenalty?: number;
3919
- /**
3920
- Response format. The output can either be text or JSON. Default is text.
3921
-
3922
- If JSON is selected, a schema can optionally be provided to guide the LLM.
3923
- */
3924
- responseFormat?: {
3925
- type: 'text';
3926
- } | {
3927
- type: 'json';
3928
- /**
3929
- * JSON schema that the generated output should conform to.
3930
- */
3931
- schema?: JSONSchema7;
3932
- /**
3933
- * Name of output that should be generated. Used by some providers for additional LLM guidance.
3934
- */
3935
- name?: string;
3936
- /**
3937
- * Description of the output that should be generated. Used by some providers for additional LLM guidance.
3938
- */
3939
- description?: string;
3940
- };
3941
- /**
3942
- The seed (integer) to use for random sampling. If set and supported
3943
- by the model, calls will generate deterministic results.
3944
- */
3945
- seed?: number;
3946
- /**
3947
- The tools that are available for the model.
3948
- */
3949
- tools?: Array<LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2>;
3950
- /**
3951
- Specifies how the tool should be selected. Defaults to 'auto'.
3952
- */
3953
- toolChoice?: LanguageModelV2ToolChoice_2;
3954
- /**
3955
- Include raw chunks in the stream. Only applicable for streaming calls.
3956
- */
3957
- includeRawChunks?: boolean;
3958
- /**
3959
- Abort signal for cancelling the operation.
3960
- */
3961
- abortSignal?: AbortSignal;
3962
- /**
3963
- Additional HTTP headers to be sent with the request.
3964
- Only applicable for HTTP-based providers.
3965
- */
3966
- headers?: Record<string, string | undefined>;
3967
- /**
3968
- * Additional provider-specific options. They are passed through
3969
- * to the provider from the AI SDK and enable provider-specific
3970
- * functionality that can be fully encapsulated in the provider.
3971
- */
3972
- providerOptions?: SharedV2ProviderOptions_2;
3973
- };
3974
-
3975
3870
  /**
3976
3871
  Warning from the model provider for this call. The call will proceed, but e.g.
3977
3872
  some settings might not be supported, which can lead to suboptimal results.
@@ -3989,23 +3884,6 @@ declare type LanguageModelV2CallWarning = {
3989
3884
  message: string;
3990
3885
  };
3991
3886
 
3992
- /**
3993
- Warning from the model provider for this call. The call will proceed, but e.g.
3994
- some settings might not be supported, which can lead to suboptimal results.
3995
- */
3996
- declare type LanguageModelV2CallWarning_2 = {
3997
- type: 'unsupported-setting';
3998
- setting: Omit<keyof LanguageModelV2CallOptions_2, 'prompt'>;
3999
- details?: string;
4000
- } | {
4001
- type: 'unsupported-tool';
4002
- tool: LanguageModelV2FunctionTool_2 | LanguageModelV2ProviderDefinedTool_2;
4003
- details?: string;
4004
- } | {
4005
- type: 'other';
4006
- message: string;
4007
- };
4008
-
4009
3887
  declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reasoning | LanguageModelV2File | LanguageModelV2Source | LanguageModelV2ToolCall | LanguageModelV2ToolResult;
4010
3888
 
4011
3889
  /**
@@ -4013,11 +3891,6 @@ declare type LanguageModelV2Content = LanguageModelV2Text | LanguageModelV2Reaso
4013
3891
  */
4014
3892
  declare type LanguageModelV2DataContent = Uint8Array | string | URL;
4015
3893
 
4016
- /**
4017
- Data content. Can be a Uint8Array, base64 encoded data as a string or a URL.
4018
- */
4019
- declare type LanguageModelV2DataContent_2 = Uint8Array | string | URL;
4020
-
4021
3894
  /**
4022
3895
  A file that has been generated by the model.
4023
3896
  Generated files as base64 encoded strings or binary data.
@@ -4042,30 +3915,6 @@ declare type LanguageModelV2File = {
4042
3915
  data: string | Uint8Array;
4043
3916
  };
4044
3917
 
4045
- /**
4046
- A file that has been generated by the model.
4047
- Generated files as base64 encoded strings or binary data.
4048
- The files should be returned without any unnecessary conversion.
4049
- */
4050
- declare type LanguageModelV2File_2 = {
4051
- type: 'file';
4052
- /**
4053
- The IANA media type of the file, e.g. `image/png` or `audio/mp3`.
4054
-
4055
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4056
- */
4057
- mediaType: string;
4058
- /**
4059
- Generated file data as base64 encoded strings or binary data.
4060
-
4061
- The file data should be returned without any unnecessary conversion.
4062
- If the API returns base64 encoded strings, the file data should be returned
4063
- as base64 encoded strings. If the API returns binary data, the file data should
4064
- be returned as binary data.
4065
- */
4066
- data: string | Uint8Array;
4067
- };
4068
-
4069
3918
  /**
4070
3919
  File content part of a prompt. It contains a file.
4071
3920
  */
@@ -4079,6 +3928,13 @@ declare interface LanguageModelV2FilePart {
4079
3928
  File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4080
3929
  */
4081
3930
  data: LanguageModelV2DataContent;
3931
+ /**
3932
+ * The original URL string before it was parsed into a `URL`.
3933
+ *
3934
+ * This is available when parsing would change the string and a provider
3935
+ * needs to preserve an opaque non-HTTP URI exactly.
3936
+ */
3937
+ originalUrl?: string;
4082
3938
  /**
4083
3939
  IANA media type of the file.
4084
3940
 
@@ -4096,69 +3952,19 @@ declare interface LanguageModelV2FilePart {
4096
3952
  }
4097
3953
 
4098
3954
  /**
4099
- File content part of a prompt. It contains a file.
4100
- */
4101
- declare interface LanguageModelV2FilePart_2 {
4102
- type: 'file';
4103
- /**
4104
- * Optional filename of the file.
4105
- */
4106
- filename?: string;
4107
- /**
4108
- File data. Can be a Uint8Array, base64 encoded data as a string or a URL.
4109
- */
4110
- data: LanguageModelV2DataContent_2;
4111
- /**
4112
- * The original URL string before it was parsed into a `URL`.
4113
- *
4114
- * This is available when parsing would change the string and a provider
4115
- * needs to preserve an opaque non-HTTP URI exactly.
4116
- */
4117
- originalUrl?: string;
4118
- /**
4119
- IANA media type of the file.
4120
-
4121
- Can support wildcards, e.g. `image/*` (in which case the provider needs to take appropriate action).
4122
-
4123
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
4124
- */
4125
- mediaType: string;
4126
- /**
4127
- * Additional provider-specific options. They are passed through
4128
- * to the provider from the AI SDK and enable provider-specific
4129
- * functionality that can be fully encapsulated in the provider.
4130
- */
4131
- providerOptions?: SharedV2ProviderOptions_2;
4132
- }
4133
-
4134
- /**
4135
- Reason why a language model finished generating a response.
4136
-
4137
- Can be one of the following:
4138
- - `stop`: model generated stop sequence
4139
- - `length`: model generated maximum number of tokens
4140
- - `content-filter`: content filter violation stopped the model
4141
- - `tool-calls`: model triggered tool calls
4142
- - `error`: model stopped because of an error
4143
- - `other`: model stopped for other reasons
4144
- - `unknown`: the model has not transmitted a finish reason
3955
+ Reason why a language model finished generating a response.
3956
+
3957
+ Can be one of the following:
3958
+ - `stop`: model generated stop sequence
3959
+ - `length`: model generated maximum number of tokens
3960
+ - `content-filter`: content filter violation stopped the model
3961
+ - `tool-calls`: model triggered tool calls
3962
+ - `error`: model stopped because of an error
3963
+ - `other`: model stopped for other reasons
3964
+ - `unknown`: the model has not transmitted a finish reason
4145
3965
  */
4146
3966
  declare type LanguageModelV2FinishReason = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4147
3967
 
4148
- /**
4149
- Reason why a language model finished generating a response.
4150
-
4151
- Can be one of the following:
4152
- - `stop`: model generated stop sequence
4153
- - `length`: model generated maximum number of tokens
4154
- - `content-filter`: content filter violation stopped the model
4155
- - `tool-calls`: model triggered tool calls
4156
- - `error`: model stopped because of an error
4157
- - `other`: model stopped for other reasons
4158
- - `unknown`: the model has not transmitted a finish reason
4159
- */
4160
- declare type LanguageModelV2FinishReason_2 = 'stop' | 'length' | 'content-filter' | 'tool-calls' | 'error' | 'other' | 'unknown';
4161
-
4162
3968
  /**
4163
3969
  A tool has a name, a description, and a set of parameters.
4164
3970
 
@@ -4190,37 +3996,6 @@ declare type LanguageModelV2FunctionTool = {
4190
3996
  providerOptions?: SharedV2ProviderOptions;
4191
3997
  };
4192
3998
 
4193
- /**
4194
- A tool has a name, a description, and a set of parameters.
4195
-
4196
- Note: this is **not** the user-facing tool definition. The AI SDK methods will
4197
- map the user-facing tool definitions to this format.
4198
- */
4199
- declare type LanguageModelV2FunctionTool_2 = {
4200
- /**
4201
- The type of the tool (always 'function').
4202
- */
4203
- type: 'function';
4204
- /**
4205
- The name of the tool. Unique within this model call.
4206
- */
4207
- name: string;
4208
- /**
4209
- A description of the tool. The language model uses this to understand the
4210
- tool's purpose and to provide better completion suggestions.
4211
- */
4212
- description?: string;
4213
- /**
4214
- The parameters that the tool expects. The language model uses this to
4215
- understand the tool's input requirements and to provide matching suggestions.
4216
- */
4217
- inputSchema: JSONSchema7;
4218
- /**
4219
- The provider-specific options for the tool.
4220
- */
4221
- providerOptions?: SharedV2ProviderOptions_2;
4222
- };
4223
-
4224
3999
  declare type LanguageModelV2Message = ({
4225
4000
  role: 'system';
4226
4001
  content: string;
@@ -4242,27 +4017,6 @@ declare type LanguageModelV2Message = ({
4242
4017
  providerOptions?: SharedV2ProviderOptions;
4243
4018
  };
4244
4019
 
4245
- declare type LanguageModelV2Message_2 = ({
4246
- role: 'system';
4247
- content: string;
4248
- } | {
4249
- role: 'user';
4250
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2>;
4251
- } | {
4252
- role: 'assistant';
4253
- content: Array<LanguageModelV2TextPart_2 | LanguageModelV2FilePart_2 | LanguageModelV2ReasoningPart_2 | LanguageModelV2ToolCallPart_2 | LanguageModelV2ToolResultPart_2>;
4254
- } | {
4255
- role: 'tool';
4256
- content: Array<LanguageModelV2ToolResultPart_2>;
4257
- }) & {
4258
- /**
4259
- * Additional provider-specific options. They are passed through
4260
- * to the provider from the AI SDK and enable provider-specific
4261
- * functionality that can be fully encapsulated in the provider.
4262
- */
4263
- providerOptions?: SharedV2ProviderOptions_2;
4264
- };
4265
-
4266
4020
  /**
4267
4021
  * Experimental middleware for LanguageModelV2.
4268
4022
  * This type defines the structure for middleware that can be used to modify
@@ -4352,17 +4106,6 @@ declare type LanguageModelV2Middleware = {
4352
4106
  */
4353
4107
  declare type LanguageModelV2Prompt = Array<LanguageModelV2Message>;
4354
4108
 
4355
- /**
4356
- A prompt is a list of messages.
4357
-
4358
- Note: Not all models and prompt formats support multi-modal inputs and
4359
- tool calls. The validation happens at runtime.
4360
-
4361
- Note: This is not a user-facing prompt. The AI SDK methods will map the
4362
- user-facing prompt types such as chat or instruction prompts to this format.
4363
- */
4364
- declare type LanguageModelV2Prompt_2 = Array<LanguageModelV2Message_2>;
4365
-
4366
4109
  /**
4367
4110
  The configuration of a tool that is defined by the provider.
4368
4111
  */
@@ -4385,28 +4128,6 @@ declare type LanguageModelV2ProviderDefinedTool = {
4385
4128
  args: Record<string, unknown>;
4386
4129
  };
4387
4130
 
4388
- /**
4389
- The configuration of a tool that is defined by the provider.
4390
- */
4391
- declare type LanguageModelV2ProviderDefinedTool_2 = {
4392
- /**
4393
- The type of the tool (always 'provider-defined').
4394
- */
4395
- type: 'provider-defined';
4396
- /**
4397
- The ID of the tool. Should follow the format `<provider-name>.<unique-tool-name>`.
4398
- */
4399
- id: `${string}.${string}`;
4400
- /**
4401
- The name of the tool that the user must use in the tool set.
4402
- */
4403
- name: string;
4404
- /**
4405
- The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
4406
- */
4407
- args: Record<string, unknown>;
4408
- };
4409
-
4410
4131
  /**
4411
4132
  Reasoning that the model has generated.
4412
4133
  */
@@ -4436,23 +4157,6 @@ declare interface LanguageModelV2ReasoningPart {
4436
4157
  providerOptions?: SharedV2ProviderOptions;
4437
4158
  }
4438
4159
 
4439
- /**
4440
- Reasoning content part of a prompt. It contains a string of reasoning text.
4441
- */
4442
- declare interface LanguageModelV2ReasoningPart_2 {
4443
- type: 'reasoning';
4444
- /**
4445
- The reasoning text.
4446
- */
4447
- text: string;
4448
- /**
4449
- * Additional provider-specific options. They are passed through
4450
- * to the provider from the AI SDK and enable provider-specific
4451
- * functionality that can be fully encapsulated in the provider.
4452
- */
4453
- providerOptions?: SharedV2ProviderOptions_2;
4454
- }
4455
-
4456
4160
  declare interface LanguageModelV2ResponseMetadata {
4457
4161
  /**
4458
4162
  ID for the generated response, if the provider sends one.
@@ -4468,21 +4172,6 @@ declare interface LanguageModelV2ResponseMetadata {
4468
4172
  modelId?: string;
4469
4173
  }
4470
4174
 
4471
- declare interface LanguageModelV2ResponseMetadata_2 {
4472
- /**
4473
- ID for the generated response, if the provider sends one.
4474
- */
4475
- id?: string;
4476
- /**
4477
- Timestamp for the start of the generated response, if the provider sends one.
4478
- */
4479
- timestamp?: Date;
4480
- /**
4481
- The ID of the response model that was used to generate the response, if the provider sends one.
4482
- */
4483
- modelId?: string;
4484
- }
4485
-
4486
4175
  /**
4487
4176
  A source that has been used as input to generate the response.
4488
4177
  */
@@ -4536,59 +4225,6 @@ declare type LanguageModelV2Source = {
4536
4225
  providerMetadata?: SharedV2ProviderMetadata;
4537
4226
  };
4538
4227
 
4539
- /**
4540
- A source that has been used as input to generate the response.
4541
- */
4542
- declare type LanguageModelV2Source_2 = {
4543
- type: 'source';
4544
- /**
4545
- * The type of source - URL sources reference web content.
4546
- */
4547
- sourceType: 'url';
4548
- /**
4549
- * The ID of the source.
4550
- */
4551
- id: string;
4552
- /**
4553
- * The URL of the source.
4554
- */
4555
- url: string;
4556
- /**
4557
- * The title of the source.
4558
- */
4559
- title?: string;
4560
- /**
4561
- * Additional provider metadata for the source.
4562
- */
4563
- providerMetadata?: SharedV2ProviderMetadata_2;
4564
- } | {
4565
- type: 'source';
4566
- /**
4567
- * The type of source - document sources reference files/documents.
4568
- */
4569
- sourceType: 'document';
4570
- /**
4571
- * The ID of the source.
4572
- */
4573
- id: string;
4574
- /**
4575
- * IANA media type of the document (e.g., 'application/pdf').
4576
- */
4577
- mediaType: string;
4578
- /**
4579
- * The title of the document.
4580
- */
4581
- title: string;
4582
- /**
4583
- * Optional filename of the document.
4584
- */
4585
- filename?: string;
4586
- /**
4587
- * Additional provider metadata for the source.
4588
- */
4589
- providerMetadata?: SharedV2ProviderMetadata_2;
4590
- };
4591
-
4592
4228
  declare type LanguageModelV2StreamPart = {
4593
4229
  type: 'text-start';
4594
4230
  providerMetadata?: SharedV2ProviderMetadata;
@@ -4648,65 +4284,6 @@ declare type LanguageModelV2StreamPart = {
4648
4284
  error: unknown;
4649
4285
  };
4650
4286
 
4651
- declare type LanguageModelV2StreamPart_2 = {
4652
- type: 'text-start';
4653
- providerMetadata?: SharedV2ProviderMetadata_2;
4654
- id: string;
4655
- } | {
4656
- type: 'text-delta';
4657
- id: string;
4658
- providerMetadata?: SharedV2ProviderMetadata_2;
4659
- delta: string;
4660
- } | {
4661
- type: 'text-end';
4662
- providerMetadata?: SharedV2ProviderMetadata_2;
4663
- id: string;
4664
- } | {
4665
- type: 'reasoning-start';
4666
- providerMetadata?: SharedV2ProviderMetadata_2;
4667
- id: string;
4668
- } | {
4669
- type: 'reasoning-delta';
4670
- id: string;
4671
- providerMetadata?: SharedV2ProviderMetadata_2;
4672
- delta: string;
4673
- } | {
4674
- type: 'reasoning-end';
4675
- id: string;
4676
- providerMetadata?: SharedV2ProviderMetadata_2;
4677
- } | {
4678
- type: 'tool-input-start';
4679
- id: string;
4680
- toolName: string;
4681
- providerMetadata?: SharedV2ProviderMetadata_2;
4682
- providerExecuted?: boolean;
4683
- } | {
4684
- type: 'tool-input-delta';
4685
- id: string;
4686
- delta: string;
4687
- providerMetadata?: SharedV2ProviderMetadata_2;
4688
- } | {
4689
- type: 'tool-input-end';
4690
- id: string;
4691
- providerMetadata?: SharedV2ProviderMetadata_2;
4692
- } | LanguageModelV2ToolCall_2 | LanguageModelV2ToolResult_2 | LanguageModelV2File_2 | LanguageModelV2Source_2 | {
4693
- type: 'stream-start';
4694
- warnings: Array<LanguageModelV2CallWarning_2>;
4695
- } | ({
4696
- type: 'response-metadata';
4697
- } & LanguageModelV2ResponseMetadata_2) | {
4698
- type: 'finish';
4699
- usage: LanguageModelV2Usage_2;
4700
- finishReason: LanguageModelV2FinishReason_2;
4701
- providerMetadata?: SharedV2ProviderMetadata_2;
4702
- } | {
4703
- type: 'raw';
4704
- rawValue: unknown;
4705
- } | {
4706
- type: 'error';
4707
- error: unknown;
4708
- };
4709
-
4710
4287
  /**
4711
4288
  Text that the model has generated.
4712
4289
  */
@@ -4736,23 +4313,6 @@ declare interface LanguageModelV2TextPart {
4736
4313
  providerOptions?: SharedV2ProviderOptions;
4737
4314
  }
4738
4315
 
4739
- /**
4740
- Text content part of a prompt. It contains a string of text.
4741
- */
4742
- declare interface LanguageModelV2TextPart_2 {
4743
- type: 'text';
4744
- /**
4745
- The text content.
4746
- */
4747
- text: string;
4748
- /**
4749
- * Additional provider-specific options. They are passed through
4750
- * to the provider from the AI SDK and enable provider-specific
4751
- * functionality that can be fully encapsulated in the provider.
4752
- */
4753
- providerOptions?: SharedV2ProviderOptions_2;
4754
- }
4755
-
4756
4316
  /**
4757
4317
  * Tool calls that the model has generated.
4758
4318
  */
@@ -4782,35 +4342,6 @@ declare type LanguageModelV2ToolCall = {
4782
4342
  providerMetadata?: SharedV2ProviderMetadata;
4783
4343
  };
4784
4344
 
4785
- /**
4786
- * Tool calls that the model has generated.
4787
- */
4788
- declare type LanguageModelV2ToolCall_2 = {
4789
- type: 'tool-call';
4790
- /**
4791
- * The identifier of the tool call. It must be unique across all tool calls.
4792
- */
4793
- toolCallId: string;
4794
- /**
4795
- * The name of the tool that should be called.
4796
- */
4797
- toolName: string;
4798
- /**
4799
- * Stringified JSON object with the tool call arguments. Must match the
4800
- * parameters schema of the tool.
4801
- */
4802
- input: string;
4803
- /**
4804
- * Whether the tool call will be executed by the provider.
4805
- * If this flag is not set or is false, the tool call will be executed by the client.
4806
- */
4807
- providerExecuted?: boolean;
4808
- /**
4809
- * Additional provider-specific metadata for the tool call.
4810
- */
4811
- providerMetadata?: SharedV2ProviderMetadata_2;
4812
- };
4813
-
4814
4345
  /**
4815
4346
  Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
4816
4347
  */
@@ -4825,111 +4356,37 @@ declare interface LanguageModelV2ToolCallPart {
4825
4356
  */
4826
4357
  toolName: string;
4827
4358
  /**
4828
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
4829
- */
4830
- input: unknown;
4831
- /**
4832
- * Whether the tool call will be executed by the provider.
4833
- * If this flag is not set or is false, the tool call will be executed by the client.
4834
- */
4835
- providerExecuted?: boolean;
4836
- /**
4837
- * Additional provider-specific options. They are passed through
4838
- * to the provider from the AI SDK and enable provider-specific
4839
- * functionality that can be fully encapsulated in the provider.
4840
- */
4841
- providerOptions?: SharedV2ProviderOptions;
4842
- }
4843
-
4844
- /**
4845
- Tool call content part of a prompt. It contains a tool call (usually generated by the AI model).
4846
- */
4847
- declare interface LanguageModelV2ToolCallPart_2 {
4848
- type: 'tool-call';
4849
- /**
4850
- ID of the tool call. This ID is used to match the tool call with the tool result.
4851
- */
4852
- toolCallId: string;
4853
- /**
4854
- Name of the tool that is being called.
4855
- */
4856
- toolName: string;
4857
- /**
4858
- Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
4859
- */
4860
- input: unknown;
4861
- /**
4862
- * Whether the tool call will be executed by the provider.
4863
- * If this flag is not set or is false, the tool call will be executed by the client.
4864
- */
4865
- providerExecuted?: boolean;
4866
- /**
4867
- * Additional provider-specific options. They are passed through
4868
- * to the provider from the AI SDK and enable provider-specific
4869
- * functionality that can be fully encapsulated in the provider.
4870
- */
4871
- providerOptions?: SharedV2ProviderOptions_2;
4872
- }
4873
-
4874
- declare type LanguageModelV2ToolChoice = {
4875
- type: 'auto';
4876
- } | {
4877
- type: 'none';
4878
- } | {
4879
- type: 'required';
4880
- } | {
4881
- type: 'tool';
4882
- toolName: string;
4883
- };
4884
-
4885
- declare type LanguageModelV2ToolChoice_2 = {
4886
- type: 'auto';
4887
- } | {
4888
- type: 'none';
4889
- } | {
4890
- type: 'required';
4891
- } | {
4892
- type: 'tool';
4893
- toolName: string;
4894
- };
4895
-
4896
- /**
4897
- Result of a tool call that has been executed by the provider.
4898
- */
4899
- declare type LanguageModelV2ToolResult = {
4900
- type: 'tool-result';
4901
- /**
4902
- * The ID of the tool call that this result is associated with.
4903
- */
4904
- toolCallId: string;
4905
- /**
4906
- * Name of the tool that generated this result.
4907
- */
4908
- toolName: string;
4909
- /**
4910
- * Result of the tool call. This is a JSON-serializable object.
4911
- */
4912
- result: unknown;
4913
- /**
4914
- * Optional flag if the result is an error or an error message.
4359
+ Arguments of the tool call. This is a JSON-serializable object that matches the tool's input schema.
4915
4360
  */
4916
- isError?: boolean;
4361
+ input: unknown;
4917
4362
  /**
4918
- * Whether the tool result was generated by the provider.
4919
- * If this flag is set to true, the tool result was generated by the provider.
4920
- * If this flag is not set or is false, the tool result was generated by the client.
4363
+ * Whether the tool call will be executed by the provider.
4364
+ * If this flag is not set or is false, the tool call will be executed by the client.
4921
4365
  */
4922
4366
  providerExecuted?: boolean;
4923
4367
  /**
4924
- * Additional provider-specific metadata for the tool result.
4368
+ * Additional provider-specific options. They are passed through
4369
+ * to the provider from the AI SDK and enable provider-specific
4370
+ * functionality that can be fully encapsulated in the provider.
4925
4371
  */
4926
- providerMetadata?: SharedV2ProviderMetadata;
4372
+ providerOptions?: SharedV2ProviderOptions;
4373
+ }
4374
+
4375
+ declare type LanguageModelV2ToolChoice = {
4376
+ type: 'auto';
4377
+ } | {
4378
+ type: 'none';
4379
+ } | {
4380
+ type: 'required';
4381
+ } | {
4382
+ type: 'tool';
4383
+ toolName: string;
4927
4384
  };
4928
4385
 
4929
4386
  /**
4930
4387
  Result of a tool call that has been executed by the provider.
4931
4388
  */
4932
- declare type LanguageModelV2ToolResult_2 = {
4389
+ declare type LanguageModelV2ToolResult = {
4933
4390
  type: 'tool-result';
4934
4391
  /**
4935
4392
  * The ID of the tool call that this result is associated with.
@@ -4956,7 +4413,7 @@ declare type LanguageModelV2ToolResult_2 = {
4956
4413
  /**
4957
4414
  * Additional provider-specific metadata for the tool result.
4958
4415
  */
4959
- providerMetadata?: SharedV2ProviderMetadata_2;
4416
+ providerMetadata?: SharedV2ProviderMetadata;
4960
4417
  };
4961
4418
 
4962
4419
  declare type LanguageModelV2ToolResultOutput = {
@@ -4993,40 +4450,6 @@ declare type LanguageModelV2ToolResultOutput = {
4993
4450
  }>;
4994
4451
  };
4995
4452
 
4996
- declare type LanguageModelV2ToolResultOutput_2 = {
4997
- type: 'text';
4998
- value: string;
4999
- } | {
5000
- type: 'json';
5001
- value: JSONValue_3;
5002
- } | {
5003
- type: 'error-text';
5004
- value: string;
5005
- } | {
5006
- type: 'error-json';
5007
- value: JSONValue_3;
5008
- } | {
5009
- type: 'content';
5010
- value: Array<{
5011
- type: 'text';
5012
- /**
5013
- Text content.
5014
- */
5015
- text: string;
5016
- } | {
5017
- type: 'media';
5018
- /**
5019
- Base-64 encoded media data.
5020
- */
5021
- data: string;
5022
- /**
5023
- IANA media type.
5024
- @see https://www.iana.org/assignments/media-types/media-types.xhtml
5025
- */
5026
- mediaType: string;
5027
- }>;
5028
- };
5029
-
5030
4453
  /**
5031
4454
  Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5032
4455
  */
@@ -5052,31 +4475,6 @@ declare interface LanguageModelV2ToolResultPart {
5052
4475
  providerOptions?: SharedV2ProviderOptions;
5053
4476
  }
5054
4477
 
5055
- /**
5056
- Tool result content part of a prompt. It contains the result of the tool call with the matching ID.
5057
- */
5058
- declare interface LanguageModelV2ToolResultPart_2 {
5059
- type: 'tool-result';
5060
- /**
5061
- ID of the tool call that this result is associated with.
5062
- */
5063
- toolCallId: string;
5064
- /**
5065
- Name of the tool that generated this result.
5066
- */
5067
- toolName: string;
5068
- /**
5069
- Result of the tool call.
5070
- */
5071
- output: LanguageModelV2ToolResultOutput_2;
5072
- /**
5073
- * Additional provider-specific options. They are passed through
5074
- * to the provider from the AI SDK and enable provider-specific
5075
- * functionality that can be fully encapsulated in the provider.
5076
- */
5077
- providerOptions?: SharedV2ProviderOptions_2;
5078
- }
5079
-
5080
4478
  /**
5081
4479
  Usage information for a language model call.
5082
4480
 
@@ -5109,40 +4507,11 @@ declare type LanguageModelV2Usage = {
5109
4507
  };
5110
4508
 
5111
4509
  /**
5112
- Usage information for a language model call.
5113
-
5114
- If your API return additional usage information, you can add it to the
5115
- provider metadata under your provider's key.
5116
- */
5117
- declare type LanguageModelV2Usage_2 = {
5118
- /**
5119
- The number of input (prompt) tokens used.
5120
- */
5121
- inputTokens: number | undefined;
5122
- /**
5123
- The number of output (completion) tokens used.
5124
- */
5125
- outputTokens: number | undefined;
5126
- /**
5127
- The total number of tokens as reported by the provider.
5128
- This number might be different from the sum of `inputTokens` and `outputTokens`
5129
- and e.g. include reasoning tokens or other overhead.
5130
- */
5131
- totalTokens: number | undefined;
5132
- /**
5133
- The number of reasoning tokens used.
5134
- */
5135
- reasoningTokens?: number | undefined;
5136
- /**
5137
- The number of cached input tokens.
5138
- */
5139
- cachedInputTokens?: number | undefined;
5140
- };
5141
-
5142
- /**
5143
- Check if the message is an assistant message with completed tool calls.
5144
- The last step of the message must have at least one tool invocation and
5145
- all tool invocations must have a result.
4510
+ * Check if the last message is an assistant message with completed tool calls.
4511
+ * The last step of the message must have at least one tool invocation and
4512
+ * all tool invocations must have a result. Completed model text may follow
4513
+ * the tool invocation because client-side tool results update parts in place,
4514
+ * but trailing text without a completed stream state prevents resubmission.
5146
4515
  */
5147
4516
  export declare function lastAssistantMessageIsCompleteWithToolCalls({ messages, }: {
5148
4517
  messages: UIMessage[];
@@ -5298,7 +4667,7 @@ export declare class NoContentGeneratedError extends AISDKError {
5298
4667
  - The model generated a response that could not be parsed.
5299
4668
  */
5300
4669
  export declare class NoImageGeneratedError extends AISDKError {
5301
- private readonly [symbol$a];
4670
+ private readonly [symbol$b_2];
5302
4671
  /**
5303
4672
  The response metadata for each call.
5304
4673
  */
@@ -5323,7 +4692,7 @@ export declare class NoImageGeneratedError extends AISDKError {
5323
4692
  - `text`: The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
5324
4693
  */
5325
4694
  export declare class NoObjectGeneratedError extends AISDKError {
5326
- private readonly [symbol$9_2];
4695
+ private readonly [symbol$a];
5327
4696
  /**
5328
4697
  The text that was generated by the model. This can be the raw text or the tool call text, depending on the model.
5329
4698
  */
@@ -5355,7 +4724,7 @@ export declare class NoObjectGeneratedError extends AISDKError {
5355
4724
  Thrown when no LLM output was generated, e.g. because of errors.
5356
4725
  */
5357
4726
  export declare class NoOutputGeneratedError extends AISDKError {
5358
- private readonly [symbol$8_2];
4727
+ private readonly [symbol$9_2];
5359
4728
  constructor({ message, cause, }?: {
5360
4729
  message?: string;
5361
4730
  cause?: Error;
@@ -5367,7 +4736,7 @@ export declare class NoOutputGeneratedError extends AISDKError {
5367
4736
  Thrown when no output type is specified and output-related methods are called.
5368
4737
  */
5369
4738
  export declare class NoOutputSpecifiedError extends AISDKError {
5370
- private readonly [symbol$7_3];
4739
+ private readonly [symbol$8_2];
5371
4740
  constructor({ message }?: {
5372
4741
  message?: string;
5373
4742
  });
@@ -5421,7 +4790,7 @@ export declare class NoSuchProviderError extends NoSuchModelError {
5421
4790
  }
5422
4791
 
5423
4792
  export declare class NoSuchToolError extends AISDKError {
5424
- private readonly [symbol$d_3];
4793
+ private readonly [symbol$e];
5425
4794
  readonly toolName: string;
5426
4795
  readonly availableTools: string[] | undefined;
5427
4796
  constructor({ toolName, availableTools, message, }: {
@@ -5457,7 +4826,7 @@ export declare namespace Output {
5457
4826
  };
5458
4827
  }
5459
4828
 
5460
- declare interface Output_2<OUTPUT, PARTIAL> {
4829
+ export declare interface OutputInterface<OUTPUT, PARTIAL> {
5461
4830
  readonly type: 'object' | 'text';
5462
4831
  responseFormat: LanguageModelV2CallOptions['responseFormat'];
5463
4832
  parsePartial(options: {
@@ -5625,7 +4994,7 @@ declare const parallelSearchToolFactory: _ai_sdk_provider_utils.ProviderDefinedT
5625
4994
  declare function parseJSON(options: {
5626
4995
  text: string;
5627
4996
  schema?: undefined;
5628
- }): Promise<JSONValue_3>;
4997
+ }): Promise<JSONValue_2>;
5629
4998
 
5630
4999
  /**
5631
5000
  * Parses a JSON string into a strongly-typed object using the provided schema.
@@ -5665,7 +5034,7 @@ declare type ParseResult<T> = {
5665
5034
  rawValue: unknown;
5666
5035
  } | {
5667
5036
  success: false;
5668
- error: JSONParseError_2 | TypeValidationError_2;
5037
+ error: JSONParseError | TypeValidationError;
5669
5038
  rawValue: unknown;
5670
5039
  };
5671
5040
 
@@ -5820,7 +5189,7 @@ export declare function pipeTextStreamToResponse({ response, status, statusText,
5820
5189
  textStream: ReadableStream<string>;
5821
5190
  } & ResponseInit): Promise<void>;
5822
5191
 
5823
- export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, consumeSseStream, }: {
5192
+ export declare function pipeUIMessageStreamToResponse({ response, status, statusText, headers, stream, keepAliveMs, consumeSseStream, }: {
5824
5193
  response: ServerResponse;
5825
5194
  stream: ReadableStream<UIMessageChunk>;
5826
5195
  } & UIMessageStreamResponseInit): Promise<void>;
@@ -5829,7 +5198,7 @@ declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHan
5829
5198
  url: string;
5830
5199
  headers?: Record<string, string | undefined>;
5831
5200
  formData: FormData;
5832
- failedResponseHandler: ResponseHandler<APICallError_2>;
5201
+ failedResponseHandler: ResponseHandler<APICallError>;
5833
5202
  successfulResponseHandler: ResponseHandler<T>;
5834
5203
  abortSignal?: AbortSignal;
5835
5204
  fetch?: FetchFunction;
@@ -5843,7 +5212,7 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
5843
5212
  url: string;
5844
5213
  headers?: Record<string, string | undefined>;
5845
5214
  body: unknown;
5846
- failedResponseHandler: ResponseHandler<APICallError_2>;
5215
+ failedResponseHandler: ResponseHandler<APICallError>;
5847
5216
  successfulResponseHandler: ResponseHandler<T>;
5848
5217
  abortSignal?: AbortSignal;
5849
5218
  fetch?: FetchFunction;
@@ -6049,7 +5418,7 @@ export declare type ProviderMetadata = SharedV2ProviderMetadata;
6049
5418
  They are passed through to the provider from the AI SDK and enable
6050
5419
  provider-specific functionality that can be fully encapsulated in the provider.
6051
5420
  */
6052
- declare type ProviderOptions = SharedV2ProviderOptions_2;
5421
+ declare type ProviderOptions = SharedV2ProviderOptions;
6053
5422
 
6054
5423
  export declare interface ProviderRegistryProvider<PROVIDERS extends Record<string, ProviderV2> = Record<string, ProviderV2>, SEPARATOR extends string = ':'> {
6055
5424
  languageModel<KEY extends keyof PROVIDERS>(id: KEY extends string ? `${KEY & string}${SEPARATOR}${ExtractLiteralUnion<Parameters<NonNullable<PROVIDERS[KEY]['languageModel']>>[0]>}` : never): LanguageModelV2;
@@ -6215,6 +5584,10 @@ declare interface ReasoningPart {
6215
5584
  */
6216
5585
  export declare type ReasoningUIPart = {
6217
5586
  type: 'reasoning';
5587
+ /**
5588
+ * The identifier of the reasoning part.
5589
+ */
5590
+ id?: string;
6218
5591
  /**
6219
5592
  * The reasoning text.
6220
5593
  */
@@ -6272,7 +5645,7 @@ declare type ResponseHandler<RETURN_TYPE> = (options: {
6272
5645
  declare type ResponseMessage = AssistantModelMessage | ToolModelMessage;
6273
5646
 
6274
5647
  export declare class RetryError extends AISDKError {
6275
- private readonly [symbol$1_3];
5648
+ private readonly [symbol$1_2];
6276
5649
  readonly reason: RetryErrorReason;
6277
5650
  readonly lastError: unknown;
6278
5651
  readonly errors: Array<unknown>;
@@ -6295,7 +5668,7 @@ declare type RetryErrorReason = 'maxRetriesExceeded' | 'errorNotRetryable' | 'ab
6295
5668
  declare function safeParseJSON(options: {
6296
5669
  text: string;
6297
5670
  schema?: undefined;
6298
- }): Promise<ParseResult<JSONValue_3>>;
5671
+ }): Promise<ParseResult<JSONValue_2>>;
6299
5672
 
6300
5673
  /**
6301
5674
  * Safely parses a JSON string into a strongly-typed object, using a provided schema to validate the object.
@@ -6328,7 +5701,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6328
5701
  rawValue: unknown;
6329
5702
  } | {
6330
5703
  success: false;
6331
- error: TypeValidationError_2;
5704
+ error: TypeValidationError;
6332
5705
  rawValue: unknown;
6333
5706
  }>;
6334
5707
 
@@ -6337,16 +5710,7 @@ declare function safeValidateTypes<OBJECT>({ value, schema, }: {
6337
5710
  * but instead of throwing it returns `{ success: true, data }`
6338
5711
  * or `{ success: false, error }`.
6339
5712
  */
6340
- export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
6341
- messages: unknown;
6342
- metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
6343
- dataSchemas?: {
6344
- [NAME in keyof InferUIMessageData<UI_MESSAGE> & string]?: Validator<InferUIMessageData<UI_MESSAGE>[NAME]> | StandardSchemaV1<unknown, InferUIMessageData<UI_MESSAGE>[NAME]>;
6345
- };
6346
- tools?: {
6347
- [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
6348
- };
6349
- }): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
5713
+ export declare function safeValidateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<SafeValidateUIMessagesResult<UI_MESSAGE>>;
6350
5714
 
6351
5715
  export declare type SafeValidateUIMessagesResult<UI_MESSAGE extends UIMessage> = {
6352
5716
  success: true;
@@ -6379,8 +5743,10 @@ declare const schemaSymbol: unique symbol;
6379
5743
  export declare class SerialJobExecutor {
6380
5744
  private queue;
6381
5745
  private isProcessing;
5746
+ private idleWaiters;
6382
5747
  private processQueue;
6383
5748
  run(job: Job): Promise<void>;
5749
+ waitForIdle(): Promise<void>;
6384
5750
  }
6385
5751
 
6386
5752
  declare type SharedV2Headers = Record<string, string>;
@@ -6408,29 +5774,6 @@ declare type SharedV2Headers = Record<string, string>;
6408
5774
  */
6409
5775
  declare type SharedV2ProviderMetadata = Record<string, Record<string, JSONValue_2>>;
6410
5776
 
6411
- /**
6412
- * Additional provider-specific metadata.
6413
- * Metadata are additional outputs from the provider.
6414
- * They are passed through to the provider from the AI SDK
6415
- * and enable provider-specific functionality
6416
- * that can be fully encapsulated in the provider.
6417
- *
6418
- * This enables us to quickly ship provider-specific functionality
6419
- * without affecting the core AI SDK.
6420
- *
6421
- * The outer record is keyed by the provider name, and the inner
6422
- * record is keyed by the provider-specific metadata key.
6423
- *
6424
- * ```ts
6425
- * {
6426
- * "anthropic": {
6427
- * "cacheControl": { "type": "ephemeral" }
6428
- * }
6429
- * }
6430
- * ```
6431
- */
6432
- declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValue_3>>;
6433
-
6434
5777
  /**
6435
5778
  * Additional provider-specific options.
6436
5779
  * Options are additional input to the provider.
@@ -6454,29 +5797,6 @@ declare type SharedV2ProviderMetadata_2 = Record<string, Record<string, JSONValu
6454
5797
  */
6455
5798
  declare type SharedV2ProviderOptions = Record<string, Record<string, JSONValue_2>>;
6456
5799
 
6457
- /**
6458
- * Additional provider-specific options.
6459
- * Options are additional input to the provider.
6460
- * They are passed through to the provider from the AI SDK
6461
- * and enable provider-specific functionality
6462
- * that can be fully encapsulated in the provider.
6463
- *
6464
- * This enables us to quickly ship provider-specific functionality
6465
- * without affecting the core AI SDK.
6466
- *
6467
- * The outer record is keyed by the provider name, and the inner
6468
- * record is keyed by the provider-specific metadata key.
6469
- *
6470
- * ```ts
6471
- * {
6472
- * "anthropic": {
6473
- * "cacheControl": { "type": "ephemeral" }
6474
- * }
6475
- * }
6476
- * ```
6477
- */
6478
- declare type SharedV2ProviderOptions_2 = Record<string, Record<string, JSONValue_3>>;
6479
-
6480
5800
  /**
6481
5801
  * Creates a ReadableStream that emits the provided values with an optional delay between each value.
6482
5802
  *
@@ -6578,7 +5898,7 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
6578
5898
  /**
6579
5899
  * Smooths text streaming output.
6580
5900
  *
6581
- * @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay.
5901
+ * @param delayInMs - The delay in milliseconds between each chunk. Defaults to 10ms. Can be set to `null` to skip the delay. The delay is skipped while the document is hidden (e.g. browser background tabs), where timer throttling would otherwise stall the stream.
6582
5902
  * @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, or provide a custom RegExp pattern for custom chunking.
6583
5903
  *
6584
5904
  * @returns A transform stream that smooths text streaming output.
@@ -7383,7 +6703,7 @@ declare class StreamingToolCallTracker<DELTA extends StreamingToolCallDelta = St
7383
6703
  private finishToolCall;
7384
6704
  }
7385
6705
 
7386
- declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart_2>, 'enqueue'>;
6706
+ declare type StreamingToolCallTrackerController = Pick<TransformStreamDefaultController<LanguageModelV2StreamPart>, 'enqueue'>;
7387
6707
 
7388
6708
  declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCallDelta = StreamingToolCallDelta> {
7389
6709
  /**
@@ -7403,11 +6723,11 @@ declare interface StreamingToolCallTrackerOptions<DELTA extends StreamingToolCal
7403
6723
  * Extract provider-specific metadata from a tool call delta.
7404
6724
  * Called once when a new tool call is detected.
7405
6725
  */
7406
- extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata_2 | undefined;
6726
+ extractMetadata?: (delta: DELTA) => SharedV2ProviderMetadata | undefined;
7407
6727
  /**
7408
6728
  * Build the `providerMetadata` object for a `tool-call` event.
7409
6729
  */
7410
- buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata_2 | undefined) => SharedV2ProviderMetadata_2 | undefined;
6730
+ buildToolCallProviderMetadata?: (metadata: SharedV2ProviderMetadata | undefined) => SharedV2ProviderMetadata | undefined;
7411
6731
  }
7412
6732
 
7413
6733
  /**
@@ -7689,6 +7009,16 @@ declare interface StreamOptions {
7689
7009
  * @param comment - The comment encountered in the stream.
7690
7010
  */
7691
7011
  onComment?: ((comment: string) => void) | undefined;
7012
+ /**
7013
+ * Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
7014
+ * See {@link ParserConfig.maxBufferSize} for details.
7015
+ *
7016
+ * When the limit is exceeded, the stream is always errored (regardless of the `onError`
7017
+ * setting) since the underlying parser is unrecoverable without a `reset()`.
7018
+ *
7019
+ * @defaultValue `undefined` (unbounded)
7020
+ */
7021
+ maxBufferSize?: number | undefined;
7692
7022
  }
7693
7023
 
7694
7024
  /**
@@ -7781,7 +7111,7 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIA
7781
7111
  /**
7782
7112
  Optional specification for parsing structured outputs from the LLM response.
7783
7113
  */
7784
- experimental_output?: Output_2<OUTPUT, PARTIAL_OUTPUT>;
7114
+ experimental_output?: OutputInterface<OUTPUT, PARTIAL_OUTPUT>;
7785
7115
  /**
7786
7116
  Optional function that you can use to provide different settings for a step.
7787
7117
 
@@ -8125,8 +7455,6 @@ declare const symbol$1: unique symbol;
8125
7455
 
8126
7456
  declare const symbol$1_2: unique symbol;
8127
7457
 
8128
- declare const symbol$1_3: unique symbol;
8129
-
8130
7458
  declare const symbol$2: unique symbol;
8131
7459
 
8132
7460
  declare const symbol$2_2: unique symbol;
@@ -8151,8 +7479,6 @@ declare const symbol$7: unique symbol;
8151
7479
 
8152
7480
  declare const symbol$7_2: unique symbol;
8153
7481
 
8154
- declare const symbol$7_3: unique symbol;
8155
-
8156
7482
  declare const symbol$8: unique symbol;
8157
7483
 
8158
7484
  declare const symbol$8_2: unique symbol;
@@ -8171,16 +7497,14 @@ declare const symbol$c: unique symbol;
8171
7497
 
8172
7498
  declare const symbol$c_2: unique symbol;
8173
7499
 
8174
- declare const symbol$c_3: unique symbol;
8175
-
8176
7500
  declare const symbol$d: unique symbol;
8177
7501
 
8178
7502
  declare const symbol$d_2: unique symbol;
8179
7503
 
8180
- declare const symbol$d_3: unique symbol;
8181
-
8182
7504
  declare const symbol$e: unique symbol;
8183
7505
 
7506
+ declare const symbol$f: unique symbol;
7507
+
8184
7508
  declare const symbol: unique symbol;
8185
7509
 
8186
7510
  declare const symbol_2: unique symbol;
@@ -8378,7 +7702,7 @@ declare type TimeInput = HrTime | number | Date;
8378
7702
 
8379
7703
  The tool can also contain an optional execute function for the actual execution function of the tool.
8380
7704
  */
8381
- export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTPUT extends JSONValue_3 | unknown | never = any> = {
7705
+ export declare type Tool<INPUT extends JSONValue_2 | unknown | never = any, OUTPUT extends JSONValue_2 | unknown | never = any> = {
8382
7706
  /**
8383
7707
  An optional description of what the tool does.
8384
7708
  Will be used by the language model to decide whether to use the tool.
@@ -8422,7 +7746,7 @@ export declare type Tool<INPUT extends JSONValue_3 | unknown | never = any, OUTP
8422
7746
 
8423
7747
  If not provided, the tool result will be sent as a JSON object.
8424
7748
  */
8425
- toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart_2['output'];
7749
+ toModelOutput?: (output: 0 extends 1 & OUTPUT ? any : [OUTPUT] extends [never] ? any : NoInfer<OUTPUT>) => LanguageModelV2ToolResultPart['output'];
8426
7750
  } & ({
8427
7751
  /**
8428
7752
  Tool with user-defined input and output schemas.
@@ -8547,7 +7871,7 @@ export declare interface ToolCallPart {
8547
7871
  }
8548
7872
 
8549
7873
  export declare class ToolCallRepairError extends AISDKError {
8550
- private readonly [symbol$6_2];
7874
+ private readonly [symbol$7_2];
8551
7875
  readonly originalError: NoSuchToolError | InvalidToolInputError;
8552
7876
  constructor({ cause, originalError, message, }: {
8553
7877
  message?: string;
@@ -8594,6 +7918,42 @@ export declare type ToolChoice<TOOLS extends Record<string, unknown>> = 'auto' |
8594
7918
  toolName: Extract<keyof TOOLS, string>;
8595
7919
  };
8596
7920
 
7921
+ /**
7922
+ * Thrown when a model response does not satisfy an enforced tool choice.
7923
+ */
7924
+ export declare class ToolChoiceViolationError extends AISDKError {
7925
+ private readonly [symbol$6_2];
7926
+ /**
7927
+ * The tool choice that the model response did not satisfy.
7928
+ */
7929
+ readonly toolChoice: EnforcedToolChoice;
7930
+ /**
7931
+ * Reason why the model finished generating the response.
7932
+ */
7933
+ readonly finishReason: FinishReason;
7934
+ /**
7935
+ * The provider that returned the response.
7936
+ */
7937
+ readonly provider: string;
7938
+ /**
7939
+ * The model that returned the response.
7940
+ */
7941
+ readonly modelId: string;
7942
+ /**
7943
+ * The normalized content returned by the model.
7944
+ */
7945
+ readonly content: Array<LanguageModelV2Content>;
7946
+ constructor({ toolChoice, finishReason, provider, modelId, content, message, }: {
7947
+ toolChoice: EnforcedToolChoice;
7948
+ finishReason: FinishReason;
7949
+ provider: string;
7950
+ modelId: string;
7951
+ content: Array<LanguageModelV2Content>;
7952
+ message?: string;
7953
+ });
7954
+ static isInstance(error: unknown): error is ToolChoiceViolationError;
7955
+ }
7956
+
8597
7957
  /**
8598
7958
  Content of a tool message. It is an array of tool result parts.
8599
7959
  */
@@ -8679,7 +8039,7 @@ export declare interface ToolResultPart {
8679
8039
  /**
8680
8040
  Result of the tool call. This is a JSON-serializable object.
8681
8041
  */
8682
- output: LanguageModelV2ToolResultOutput_2;
8042
+ output: LanguageModelV2ToolResultOutput;
8683
8043
  /**
8684
8044
  Additional provider-specific metadata. They are passed through
8685
8045
  to the provider from the AI SDK and enable provider-specific
@@ -9031,30 +8391,6 @@ export declare class TypeValidationError extends AISDKError {
9031
8391
  }): TypeValidationError;
9032
8392
  }
9033
8393
 
9034
- declare class TypeValidationError_2 extends AISDKError_2 {
9035
- private readonly [symbol$1_2];
9036
- readonly value: unknown;
9037
- constructor({ value, cause }: {
9038
- value: unknown;
9039
- cause: unknown;
9040
- });
9041
- static isInstance(error: unknown): error is TypeValidationError_2;
9042
- /**
9043
- * Wraps an error into a TypeValidationError.
9044
- * If the cause is already a TypeValidationError with the same value, it returns the cause.
9045
- * Otherwise, it creates a new TypeValidationError.
9046
- *
9047
- * @param {Object} params - The parameters for wrapping the error.
9048
- * @param {unknown} params.value - The value that failed validation.
9049
- * @param {unknown} params.cause - The original error or cause of the validation failure.
9050
- * @returns {TypeValidationError} A TypeValidationError instance.
9051
- */
9052
- static wrap({ value, cause, }: {
9053
- value: unknown;
9054
- cause: unknown;
9055
- }): TypeValidationError_2;
9056
- }
9057
-
9058
8394
  export declare const UI_MESSAGE_STREAM_HEADERS: {
9059
8395
  'content-type': string;
9060
8396
  'cache-control': string;
@@ -9227,6 +8563,10 @@ export declare type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage
9227
8563
  * Indicates whether the stream was aborted.
9228
8564
  */
9229
8565
  isAborted: boolean;
8566
+ /**
8567
+ * The operation-level outcome of the stream.
8568
+ */
8569
+ outcome: UIMessageStreamOutcome;
9230
8570
  /**
9231
8571
  * The message that was sent to the client as a response
9232
8572
  * (including the original message if it was extended).
@@ -9292,7 +8632,31 @@ export declare type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
9292
8632
  onError?: (error: unknown) => string;
9293
8633
  };
9294
8634
 
8635
+ /**
8636
+ * The operation-level outcome of a UI message stream.
8637
+ *
8638
+ * This is separate from model finish reasons and individual stream chunks.
8639
+ * Fatal stream-processing failures override outcomes declared by the stream
8640
+ * owner.
8641
+ */
8642
+ export declare type UIMessageStreamOutcome = {
8643
+ status: 'completed';
8644
+ } | {
8645
+ status: 'failed';
8646
+ error?: unknown;
8647
+ } | {
8648
+ status: 'aborted';
8649
+ } | {
8650
+ status: 'unknown';
8651
+ };
8652
+
9295
8653
  declare type UIMessageStreamResponseInit = ResponseInit & {
8654
+ /**
8655
+ * Optional interval in milliseconds for sending SSE keep-alive comments.
8656
+ * When set, an opening comment is sent immediately and additional comments
8657
+ * are sent after the stream has been idle for the configured interval.
8658
+ */
8659
+ keepAliveMs?: number;
9296
8660
  consumeSseStream?: (options: {
9297
8661
  stream: ReadableStream<string>;
9298
8662
  }) => PromiseLike<void> | void;
@@ -9315,6 +8679,18 @@ export declare interface UIMessageStreamWriter<UI_MESSAGE extends UIMessage = UI
9315
8679
  onError: ErrorHandler | undefined;
9316
8680
  }
9317
8681
 
8682
+ export declare interface UIMessageStreamWriterWithOutcome<UI_MESSAGE extends UIMessage = UIMessage> extends UIMessageStreamWriter<UI_MESSAGE> {
8683
+ /**
8684
+ * Declares the operation-level outcome of the composed stream.
8685
+ *
8686
+ * The first outcome declared through this method is retained. Fatal
8687
+ * execution, merge, error-handling, or downstream processing failures
8688
+ * override declared outcomes. Declaring an outcome does not write a chunk or
8689
+ * close the stream.
8690
+ */
8691
+ setOutcome(outcome: UIMessageStreamOutcome): void;
8692
+ }
8693
+
9318
8694
  export declare type UITool = {
9319
8695
  input: unknown;
9320
8696
  output: unknown | undefined;
@@ -9338,6 +8714,13 @@ export declare type UIToolInvocation<TOOL extends UITool | Tool> = {
9338
8714
  state: 'input-streaming';
9339
8715
  input: DeepPartial<asUITool<TOOL>['input']> | undefined;
9340
8716
  providerExecuted?: boolean;
8717
+ /**
8718
+ * The raw tool input text received so far.
8719
+ *
8720
+ * This is used to continue input streaming when a message is persisted
8721
+ * and later resumed.
8722
+ */
8723
+ rawInput?: string;
9341
8724
  output?: never;
9342
8725
  errorText?: never;
9343
8726
  } | {
@@ -9507,7 +8890,9 @@ declare function validateTypes<OBJECT>({ value, schema, }: {
9507
8890
  * the corresponding schemas are provided. Otherwise, they are assumed to be
9508
8891
  * valid.
9509
8892
  */
9510
- export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messages, metadataSchema, dataSchemas, tools, }: {
8893
+ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>(options: ValidateUIMessagesOptions<UI_MESSAGE>): Promise<Array<UI_MESSAGE>>;
8894
+
8895
+ declare type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
9511
8896
  messages: unknown;
9512
8897
  metadataSchema?: Validator<UIMessage['metadata']> | StandardSchemaV1<unknown, UI_MESSAGE['metadata']>;
9513
8898
  dataSchemas?: {
@@ -9516,7 +8901,7 @@ export declare function validateUIMessages<UI_MESSAGE extends UIMessage>({ messa
9516
8901
  tools?: {
9517
8902
  [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
9518
8903
  };
9519
- }): Promise<Array<UI_MESSAGE>>;
8904
+ };
9520
8905
 
9521
8906
  declare type ValidationResult<OBJECT> = {
9522
8907
  success: true;
@@ -9654,5 +9039,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
9654
9039
  }): Schema<OBJECT>;
9655
9040
 
9656
9041
  export { }
9657
- export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput_2 as LanguageModelV2ToolResultOutput_2, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, JSONValue_3 as JSONValue_3, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart_2 as LanguageModelV2ToolResultPart_2, FlexibleSchema as FlexibleSchema, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, Output_2 as Output_2, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction };
9658
- export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, schemaSymbol, symbol$1, symbol$1_2, symbol$1_3, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$7_3, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$c_3, symbol$d, symbol$d_2, symbol$d_3, symbol$e, symbol, symbol_2, symbol_3, validatorSymbol };
9042
+ export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, ParseResult as ParseResult, FlexibleValidator as FlexibleValidator, ValidationResult as ValidationResult, LanguageModelV2ToolResultOutput as LanguageModelV2ToolResultOutput, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, LanguageModelV2ToolResultPart as LanguageModelV2ToolResultPart, FlexibleSchema as FlexibleSchema, ImageModelV2CallWarning as ImageModelV2CallWarning, SpeechModelV2CallWarning as SpeechModelV2CallWarning, TranscriptionModelV2CallWarning as TranscriptionModelV2CallWarning, AttributeValue as AttributeValue, Tracer as Tracer, EmbeddingModelV2Embedding as EmbeddingModelV2Embedding, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2FinishReason as LanguageModelV2FinishReason, LanguageModelV2CallWarning as LanguageModelV2CallWarning, LanguageModelV2Middleware as LanguageModelV2Middleware, SharedV2ProviderMetadata as SharedV2ProviderMetadata, LanguageModelV2Usage as LanguageModelV2Usage, Source as Source, ResponseMessage as ResponseMessage, DeepPartialInternal as DeepPartialInternal, LanguageModelV2ToolCall as LanguageModelV2ToolCall, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, DataUIMessageChunk as DataUIMessageChunk, ConsumeStreamOptions as ConsumeStreamOptions, InferAgentTools as InferAgentTools, SingleRequestTextStreamPart as SingleRequestTextStreamPart, EnforcedToolChoice as EnforcedToolChoice, LanguageModelV2Content as LanguageModelV2Content, RetryErrorReason as RetryErrorReason, InferSchema as InferSchema, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, JSONValue_2 as JSONValue_2, LanguageModelV2CallOptions as LanguageModelV2CallOptions, LanguageModelV2 as LanguageModelV2, EmbeddingModelV2 as EmbeddingModelV2, ImageModelV2 as ImageModelV2, TranscriptionModelV2 as TranscriptionModelV2, SpeechModelV2 as SpeechModelV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV2 as ProviderV2, getOriginalFetch as getOriginalFetch, UIMessageStreamResponseInit as UIMessageStreamResponseInit, InferUIMessageToolCall as InferUIMessageToolCall, Validator as Validator, StandardSchemaV1 as StandardSchemaV1, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction, ValidateUIMessagesOptions as ValidateUIMessagesOptions };
9043
+ export { EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL, schemaSymbol, symbol$1, symbol$1_2, symbol$2, symbol$2_2, symbol$3, symbol$3_2, symbol$4, symbol$4_2, symbol$5, symbol$5_2, symbol$6, symbol$6_2, symbol$7, symbol$7_2, symbol$8, symbol$8_2, symbol$9, symbol$9_2, symbol$a, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol$f, symbol, symbol_2, symbol_3, validatorSymbol };