@mastra/schema-compat 1.2.1 → 1.2.2

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.
@@ -229,30 +229,10 @@ CALL_OPTIONS
229
229
  * Timeout in milliseconds. Can be specified as a number or as an object with `totalMs`.
230
230
  */
231
231
  timeout?: TimeoutConfiguration;
232
- /**
233
- * Callback that is called when the agent operation begins, before any LLM calls.
234
- */
235
- experimental_onStart?: ToolLoopAgentOnStartCallback<TOOLS>;
236
- /**
237
- * Callback that is called when a step (LLM call) begins, before the provider is called.
238
- */
239
- experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<TOOLS>;
240
- /**
241
- * Callback that is called before each tool execution begins.
242
- */
243
- experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<TOOLS>;
244
- /**
245
- * Callback that is called after each tool execution completes.
246
- */
247
- experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<TOOLS>;
248
232
  /**
249
233
  * Callback that is called when each step (LLM call) is finished, including intermediate steps.
250
234
  */
251
235
  onStepFinish?: ToolLoopAgentOnStepFinishCallback<TOOLS>;
252
- /**
253
- * Callback that is called when all steps are finished and the response is complete.
254
- */
255
- onFinish?: ToolLoopAgentOnFinishCallback<TOOLS>;
256
236
  };
257
237
 
258
238
  /**
@@ -400,7 +380,6 @@ declare namespace _ai_sdk_provider_utils {
400
380
  EventSourceParserStream,
401
381
  AssistantContent,
402
382
  AssistantModelMessage,
403
- DEFAULT_MAX_DOWNLOAD_SIZE,
404
383
  DataContent,
405
384
  DelayedPromise,
406
385
  DownloadError,
@@ -488,14 +467,11 @@ declare namespace _ai_sdk_provider_utils {
488
467
  postFormDataToApi,
489
468
  postJsonToApi,
490
469
  postToApi,
491
- readResponseWithSizeLimit,
492
470
  removeUndefinedEntries,
493
471
  resolve,
494
472
  safeParseJSON,
495
473
  safeValidateTypes,
496
- stripFileExtension,
497
474
  tool,
498
- validateDownloadUrl,
499
475
  validateTypes,
500
476
  withUserAgentSuffix,
501
477
  withoutTrailingSlash,
@@ -617,23 +593,6 @@ declare type BaseToolCall = {
617
593
  providerMetadata?: ProviderMetadata;
618
594
  };
619
595
 
620
- /**
621
- * Wraps a telemetry integration with bound methods.
622
- * Use this when creating class-based integrations to ensure methods
623
- * work correctly when passed as callbacks.
624
- */
625
- export declare function bindTelemetryIntegration(integration: TelemetryIntegration): TelemetryIntegration;
626
-
627
- /**
628
- * Common model information used across callback events.
629
- */
630
- declare interface CallbackModelInfo {
631
- /** The provider identifier (e.g., 'openai', 'anthropic'). */
632
- readonly provider: string;
633
- /** The specific model identifier (e.g., 'gpt-4o'). */
634
- readonly modelId: string;
635
- }
636
-
637
596
  export declare function callCompletionApi({ api, prompt, credentials, headers, body, streamProtocol, setCompletion, setLoading, setError, setAbortController, onFinish, onError, fetch, }: {
638
597
  api: string;
639
598
  prompt: string;
@@ -1156,23 +1115,6 @@ export declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS
1156
1115
 
1157
1116
  declare const createBinaryResponseHandler: () => ResponseHandler<Uint8Array>;
1158
1117
 
1159
- /**
1160
- * Creates a download function with configurable options.
1161
- *
1162
- * @param options - Configuration options for the download function.
1163
- * @param options.maxBytes - Maximum allowed download size in bytes. Default: 2 GiB.
1164
- * @returns A download function that can be passed to `transcribe()` or `experimental_generateVideo()`.
1165
- */
1166
- export declare function createDownload(options?: {
1167
- maxBytes?: number;
1168
- }): ({ url, abortSignal }: {
1169
- url: URL;
1170
- abortSignal?: AbortSignal;
1171
- }) => Promise<{
1172
- data: Uint8Array<ArrayBufferLike>;
1173
- mediaType: string | undefined;
1174
- }>;
1175
-
1176
1118
  declare const createEventSourceResponseHandler: <T>(chunkSchema: FlexibleSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
1177
1119
 
1178
1120
  /**
@@ -1268,7 +1210,7 @@ export declare function createTextStreamResponse({ status, statusText, headers,
1268
1210
  * @param tools - Tools that were passed to the language model.
1269
1211
  * @param providerToolNames - Maps the provider tool ids to the provider tool names.
1270
1212
  */
1271
- declare function createToolNameMapping({ tools, providerToolNames, resolveProviderToolName, }: {
1213
+ declare function createToolNameMapping({ tools, providerToolNames, }: {
1272
1214
  /**
1273
1215
  * Tools that were passed to the language model.
1274
1216
  */
@@ -1277,11 +1219,6 @@ declare function createToolNameMapping({ tools, providerToolNames, resolveProvid
1277
1219
  * Maps the provider tool ids to the provider tool names.
1278
1220
  */
1279
1221
  providerToolNames: Record<`${string}.${string}`, string>;
1280
- /**
1281
- * Optional resolver for provider tool names that cannot be represented as
1282
- * static id -> name mappings (e.g. dynamic provider names).
1283
- */
1284
- resolveProviderToolName?: (tool: LanguageModelV3ProviderTool) => string | undefined;
1285
1222
  }): ToolNameMapping;
1286
1223
 
1287
1224
  export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESSAGE, 'id' | 'role'> & {
@@ -1296,13 +1233,12 @@ export declare type CreateUIMessage<UI_MESSAGE extends UIMessage> = Omit<UI_MESS
1296
1233
  * @param options.onError - A function that extracts an error message from an error. Defaults to `getErrorMessage`.
1297
1234
  * @param options.originalMessages - The original messages. If provided, persistence mode is assumed
1298
1235
  * and a message ID is provided for the response message.
1299
- * @param options.onStepFinish - A callback that is called when each step finishes. Useful for persisting intermediate messages.
1300
1236
  * @param options.onFinish - A callback that is called when the stream finishes.
1301
1237
  * @param options.generateId - A function that generates a unique ID. Defaults to the built-in ID generator.
1302
1238
  *
1303
1239
  * @returns A `ReadableStream` of UI message chunks.
1304
1240
  */
1305
- export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, originalMessages, onStepFinish, onFinish, generateId, }: {
1241
+ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, originalMessages, onFinish, generateId, }: {
1306
1242
  execute: (options: {
1307
1243
  writer: UIMessageStreamWriter<UI_MESSAGE>;
1308
1244
  }) => Promise<void> | void;
@@ -1312,10 +1248,6 @@ export declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ ex
1312
1248
  * and a message ID is provided for the response message.
1313
1249
  */
1314
1250
  originalMessages?: UI_MESSAGE[];
1315
- /**
1316
- * Callback that is called when each step finishes during multi-step agent runs.
1317
- */
1318
- onStepFinish?: UIMessageStreamOnStepFinishCallback<UI_MESSAGE>;
1319
1251
  onFinish?: UIMessageStreamOnFinishCallback<UI_MESSAGE>;
1320
1252
  generateId?: IdGenerator;
1321
1253
  }): ReadableStream<InferUIMessageChunk<UI_MESSAGE>>;
@@ -1351,14 +1283,13 @@ export declare function createUIMessageStreamResponse({ status, statusText, head
1351
1283
  *
1352
1284
  * @throws {NoSuchModelError} Throws when a requested model is not found and no fallback provider is available.
1353
1285
  */
1354
- export declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV3>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV3>, IMAGE_MODELS extends Record<string, ImageModelV3>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV3>, SPEECH_MODELS extends Record<string, SpeechModelV3>, RERANKING_MODELS extends Record<string, RerankingModelV3>, VIDEO_MODELS extends Record<string, VideoModelV3>>({ languageModels, embeddingModels, imageModels, transcriptionModels, speechModels, rerankingModels, videoModels, fallbackProvider: fallbackProviderArg, }: {
1286
+ export declare function customProvider<LANGUAGE_MODELS extends Record<string, LanguageModelV3>, EMBEDDING_MODELS extends Record<string, EmbeddingModelV3>, IMAGE_MODELS extends Record<string, ImageModelV3>, TRANSCRIPTION_MODELS extends Record<string, TranscriptionModelV3>, SPEECH_MODELS extends Record<string, SpeechModelV3>, RERANKING_MODELS extends Record<string, RerankingModelV3>>({ languageModels, embeddingModels, imageModels, transcriptionModels, speechModels, rerankingModels, fallbackProvider: fallbackProviderArg, }: {
1355
1287
  languageModels?: LANGUAGE_MODELS;
1356
1288
  embeddingModels?: EMBEDDING_MODELS;
1357
1289
  imageModels?: IMAGE_MODELS;
1358
1290
  transcriptionModels?: TRANSCRIPTION_MODELS;
1359
1291
  speechModels?: SPEECH_MODELS;
1360
1292
  rerankingModels?: RERANKING_MODELS;
1361
- videoModels?: VIDEO_MODELS;
1362
1293
  fallbackProvider?: ProviderV3 | ProviderV2;
1363
1294
  }): ProviderV3 & {
1364
1295
  languageModel(modelId: ExtractModelId<LANGUAGE_MODELS>): LanguageModelV3;
@@ -1367,7 +1298,6 @@ export declare function customProvider<LANGUAGE_MODELS extends Record<string, La
1367
1298
  transcriptionModel(modelId: ExtractModelId<TRANSCRIPTION_MODELS>): TranscriptionModelV3;
1368
1299
  rerankingModel(modelId: ExtractModelId<RERANKING_MODELS>): RerankingModelV3;
1369
1300
  speechModel(modelId: ExtractModelId<SPEECH_MODELS>): SpeechModelV3;
1370
- videoModel(modelId: ExtractModelId<VIDEO_MODELS>): VideoModelV3;
1371
1301
  };
1372
1302
 
1373
1303
  /**
@@ -1403,19 +1333,6 @@ export declare type DeepPartial<T> = T extends FlexibleSchema ? DeepPartialInter
1403
1333
 
1404
1334
  declare type DeepPartialInternal<T> = T extends null | undefined | string | number | boolean | symbol | bigint | void | Date | RegExp | ((...arguments_: any[]) => unknown) | (new (...arguments_: any[]) => unknown) ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMap<KeyType, ValueType> : T extends Set<infer ItemType> ? PartialSet<ItemType> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMap<KeyType, ValueType> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySet<ItemType> : T extends object ? T extends ReadonlyArray<infer ItemType> ? ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<DeepPartialInternal<ItemType | undefined>> : Array<DeepPartialInternal<ItemType | undefined>> : PartialObject<T> : PartialObject<T> : unknown;
1405
1335
 
1406
- /**
1407
- * Default maximum download size: 2 GiB.
1408
- *
1409
- * `fetch().arrayBuffer()` has ~2x peak memory overhead (undici buffers the
1410
- * body internally, then creates the JS ArrayBuffer), so very large downloads
1411
- * risk exceeding the default V8 heap limit on 64-bit systems and terminating
1412
- * the process with an out-of-memory error.
1413
- *
1414
- * Setting this limit converts an unrecoverable OOM crash into a catchable
1415
- * `DownloadError`.
1416
- */
1417
- declare const DEFAULT_MAX_DOWNLOAD_SIZE: number;
1418
-
1419
1336
  export declare class DefaultChatTransport<UI_MESSAGE extends UIMessage> extends HttpChatTransport<UI_MESSAGE> {
1420
1337
  constructor(options?: HttpChatTransportInitOptions<UI_MESSAGE>);
1421
1338
  protected processResponseStream(stream: ReadableStream<Uint8Array<ArrayBufferLike>>): ReadableStream<UIMessageChunk>;
@@ -1544,17 +1461,11 @@ export declare type DirectChatTransportOptions<CALL_OPTIONS, TOOLS extends ToolS
1544
1461
  * Download a file from a URL and return it as a Blob.
1545
1462
  *
1546
1463
  * @param url - The URL to download from.
1547
- * @param options - Optional settings for the download.
1548
- * @param options.maxBytes - Maximum allowed download size in bytes. Defaults to 100 MiB.
1549
- * @param options.abortSignal - An optional abort signal to cancel the download.
1550
1464
  * @returns A Promise that resolves to the downloaded Blob.
1551
1465
  *
1552
- * @throws DownloadError if the download fails or exceeds maxBytes.
1466
+ * @throws DownloadError if the download fails.
1553
1467
  */
1554
- declare function downloadBlob(url: string, options?: {
1555
- maxBytes?: number;
1556
- abortSignal?: AbortSignal;
1557
- }): Promise<Blob>;
1468
+ declare function downloadBlob(url: string): Promise<Blob>;
1558
1469
 
1559
1470
  export declare class DownloadError extends AISDKError {
1560
1471
  private readonly [symbol];
@@ -2457,7 +2368,26 @@ export declare function experimental_generateSpeech({ model, text, voice, output
2457
2368
  headers?: Record<string, string>;
2458
2369
  }): Promise<Experimental_SpeechResult>;
2459
2370
 
2460
- export declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
2371
+ /**
2372
+ * Generates videos using a video model.
2373
+ *
2374
+ * @param model - The video model to use.
2375
+ * @param prompt - The prompt that should be used to generate the video.
2376
+ * @param n - Number of videos to generate. Default: 1.
2377
+ * @param aspectRatio - Aspect ratio of the videos to generate. Must have the format `{width}:{height}`.
2378
+ * @param resolution - Resolution of the videos to generate. Must have the format `{width}x{height}`.
2379
+ * @param duration - Duration of the video in seconds.
2380
+ * @param fps - Frames per second for the video.
2381
+ * @param seed - Seed for the video generation.
2382
+ * @param providerOptions - Additional provider-specific options that are passed through to the provider
2383
+ * as body parameters.
2384
+ * @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
2385
+ * @param abortSignal - An optional abort signal that can be used to cancel the call.
2386
+ * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
2387
+ *
2388
+ * @returns A result object that contains the generated videos.
2389
+ */
2390
+ export declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
2461
2391
  /**
2462
2392
  * The video model to use.
2463
2393
  */
@@ -2514,19 +2444,6 @@ export declare function experimental_generateVideo({ model: modelArg, prompt: pr
2514
2444
  * Only applicable for HTTP-based providers.
2515
2445
  */
2516
2446
  headers?: Record<string, string>;
2517
- /**
2518
- * Custom download function for fetching videos from URLs.
2519
- * Use `createDownload()` from `ai` to create a download function with custom size limits.
2520
- *
2521
- * @default createDownload() (2 GiB limit)
2522
- */
2523
- download?: (options: {
2524
- url: URL;
2525
- abortSignal?: AbortSignal;
2526
- }) => Promise<{
2527
- data: Uint8Array;
2528
- mediaType: string | undefined;
2529
- }>;
2530
2447
  }): Promise<GenerateVideoResult>;
2531
2448
 
2532
2449
  /**
@@ -2552,7 +2469,20 @@ export declare interface Experimental_SpeechResult {
2552
2469
  readonly providerMetadata: Record<string, JSONObject>;
2553
2470
  }
2554
2471
 
2555
- export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
2472
+ /**
2473
+ * Generates transcripts using a transcription model.
2474
+ *
2475
+ * @param model - The transcription model to use.
2476
+ * @param audio - The audio data to transcribe as DataContent (string | Uint8Array | ArrayBuffer | Buffer) or a URL.
2477
+ * @param providerOptions - Additional provider-specific options that are passed through to the provider
2478
+ * as body parameters.
2479
+ * @param maxRetries - Maximum number of retries. Set to 0 to disable retries. Default: 2.
2480
+ * @param abortSignal - An optional abort signal that can be used to cancel the call.
2481
+ * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
2482
+ *
2483
+ * @returns A result object that contains the generated transcript.
2484
+ */
2485
+ export declare function experimental_transcribe({ model, audio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
2556
2486
  /**
2557
2487
  * The transcription model to use.
2558
2488
  */
@@ -2591,19 +2521,6 @@ export declare function experimental_transcribe({ model, audio, providerOptions,
2591
2521
  * Only applicable for HTTP-based providers.
2592
2522
  */
2593
2523
  headers?: Record<string, string>;
2594
- /**
2595
- * Custom download function for fetching audio from URLs.
2596
- * Use `createDownload()` from `ai` to create a download function with custom size limits.
2597
- *
2598
- * @default createDownload() (2 GiB limit)
2599
- */
2600
- download?: (options: {
2601
- url: URL;
2602
- abortSignal?: AbortSignal;
2603
- }) => Promise<{
2604
- data: Uint8Array;
2605
- mediaType: string | undefined;
2606
- }>;
2607
2524
  }): Promise<Experimental_TranscriptionResult>;
2608
2525
 
2609
2526
  /**
@@ -2790,13 +2707,13 @@ declare interface GatewayCreditsResponse {
2790
2707
  totalUsed: string;
2791
2708
  }
2792
2709
 
2793
- 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/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 & {});
2710
+ 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/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-code-2' | 'voyage/voyage-code-3' | 'voyage/voyage-finance-2' | 'voyage/voyage-law-2' | (string & {});
2794
2711
 
2795
2712
  declare interface GatewayFetchMetadataResponse {
2796
2713
  models: GatewayLanguageModelEntry[];
2797
2714
  }
2798
2715
 
2799
- declare type GatewayImageModelId = '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' | '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' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | 'recraft/recraft-v4' | 'recraft/recraft-v4-pro' | 'xai/grok-imagine-image' | 'xai/grok-imagine-image-pro' | (string & {});
2716
+ declare type GatewayImageModelId = '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' | 'google/imagen-4.0-fast-generate-001' | 'google/imagen-4.0-generate-001' | 'google/imagen-4.0-ultra-generate-001' | 'recraft/recraft-v2' | 'recraft/recraft-v3' | (string & {});
2800
2717
 
2801
2718
  declare interface GatewayLanguageModelEntry {
2802
2719
  /**
@@ -2842,19 +2759,15 @@ declare interface GatewayLanguageModelEntry {
2842
2759
  /**
2843
2760
  * Optional field to differentiate between model types.
2844
2761
  */
2845
- modelType?: 'language' | 'embedding' | 'image' | 'video' | null;
2762
+ modelType?: 'language' | 'embedding' | 'image' | null;
2846
2763
  }
2847
2764
 
2848
2765
  declare type GatewayLanguageModelSpecification = Pick<LanguageModelV3, 'specificationVersion' | 'provider' | 'modelId'>;
2849
2766
 
2850
- export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | '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-instruct' | 'alibaba/qwen3-vl-thinking' | 'alibaba/qwen3.5-flash' | 'alibaba/qwen3.5-plus' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | 'anthropic/claude-3.7-sonnet' | '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-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'anthropic/claude-sonnet-4.6' | 'arcee-ai/trinity-large-preview' | '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' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | '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-preview' | 'google/gemini-3.1-flash-lite-preview' | 'google/gemini-3.1-pro-preview' | 'inception/mercury-coder-small' | 'kwaipilot/kat-coder-pro-v1' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'minimax/minimax-m2.5' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | '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-nemo' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/codex-mini' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | '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-chat' | '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-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | 'openai/gpt-5.3-chat' | 'openai/gpt-5.3-codex' | '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' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2-vision' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | '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-flashx' | 'zai/glm-5' | (string & {});
2767
+ export declare type GatewayModelId = 'alibaba/qwen-3-14b' | 'alibaba/qwen-3-235b' | 'alibaba/qwen-3-30b' | 'alibaba/qwen-3-32b' | 'alibaba/qwen3-235b-a22b-thinking' | 'alibaba/qwen3-coder' | 'alibaba/qwen3-coder-30b-a3b' | '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-instruct' | 'alibaba/qwen3-vl-thinking' | 'amazon/nova-2-lite' | 'amazon/nova-lite' | 'amazon/nova-micro' | 'amazon/nova-pro' | 'anthropic/claude-3-haiku' | 'anthropic/claude-3-opus' | 'anthropic/claude-3.5-haiku' | 'anthropic/claude-3.5-sonnet' | 'anthropic/claude-3.5-sonnet-20240620' | 'anthropic/claude-3.7-sonnet' | 'anthropic/claude-haiku-4.5' | 'anthropic/claude-opus-4' | 'anthropic/claude-opus-4.1' | 'anthropic/claude-opus-4.5' | 'anthropic/claude-sonnet-4' | 'anthropic/claude-sonnet-4.5' | 'arcee-ai/trinity-large-preview' | '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-exp' | 'deepseek/deepseek-v3.2-thinking' | 'google/gemini-2.0-flash' | 'google/gemini-2.0-flash-lite' | 'google/gemini-2.5-flash' | 'google/gemini-2.5-flash-image' | 'google/gemini-2.5-flash-image-preview' | 'google/gemini-2.5-flash-lite' | 'google/gemini-2.5-flash-lite-preview-09-2025' | 'google/gemini-2.5-flash-preview-09-2025' | 'google/gemini-2.5-pro' | 'google/gemini-3-flash' | 'google/gemini-3-pro-image' | 'google/gemini-3-pro-preview' | 'inception/mercury-coder-small' | 'kwaipilot/kat-coder-pro-v1' | 'meituan/longcat-flash-chat' | 'meituan/longcat-flash-thinking' | 'meta/llama-3.1-70b' | 'meta/llama-3.1-8b' | 'meta/llama-3.2-11b' | 'meta/llama-3.2-1b' | 'meta/llama-3.2-3b' | 'meta/llama-3.2-90b' | 'meta/llama-3.3-70b' | 'meta/llama-4-maverick' | 'meta/llama-4-scout' | 'minimax/minimax-m2' | 'minimax/minimax-m2.1' | 'minimax/minimax-m2.1-lightning' | 'mistral/codestral' | 'mistral/devstral-2' | 'mistral/devstral-small' | '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-nemo' | 'mistral/mistral-small' | 'mistral/mixtral-8x22b-instruct' | 'mistral/pixtral-12b' | 'mistral/pixtral-large' | 'moonshotai/kimi-k2' | 'moonshotai/kimi-k2-0905' | 'moonshotai/kimi-k2-thinking' | 'moonshotai/kimi-k2-thinking-turbo' | 'moonshotai/kimi-k2-turbo' | 'moonshotai/kimi-k2.5' | 'morph/morph-v3-fast' | 'morph/morph-v3-large' | 'nvidia/nemotron-3-nano-30b-a3b' | 'nvidia/nemotron-nano-12b-v2-vl' | 'nvidia/nemotron-nano-9b-v2' | 'openai/codex-mini' | 'openai/gpt-3.5-turbo' | 'openai/gpt-3.5-turbo-instruct' | '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-chat' | '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-chat' | 'openai/gpt-5.2-codex' | 'openai/gpt-5.2-pro' | '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' | 'perplexity/sonar-reasoning-pro' | 'prime-intellect/intellect-3' | 'vercel/v0-1.0-md' | 'vercel/v0-1.5-md' | 'xai/grok-2-vision' | 'xai/grok-3' | 'xai/grok-3-fast' | 'xai/grok-3-mini' | 'xai/grok-3-mini-fast' | 'xai/grok-4' | 'xai/grok-4-fast-non-reasoning' | 'xai/grok-4-fast-reasoning' | 'xai/grok-4.1-fast-non-reasoning' | 'xai/grok-4.1-fast-reasoning' | 'xai/grok-code-fast-1' | 'xiaomi/mimo-v2-flash' | '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-flashx' | (string & {});
2851
2768
 
2852
2769
  declare interface GatewayProvider extends ProviderV3 {
2853
2770
  (modelId: GatewayModelId): LanguageModelV3;
2854
- /**
2855
- * Creates a model for text generation.
2856
- */
2857
- chat(modelId: GatewayModelId): LanguageModelV3;
2858
2771
  /**
2859
2772
  * Creates a model for text generation.
2860
2773
  */
@@ -2867,10 +2780,6 @@ declare interface GatewayProvider extends ProviderV3 {
2867
2780
  * Returns credit information for the authenticated user.
2868
2781
  */
2869
2782
  getCredits(): Promise<GatewayCreditsResponse>;
2870
- /**
2871
- * Creates a model for generating text embeddings.
2872
- */
2873
- embedding(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
2874
2783
  /**
2875
2784
  * Creates a model for generating text embeddings.
2876
2785
  */
@@ -2879,22 +2788,10 @@ declare interface GatewayProvider extends ProviderV3 {
2879
2788
  * @deprecated Use `embeddingModel` instead.
2880
2789
  */
2881
2790
  textEmbeddingModel(modelId: GatewayEmbeddingModelId): EmbeddingModelV3;
2882
- /**
2883
- * Creates a model for generating images.
2884
- */
2885
- image(modelId: GatewayImageModelId): ImageModelV3;
2886
2791
  /**
2887
2792
  * Creates a model for generating images.
2888
2793
  */
2889
2794
  imageModel(modelId: GatewayImageModelId): ImageModelV3;
2890
- /**
2891
- * Creates a model for generating videos.
2892
- */
2893
- video(modelId: GatewayVideoModelId): VideoModelV3;
2894
- /**
2895
- * Creates a model for generating videos.
2896
- */
2897
- videoModel(modelId: GatewayVideoModelId): VideoModelV3;
2898
2795
  /**
2899
2796
  * Gateway-specific tools executed server-side.
2900
2797
  */
@@ -2948,8 +2845,6 @@ declare const gatewayTools: {
2948
2845
  perplexitySearch: (config?: PerplexitySearchConfig) => ReturnType<typeof perplexitySearchToolFactory>;
2949
2846
  };
2950
2847
 
2951
- declare type GatewayVideoModelId = 'alibaba/wan-v2.5-t2v-preview' | 'alibaba/wan-v2.6-i2v' | 'alibaba/wan-v2.6-i2v-flash' | 'alibaba/wan-v2.6-r2v' | 'alibaba/wan-v2.6-r2v-flash' | 'alibaba/wan-v2.6-t2v' | 'bytedance/seedance-v1.0-lite-i2v' | 'bytedance/seedance-v1.0-lite-t2v' | 'bytedance/seedance-v1.0-pro' | 'bytedance/seedance-v1.0-pro-fast' | 'bytedance/seedance-v1.5-pro' | 'google/veo-3.0-fast-generate-001' | 'google/veo-3.0-generate-001' | 'google/veo-3.1-fast-generate-001' | 'google/veo-3.1-generate-001' | 'klingai/kling-v2.5-turbo-i2v' | 'klingai/kling-v2.5-turbo-t2v' | 'klingai/kling-v2.6-i2v' | 'klingai/kling-v2.6-motion-control' | 'klingai/kling-v2.6-t2v' | 'klingai/kling-v3.0-i2v' | 'klingai/kling-v3.0-t2v' | 'xai/grok-imagine-video' | (string & {});
2952
-
2953
2848
  /**
2954
2849
  * A generated audio file.
2955
2850
  */
@@ -3320,21 +3215,13 @@ export declare interface GenerateObjectResult<OBJECT> {
3320
3215
  * @param timeout - An optional timeout in milliseconds. The call will be aborted if it takes longer than the specified timeout.
3321
3216
  * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
3322
3217
  *
3323
- * @param experimental_context - User-defined context object that flows through the entire generation lifecycle.
3324
- * @param experimental_onStart - Callback invoked when generation begins, before any LLM calls.
3325
- * @param experimental_onStepStart - Callback invoked when each step begins, before the provider is called.
3326
- * Receives step number, messages (in ModelMessage format), tools, and context.
3327
- * @param experimental_onToolCallStart - Callback invoked before each tool execution begins.
3328
- * Receives tool name, call ID, input, and context.
3329
- * @param experimental_onToolCallFinish - Callback invoked after each tool execution completes.
3330
- * Uses a discriminated union: check `success` to determine if `output` or `error` is present.
3331
3218
  * @param onStepFinish - Callback that is called when each step (LLM call) is finished, including intermediate steps.
3332
3219
  * @param onFinish - Callback that is called when all steps are finished and the response is complete.
3333
3220
  *
3334
3221
  * @returns
3335
3222
  * A result object that contains the generated text, the results of the tool calls, and additional information.
3336
3223
  */
3337
- export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
3224
+ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, experimental_context, experimental_include: include, _internal: { generateId }, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & {
3338
3225
  /**
3339
3226
  * The language model to use.
3340
3227
  */
@@ -3401,24 +3288,6 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
3401
3288
  * A function that attempts to repair a tool call that failed to parse.
3402
3289
  */
3403
3290
  experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
3404
- /**
3405
- * Callback that is called when the generateText operation begins,
3406
- * before any LLM calls are made.
3407
- */
3408
- experimental_onStart?: GenerateTextOnStartCallback<NoInfer<TOOLS>, OUTPUT>;
3409
- /**
3410
- * Callback that is called when a step (LLM call) begins,
3411
- * before the provider is called.
3412
- */
3413
- experimental_onStepStart?: GenerateTextOnStepStartCallback<NoInfer<TOOLS>, OUTPUT>;
3414
- /**
3415
- * Callback that is called right before a tool's execute function runs.
3416
- */
3417
- experimental_onToolCallStart?: GenerateTextOnToolCallStartCallback<NoInfer<TOOLS>>;
3418
- /**
3419
- * Callback that is called right after a tool's execute function completes (or errors).
3420
- */
3421
- experimental_onToolCallFinish?: GenerateTextOnToolCallFinishCallback<NoInfer<TOOLS>>;
3422
3291
  /**
3423
3292
  * Callback that is called when each step (LLM call) is finished, including intermediate steps.
3424
3293
  */
@@ -3463,80 +3332,36 @@ export declare function generateText<TOOLS extends ToolSet, OUTPUT extends Outpu
3463
3332
  };
3464
3333
  }): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
3465
3334
 
3466
- /**
3467
- * Include settings for generateText (requestBody and responseBody).
3468
- */
3469
- declare type GenerateTextIncludeSettings = {
3470
- requestBody?: boolean;
3471
- responseBody?: boolean;
3472
- };
3473
-
3474
3335
  /**
3475
3336
  * Callback that is set using the `onFinish` option.
3476
3337
  *
3477
- * Called when the entire generation completes (all steps finished).
3478
- * The event includes the final step's result properties along with
3479
- * aggregated data from all steps.
3480
- *
3481
- * @param event - The final result along with aggregated step data.
3482
- */
3483
- export declare type GenerateTextOnFinishCallback<TOOLS extends ToolSet> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
3484
-
3485
- /**
3486
- * Callback that is set using the `experimental_onStart` option.
3487
- *
3488
- * Called when the generateText operation begins, before any LLM calls.
3489
- * Use this callback for logging, analytics, or initializing state at the
3490
- * start of a generation.
3491
- *
3492
- * @param event - The event object containing generation configuration.
3338
+ * @param event - The event that is passed to the callback.
3493
3339
  */
3494
- export declare type GenerateTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStartEvent<TOOLS, OUTPUT, GenerateTextIncludeSettings>) => PromiseLike<void> | void;
3340
+ export declare type GenerateTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
3341
+ /**
3342
+ * Details for all steps.
3343
+ */
3344
+ readonly steps: StepResult<TOOLS>[];
3345
+ /**
3346
+ * Total usage for all steps. This is the sum of the usage of all steps.
3347
+ */
3348
+ readonly totalUsage: LanguageModelUsage;
3349
+ /**
3350
+ * Context that is passed into tool execution.
3351
+ *
3352
+ * Experimental (can break in patch releases).
3353
+ *
3354
+ * @default undefined
3355
+ */
3356
+ experimental_context: unknown;
3357
+ }) => PromiseLike<void> | void;
3495
3358
 
3496
3359
  /**
3497
3360
  * Callback that is set using the `onStepFinish` option.
3498
3361
  *
3499
- * Called when a step (LLM call) completes. The event includes all step result
3500
- * properties (text, tool calls, usage, etc.) along with additional metadata.
3501
- *
3502
3362
  * @param stepResult - The result of the step.
3503
3363
  */
3504
- export declare type GenerateTextOnStepFinishCallback<TOOLS extends ToolSet> = (event: OnStepFinishEvent<TOOLS>) => Promise<void> | void;
3505
-
3506
- /**
3507
- * Callback that is set using the `experimental_onStepStart` option.
3508
- *
3509
- * Called when a step (LLM call) begins, before the provider is called.
3510
- * Each step represents a single LLM invocation. Multiple steps occur when
3511
- * using tool calls (the model may be called multiple times in a loop).
3512
- *
3513
- * @param event - The event object containing step configuration.
3514
- */
3515
- export declare type GenerateTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStepStartEvent<TOOLS, OUTPUT, GenerateTextIncludeSettings>) => PromiseLike<void> | void;
3516
-
3517
- /**
3518
- * Callback that is set using the `experimental_onToolCallFinish` option.
3519
- *
3520
- * Called when a tool execution completes, either successfully or with an error.
3521
- * Use this for logging tool results, tracking execution time, or error handling.
3522
- *
3523
- * The event uses a discriminated union on the `success` field:
3524
- * - When `success: true`: `output` contains the tool result, `error` is never present.
3525
- * - When `success: false`: `error` contains the error, `output` is never present.
3526
- *
3527
- * @param event - The event object containing tool call result information.
3528
- */
3529
- export declare type GenerateTextOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
3530
-
3531
- /**
3532
- * Callback that is set using the `experimental_onToolCallStart` option.
3533
- *
3534
- * Called when a tool execution begins, before the tool's `execute` function is invoked.
3535
- * Use this for logging tool invocations, tracking tool usage, or pre-execution validation.
3536
- *
3537
- * @param event - The event object containing tool call information.
3538
- */
3539
- export declare type GenerateTextOnToolCallStartCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallStartEvent<TOOLS>) => PromiseLike<void> | void;
3364
+ export declare type GenerateTextOnStepFinishCallback<TOOLS extends ToolSet> = (stepResult: StepResult<TOOLS>) => Promise<void> | void;
3540
3365
 
3541
3366
  /**
3542
3367
  * The result of a `generateText` call.
@@ -6889,11 +6714,6 @@ declare interface Link {
6889
6714
  droppedAttributesCount?: number;
6890
6715
  }
6891
6716
 
6892
- /**
6893
- * A callback function that can be used to notify listeners.
6894
- */
6895
- declare type Listener<EVENT> = (event: EVENT) => PromiseLike<void> | void;
6896
-
6897
6717
  declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description, }: {
6898
6718
  apiKey: string | undefined;
6899
6719
  environmentVariableName: string;
@@ -7123,11 +6943,11 @@ export declare class NoSpeechGeneratedError extends AISDKError {
7123
6943
  export declare class NoSuchModelError extends AISDKError {
7124
6944
  private readonly [symbol$3];
7125
6945
  readonly modelId: string;
7126
- readonly modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel' | 'videoModel';
6946
+ readonly modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel';
7127
6947
  constructor({ errorName, modelId, modelType, message, }: {
7128
6948
  errorName?: string;
7129
6949
  modelId: string;
7130
- modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel' | 'videoModel';
6950
+ modelType: 'languageModel' | 'embeddingModel' | 'imageModel' | 'transcriptionModel' | 'speechModel' | 'rerankingModel';
7131
6951
  message?: string;
7132
6952
  });
7133
6953
  static isInstance(error: unknown): error is NoSuchModelError;
@@ -7213,240 +7033,6 @@ export declare type ObjectStreamPart<PARTIAL> = {
7213
7033
  providerMetadata?: ProviderMetadata;
7214
7034
  };
7215
7035
 
7216
- /**
7217
- * Event passed to the `onFinish` callback.
7218
- *
7219
- * Called when the entire generation completes (all steps finished).
7220
- * Includes the final step's result along with aggregated data from all steps.
7221
- */
7222
- export declare type OnFinishEvent<TOOLS extends ToolSet = ToolSet> = StepResult<TOOLS> & {
7223
- /** Array containing results from all steps in the generation. */
7224
- readonly steps: StepResult<TOOLS>[];
7225
- /** Aggregated token usage across all steps. */
7226
- readonly totalUsage: LanguageModelUsage;
7227
- /**
7228
- * The final state of the user-defined context object.
7229
- *
7230
- * Experimental (can break in patch releases).
7231
- *
7232
- * @default undefined
7233
- */
7234
- experimental_context: unknown;
7235
- /** Identifier from telemetry settings for grouping related operations. */
7236
- readonly functionId: string | undefined;
7237
- /** Additional metadata from telemetry settings. */
7238
- readonly metadata: Record<string, unknown> | undefined;
7239
- };
7240
-
7241
- /**
7242
- * Event passed to the `onStart` callback.
7243
- *
7244
- * Called when the generation operation begins, before any LLM calls.
7245
- */
7246
- export declare interface OnStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2, INCLUDE = {
7247
- requestBody?: boolean;
7248
- responseBody?: boolean;
7249
- }> {
7250
- /** The model being used for generation. */
7251
- readonly model: CallbackModelInfo;
7252
- /** The system message(s) provided to the model. */
7253
- readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
7254
- /** The prompt string or array of messages if using the prompt option. */
7255
- readonly prompt: string | Array<ModelMessage> | undefined;
7256
- /** The messages array if using the messages option. */
7257
- readonly messages: Array<ModelMessage> | undefined;
7258
- /** The tools available for this generation. */
7259
- readonly tools: TOOLS | undefined;
7260
- /** The tool choice strategy for this generation. */
7261
- readonly toolChoice: ToolChoice<NoInfer<TOOLS>> | undefined;
7262
- /** Limits which tools are available for the model to call. */
7263
- readonly activeTools: Array<keyof TOOLS> | undefined;
7264
- /** Maximum number of tokens to generate. */
7265
- readonly maxOutputTokens: number | undefined;
7266
- /** Sampling temperature for generation. */
7267
- readonly temperature: number | undefined;
7268
- /** Top-p (nucleus) sampling parameter. */
7269
- readonly topP: number | undefined;
7270
- /** Top-k sampling parameter. */
7271
- readonly topK: number | undefined;
7272
- /** Presence penalty for generation. */
7273
- readonly presencePenalty: number | undefined;
7274
- /** Frequency penalty for generation. */
7275
- readonly frequencyPenalty: number | undefined;
7276
- /** Sequences that will stop generation. */
7277
- readonly stopSequences: string[] | undefined;
7278
- /** Random seed for reproducible generation. */
7279
- readonly seed: number | undefined;
7280
- /** Maximum number of retries for failed requests. */
7281
- readonly maxRetries: number;
7282
- /**
7283
- * Timeout configuration for the generation.
7284
- * Can be a number (milliseconds) or an object with totalMs, stepMs, chunkMs.
7285
- */
7286
- readonly timeout: TimeoutConfiguration | undefined;
7287
- /** Additional HTTP headers sent with the request. */
7288
- readonly headers: Record<string, string | undefined> | undefined;
7289
- /** Additional provider-specific options. */
7290
- readonly providerOptions: ProviderOptions | undefined;
7291
- /**
7292
- * Condition(s) for stopping the generation.
7293
- * When the condition is an array, any of the conditions can be met to stop.
7294
- */
7295
- readonly stopWhen: StopCondition<TOOLS> | Array<StopCondition<TOOLS>> | undefined;
7296
- /** The output specification for structured outputs, if configured. */
7297
- readonly output: OUTPUT | undefined;
7298
- /** Abort signal for cancelling the operation. */
7299
- readonly abortSignal: AbortSignal | undefined;
7300
- /**
7301
- * Settings for controlling what data is included in step results.
7302
- */
7303
- readonly include: INCLUDE | undefined;
7304
- /** Identifier from telemetry settings for grouping related operations. */
7305
- readonly functionId: string | undefined;
7306
- /** Additional metadata passed to the generation. */
7307
- readonly metadata: Record<string, unknown> | undefined;
7308
- /**
7309
- * User-defined context object that flows through the entire generation lifecycle.
7310
- * Can be accessed and modified in `prepareStep` and tool `execute` functions.
7311
- */
7312
- readonly experimental_context: unknown;
7313
- }
7314
-
7315
- /**
7316
- * Event passed to the `onStepFinish` callback.
7317
- *
7318
- * Called when a step (LLM call) completes.
7319
- * This is simply the StepResult for that step.
7320
- */
7321
- export declare type OnStepFinishEvent<TOOLS extends ToolSet = ToolSet> = StepResult<TOOLS>;
7322
-
7323
- /**
7324
- * Event passed to the `onStepStart` callback.
7325
- *
7326
- * Called when a step (LLM call) begins, before the provider is called.
7327
- * Each step represents a single LLM invocation.
7328
- */
7329
- export declare interface OnStepStartEvent<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2, INCLUDE = {
7330
- requestBody?: boolean;
7331
- responseBody?: boolean;
7332
- }> {
7333
- /** Zero-based index of the current step. */
7334
- readonly stepNumber: number;
7335
- /** The model being used for this step. */
7336
- readonly model: CallbackModelInfo;
7337
- /**
7338
- * The system message for this step.
7339
- */
7340
- readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
7341
- /**
7342
- * The messages that will be sent to the model for this step.
7343
- * Uses the user-facing `ModelMessage` format.
7344
- * May be overridden by prepareStep.
7345
- */
7346
- readonly messages: Array<ModelMessage>;
7347
- /** The tools available for this generation. */
7348
- readonly tools: TOOLS | undefined;
7349
- /** The tool choice configuration for this step. */
7350
- readonly toolChoice: LanguageModelV3ToolChoice | undefined;
7351
- /** Limits which tools are available for this step. */
7352
- readonly activeTools: Array<keyof TOOLS> | undefined;
7353
- /** Array of results from previous steps (empty for first step). */
7354
- readonly steps: ReadonlyArray<StepResult<TOOLS>>;
7355
- /** Additional provider-specific options for this step. */
7356
- readonly providerOptions: ProviderOptions | undefined;
7357
- /**
7358
- * Timeout configuration for the generation.
7359
- * Can be a number (milliseconds) or an object with totalMs, stepMs, chunkMs.
7360
- */
7361
- readonly timeout: TimeoutConfiguration | undefined;
7362
- /** Additional HTTP headers sent with the request. */
7363
- readonly headers: Record<string, string | undefined> | undefined;
7364
- /**
7365
- * Condition(s) for stopping the generation.
7366
- * When the condition is an array, any of the conditions can be met to stop.
7367
- */
7368
- readonly stopWhen: StopCondition<TOOLS> | Array<StopCondition<TOOLS>> | undefined;
7369
- /** The output specification for structured outputs, if configured. */
7370
- readonly output: OUTPUT | undefined;
7371
- /** Abort signal for cancelling the operation. */
7372
- readonly abortSignal: AbortSignal | undefined;
7373
- /**
7374
- * Settings for controlling what data is included in step results.
7375
- */
7376
- readonly include: INCLUDE | undefined;
7377
- /** Identifier from telemetry settings for grouping related operations. */
7378
- readonly functionId: string | undefined;
7379
- /** Additional metadata from telemetry settings. */
7380
- readonly metadata: Record<string, unknown> | undefined;
7381
- /**
7382
- * User-defined context object. May be updated from `prepareStep` between steps.
7383
- */
7384
- readonly experimental_context: unknown;
7385
- }
7386
-
7387
- /**
7388
- * Event passed to the `onToolCallFinish` callback.
7389
- *
7390
- * Called when a tool execution completes, either successfully or with an error.
7391
- * Uses a discriminated union on the `success` field.
7392
- */
7393
- export declare type OnToolCallFinishEvent<TOOLS extends ToolSet = ToolSet> = {
7394
- /** Zero-based index of the current step where this tool call occurred. */
7395
- readonly stepNumber: number | undefined;
7396
- /** The model being used for this step. */
7397
- readonly model: CallbackModelInfo | undefined;
7398
- /** The full tool call object. */
7399
- readonly toolCall: TypedToolCall<TOOLS>;
7400
- /** The conversation messages available at tool execution time. */
7401
- readonly messages: Array<ModelMessage>;
7402
- /** Signal for cancelling the operation. */
7403
- readonly abortSignal: AbortSignal | undefined;
7404
- /** Execution time of the tool call in milliseconds. */
7405
- readonly durationMs: number;
7406
- /** Identifier from telemetry settings for grouping related operations. */
7407
- readonly functionId: string | undefined;
7408
- /** Additional metadata from telemetry settings. */
7409
- readonly metadata: Record<string, unknown> | undefined;
7410
- /** User-defined context object flowing through the generation. */
7411
- readonly experimental_context: unknown;
7412
- } & ({
7413
- /** Indicates the tool call succeeded. */
7414
- readonly success: true;
7415
- /** The tool's return value. */
7416
- readonly output: unknown;
7417
- readonly error?: never;
7418
- } | {
7419
- /** Indicates the tool call failed. */
7420
- readonly success: false;
7421
- readonly output?: never;
7422
- /** The error that occurred during tool execution. */
7423
- readonly error: unknown;
7424
- });
7425
-
7426
- /**
7427
- * Event passed to the `onToolCallStart` callback.
7428
- *
7429
- * Called when a tool execution begins, before the tool's `execute` function is invoked.
7430
- */
7431
- export declare interface OnToolCallStartEvent<TOOLS extends ToolSet = ToolSet> {
7432
- /** Zero-based index of the current step where this tool call occurs. */
7433
- readonly stepNumber: number | undefined;
7434
- /** The model being used for this step. */
7435
- readonly model: CallbackModelInfo | undefined;
7436
- /** The full tool call object. */
7437
- readonly toolCall: TypedToolCall<TOOLS>;
7438
- /** The conversation messages available at tool execution time. */
7439
- readonly messages: Array<ModelMessage>;
7440
- /** Signal for cancelling the operation. */
7441
- readonly abortSignal: AbortSignal | undefined;
7442
- /** Identifier from telemetry settings for grouping related operations. */
7443
- readonly functionId: string | undefined;
7444
- /** Additional metadata from telemetry settings. */
7445
- readonly metadata: Record<string, unknown> | undefined;
7446
- /** User-defined context object flowing through the generation. */
7447
- readonly experimental_context: unknown;
7448
- }
7449
-
7450
7036
  export declare namespace Output {
7451
7037
  export {
7452
7038
  output_Output as Output,
@@ -8345,25 +7931,6 @@ export declare function pruneMessages({ messages, reasoning, toolCalls, emptyMes
8345
7931
  emptyMessages?: 'keep' | 'remove';
8346
7932
  }): ModelMessage[];
8347
7933
 
8348
- /**
8349
- * Reads a fetch Response body with a size limit to prevent memory exhaustion.
8350
- *
8351
- * Checks the Content-Length header for early rejection, then reads the body
8352
- * incrementally via ReadableStream and aborts with a DownloadError when the
8353
- * limit is exceeded.
8354
- *
8355
- * @param response - The fetch Response to read.
8356
- * @param url - The URL being downloaded (used in error messages).
8357
- * @param maxBytes - Maximum allowed bytes. Defaults to DEFAULT_MAX_DOWNLOAD_SIZE.
8358
- * @returns A Uint8Array containing the response body.
8359
- * @throws DownloadError if the response exceeds maxBytes.
8360
- */
8361
- declare function readResponseWithSizeLimit({ response, url, maxBytes, }: {
8362
- response: Response;
8363
- url: string;
8364
- maxBytes?: number;
8365
- }): Promise<Uint8Array>;
8366
-
8367
7934
  /**
8368
7935
  * Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
8369
7936
  *
@@ -8435,11 +8002,6 @@ export declare type ReasoningUIPart = {
8435
8002
  providerMetadata?: ProviderMetadata;
8436
8003
  };
8437
8004
 
8438
- /**
8439
- * Registers a telemetry integration globally.
8440
- */
8441
- export declare function registerTelemetryIntegration(integration: TelemetryIntegration): void;
8442
-
8443
8005
  /**
8444
8006
  * Removes entries from a record where the value is null or undefined.
8445
8007
  * @param record - The input object whose entries may be null or undefined.
@@ -9045,7 +8607,6 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
9045
8607
  } & Source) | {
9046
8608
  type: 'file';
9047
8609
  file: GeneratedFile;
9048
- providerMetadata?: ProviderMetadata;
9049
8610
  } | ({
9050
8611
  type: 'tool-call';
9051
8612
  } & TypedToolCall<TOOLS>) | ({
@@ -9053,6 +8614,9 @@ declare type SingleRequestTextStreamPart<TOOLS extends ToolSet> = {
9053
8614
  } & TypedToolResult<TOOLS>) | ({
9054
8615
  type: 'tool-error';
9055
8616
  } & TypedToolError<TOOLS>) | {
8617
+ type: 'file';
8618
+ file: GeneratedFile;
8619
+ } | {
9056
8620
  type: 'stream-start';
9057
8621
  warnings: SharedV3Warning[];
9058
8622
  } | {
@@ -9848,33 +9412,6 @@ export declare function stepCountIs(stepCount: number): StopCondition<any>;
9848
9412
  * The result of a single step in the generation process.
9849
9413
  */
9850
9414
  export declare type StepResult<TOOLS extends ToolSet> = {
9851
- /**
9852
- * Zero-based index of this step.
9853
- */
9854
- readonly stepNumber: number;
9855
- /**
9856
- * Information about the model that produced this step.
9857
- */
9858
- readonly model: {
9859
- /** The provider of the model. */
9860
- readonly provider: string;
9861
- /** The ID of the model. */
9862
- readonly modelId: string;
9863
- };
9864
- /**
9865
- * Identifier from telemetry settings for grouping related operations.
9866
- */
9867
- readonly functionId: string | undefined;
9868
- /**
9869
- * Additional metadata from telemetry settings.
9870
- */
9871
- readonly metadata: Record<string, unknown> | undefined;
9872
- /**
9873
- * User-defined context object flowing through the generation.
9874
- *
9875
- * Experimental (can break in patch releases).
9876
- */
9877
- readonly experimental_context: unknown;
9878
9415
  /**
9879
9416
  * The content that was generated in the last step.
9880
9417
  */
@@ -10305,7 +9842,7 @@ declare interface StreamOptions {
10305
9842
  * @returns
10306
9843
  * A result object for accessing different stream types and additional information.
10307
9844
  */
10308
- export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
9845
+ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_2 = Output_2<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_context, experimental_include: include, _internal: { now, generateId }, ...settings }: CallSettings & Prompt & {
10309
9846
  /**
10310
9847
  * The language model to use.
10311
9848
  */
@@ -10412,24 +9949,6 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
10412
9949
  * Callback that is called when each step (LLM call) is finished, including intermediate steps.
10413
9950
  */
10414
9951
  onStepFinish?: StreamTextOnStepFinishCallback<TOOLS>;
10415
- /**
10416
- * Callback that is called when the streamText operation begins,
10417
- * before any LLM calls are made.
10418
- */
10419
- experimental_onStart?: StreamTextOnStartCallback<NoInfer<TOOLS>, OUTPUT>;
10420
- /**
10421
- * Callback that is called when a step (LLM call) begins,
10422
- * before the provider is called.
10423
- */
10424
- experimental_onStepStart?: StreamTextOnStepStartCallback<NoInfer<TOOLS>, OUTPUT>;
10425
- /**
10426
- * Callback that is called right before a tool's execute function runs.
10427
- */
10428
- experimental_onToolCallStart?: StreamTextOnToolCallStartCallback<NoInfer<TOOLS>>;
10429
- /**
10430
- * Callback that is called right after a tool's execute function completes (or errors).
10431
- */
10432
- experimental_onToolCallFinish?: StreamTextOnToolCallFinishCallback<NoInfer<TOOLS>>;
10433
9952
  /**
10434
9953
  * Context that is passed into tool execution.
10435
9954
  *
@@ -10462,13 +9981,6 @@ export declare function streamText<TOOLS extends ToolSet, OUTPUT extends Output_
10462
9981
  };
10463
9982
  }): StreamTextResult<TOOLS, OUTPUT>;
10464
9983
 
10465
- /**
10466
- * Include settings for streamText (requestBody only).
10467
- */
10468
- declare type StreamTextIncludeSettings = {
10469
- requestBody?: boolean;
10470
- };
10471
-
10472
9984
  /**
10473
9985
  * Callback that is set using the `onAbort` option.
10474
9986
  *
@@ -10506,40 +10018,31 @@ export declare type StreamTextOnErrorCallback = (event: {
10506
10018
  *
10507
10019
  * @param event - The event that is passed to the callback.
10508
10020
  */
10509
- export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
10510
-
10511
- /**
10512
- * Callback that is set using the `experimental_onStart` option.
10513
- *
10514
- * Called when the streamText operation begins, before any LLM calls.
10515
- * Use this callback for logging, analytics, or initializing state at the
10516
- * start of a generation.
10517
- *
10518
- * @param event - The event object containing generation configuration.
10519
- */
10520
- export declare type StreamTextOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStartEvent<TOOLS, OUTPUT, StreamTextIncludeSettings>) => PromiseLike<void> | void;
10021
+ export declare type StreamTextOnFinishCallback<TOOLS extends ToolSet> = (event: StepResult<TOOLS> & {
10022
+ /**
10023
+ * Details for all steps.
10024
+ */
10025
+ readonly steps: StepResult<TOOLS>[];
10026
+ /**
10027
+ * Total usage for all steps. This is the sum of the usage of all steps.
10028
+ */
10029
+ readonly totalUsage: LanguageModelUsage;
10030
+ /**
10031
+ * Context that is passed into tool execution.
10032
+ *
10033
+ * Experimental (can break in patch releases).
10034
+ *
10035
+ * @default undefined
10036
+ */
10037
+ experimental_context: unknown;
10038
+ }) => PromiseLike<void> | void;
10521
10039
 
10522
10040
  /**
10523
10041
  * Callback that is set using the `onStepFinish` option.
10524
10042
  *
10525
10043
  * @param stepResult - The result of the step.
10526
10044
  */
10527
- export declare type StreamTextOnStepFinishCallback<TOOLS extends ToolSet> = (event: OnStepFinishEvent<TOOLS>) => PromiseLike<void> | void;
10528
-
10529
- /**
10530
- * Callback that is set using the `experimental_onStepStart` option.
10531
- *
10532
- * Called when a step (LLM call) begins, before the provider is called.
10533
- * Each step represents a single LLM invocation. Multiple steps occur when
10534
- * using tool calls (the model may be called multiple times in a loop).
10535
- *
10536
- * @param event - The event object containing step configuration.
10537
- */
10538
- export declare type StreamTextOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStepStartEvent<TOOLS, OUTPUT, StreamTextIncludeSettings>) => PromiseLike<void> | void;
10539
-
10540
- export declare type StreamTextOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
10541
-
10542
- export declare type StreamTextOnToolCallStartCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallStartEvent<TOOLS>) => PromiseLike<void> | void;
10045
+ export declare type StreamTextOnStepFinishCallback<TOOLS extends ToolSet> = (stepResult: StepResult<TOOLS>) => PromiseLike<void> | void;
10543
10046
 
10544
10047
  /**
10545
10048
  * A result object for accessing different stream types and additional information.
@@ -10770,16 +10273,6 @@ export declare type StreamTextTransform<TOOLS extends ToolSet> = (options: {
10770
10273
  stopStream: () => void;
10771
10274
  }) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
10772
10275
 
10773
- /**
10774
- * Strips file extension segments from a filename.
10775
- *
10776
- * Examples:
10777
- * - "report.pdf" -> "report"
10778
- * - "archive.tar.gz" -> "archive"
10779
- * - "filename" -> "filename"
10780
- */
10781
- declare function stripFileExtension(filename: string): string;
10782
-
10783
10276
  declare const symbol$1: unique symbol;
10784
10277
 
10785
10278
  declare const symbol$1_2: unique symbol;
@@ -10870,19 +10363,6 @@ export declare type SystemModelMessage = {
10870
10363
 
10871
10364
  export declare const systemModelMessageSchema: z.ZodType<SystemModelMessage>;
10872
10365
 
10873
- /**
10874
- * Implement this interface to create custom telemetry integrations.
10875
- * Methods can be sync or return a PromiseLike.
10876
- */
10877
- export declare interface TelemetryIntegration {
10878
- onStart?: Listener<OnStartEvent<ToolSet, Output_2>>;
10879
- onStepStart?: Listener<OnStepStartEvent<ToolSet, Output_2>>;
10880
- onToolCallStart?: Listener<OnToolCallStartEvent<ToolSet>>;
10881
- onToolCallFinish?: Listener<OnToolCallFinishEvent<ToolSet>>;
10882
- onStepFinish?: Listener<OnStepFinishEvent<ToolSet>>;
10883
- onFinish?: Listener<OnFinishEvent<ToolSet>>;
10884
- }
10885
-
10886
10366
  /**
10887
10367
  * Telemetry configuration.
10888
10368
  */
@@ -10917,13 +10397,6 @@ export declare type TelemetrySettings = {
10917
10397
  * A custom tracer to use for the telemetry data.
10918
10398
  */
10919
10399
  tracer?: Tracer;
10920
- /**
10921
- * Per-call telemetry integrations that receive lifecycle events during generation.
10922
- *
10923
- * These integrations run after any globally registered integrations
10924
- * (see `registerTelemetryIntegration`).
10925
- */
10926
- integrations?: TelemetryIntegration | TelemetryIntegration[];
10927
10400
  };
10928
10401
 
10929
10402
  /**
@@ -10996,7 +10469,6 @@ export declare type TextStreamPart<TOOLS extends ToolSet> = {
10996
10469
  } & Source) | {
10997
10470
  type: 'file';
10998
10471
  file: GeneratedFile;
10999
- providerMetadata?: ProviderMetadata;
11000
10472
  } | ({
11001
10473
  type: 'tool-call';
11002
10474
  } & TypedToolCall<TOOLS>) | ({
@@ -11453,30 +10925,49 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OU
11453
10925
  */
11454
10926
  get tools(): TOOLS;
11455
10927
  private prepareCall;
11456
- private mergeCallbacks;
10928
+ private mergeOnStepFinishCallbacks;
11457
10929
  /**
11458
10930
  * Generates an output from the agent (non-streaming).
11459
10931
  */
11460
- generate({ abortSignal, timeout, experimental_onStart, experimental_onStepStart, experimental_onToolCallStart, experimental_onToolCallFinish, onStepFinish, onFinish, ...options }: AgentCallParameters<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
10932
+ generate({ abortSignal, timeout, onStepFinish, ...options }: AgentCallParameters<CALL_OPTIONS, TOOLS>): Promise<GenerateTextResult<TOOLS, OUTPUT>>;
11461
10933
  /**
11462
10934
  * Streams an output from the agent (streaming).
11463
10935
  */
11464
- stream({ abortSignal, timeout, experimental_transform, experimental_onStart, experimental_onStepStart, experimental_onToolCallStart, experimental_onToolCallFinish, onStepFinish, onFinish, ...options }: AgentStreamParameters<CALL_OPTIONS, TOOLS>): Promise<StreamTextResult<TOOLS, OUTPUT>>;
10936
+ stream({ abortSignal, timeout, experimental_transform, onStepFinish, ...options }: AgentStreamParameters<CALL_OPTIONS, TOOLS>): Promise<StreamTextResult<TOOLS, OUTPUT>>;
11465
10937
  }
11466
10938
  export { ToolLoopAgent as Experimental_Agent }
11467
10939
  export { ToolLoopAgent }
11468
10940
 
11469
- export declare type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: OnFinishEvent<TOOLS>) => PromiseLike<void> | void;
11470
-
11471
- export declare type ToolLoopAgentOnStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
11472
-
11473
- export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: OnStepFinishEvent<TOOLS>) => Promise<void> | void;
11474
-
11475
- export declare type ToolLoopAgentOnStepStartCallback<TOOLS extends ToolSet = ToolSet, OUTPUT extends Output_2 = Output_2> = (event: OnStepStartEvent<TOOLS, OUTPUT>) => PromiseLike<void> | void;
11476
-
11477
- export declare type ToolLoopAgentOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallFinishEvent<TOOLS>) => PromiseLike<void> | void;
10941
+ /**
10942
+ * Callback that is set using the `onFinish` option.
10943
+ *
10944
+ * @param event - The event that is passed to the callback.
10945
+ */
10946
+ export declare type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = {}> = (event: StepResult<TOOLS> & {
10947
+ /**
10948
+ * Details for all steps.
10949
+ */
10950
+ readonly steps: StepResult<TOOLS>[];
10951
+ /**
10952
+ * Total usage for all steps. This is the sum of the usage of all steps.
10953
+ */
10954
+ readonly totalUsage: LanguageModelUsage;
10955
+ /**
10956
+ * Context that is passed into tool calls.
10957
+ *
10958
+ * Experimental (can break in patch releases).
10959
+ *
10960
+ * @default undefined
10961
+ */
10962
+ experimental_context?: unknown;
10963
+ }) => PromiseLike<void> | void;
11478
10964
 
11479
- export declare type ToolLoopAgentOnToolCallStartCallback<TOOLS extends ToolSet = ToolSet> = (event: OnToolCallStartEvent<TOOLS>) => PromiseLike<void> | void;
10965
+ /**
10966
+ * Callback that is set using the `onStepFinish` option.
10967
+ *
10968
+ * @param stepResult - The result of the step.
10969
+ */
10970
+ export declare type ToolLoopAgentOnStepFinishCallback<TOOLS extends ToolSet = {}> = (stepResult: StepResult<TOOLS>) => Promise<void> | void;
11480
10971
 
11481
10972
  /**
11482
10973
  * Configuration options for an agent.
@@ -11532,22 +11023,6 @@ declare type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet =
11532
11023
  * A function that attempts to repair a tool call that failed to parse.
11533
11024
  */
11534
11025
  experimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>;
11535
- /**
11536
- * Callback that is called when the agent operation begins, before any LLM calls.
11537
- */
11538
- experimental_onStart?: ToolLoopAgentOnStartCallback<NoInfer<TOOLS>, OUTPUT>;
11539
- /**
11540
- * Callback that is called when a step (LLM call) begins, before the provider is called.
11541
- */
11542
- experimental_onStepStart?: ToolLoopAgentOnStepStartCallback<NoInfer<TOOLS>, OUTPUT>;
11543
- /**
11544
- * Callback that is called before each tool execution begins.
11545
- */
11546
- experimental_onToolCallStart?: ToolLoopAgentOnToolCallStartCallback<NoInfer<TOOLS>>;
11547
- /**
11548
- * Callback that is called after each tool execution completes.
11549
- */
11550
- experimental_onToolCallFinish?: ToolLoopAgentOnToolCallFinishCallback<NoInfer<TOOLS>>;
11551
11026
  /**
11552
11027
  * Callback that is called when each step (LLM call) is finished, including intermediate steps.
11553
11028
  */
@@ -12732,27 +12207,6 @@ export declare type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage
12732
12207
  finishReason?: FinishReason;
12733
12208
  }) => PromiseLike<void> | void;
12734
12209
 
12735
- /**
12736
- * Callback that is called when a step finishes during streaming.
12737
- * This is useful for persisting intermediate UI messages during multi-step agent runs.
12738
- */
12739
- export declare type UIMessageStreamOnStepFinishCallback<UI_MESSAGE extends UIMessage> = (event: {
12740
- /**
12741
- * The updated list of UI messages at the end of this step.
12742
- */
12743
- messages: UI_MESSAGE[];
12744
- /**
12745
- * Indicates whether the response message is a continuation of the last original message,
12746
- * or if a new message was created.
12747
- */
12748
- isContinuation: boolean;
12749
- /**
12750
- * The message that was sent to the client as a response
12751
- * (including the original message if it was extended).
12752
- */
12753
- responseMessage: UI_MESSAGE;
12754
- }) => PromiseLike<void> | void;
12755
-
12756
12210
  export declare type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
12757
12211
  /**
12758
12212
  * The original messages. If they are provided, persistence mode is assumed,
@@ -13041,15 +12495,6 @@ export declare type UserModelMessage = {
13041
12495
 
13042
12496
  export declare const userModelMessageSchema: z.ZodType<UserModelMessage>;
13043
12497
 
13044
- /**
13045
- * Validates that a URL is safe to download from, blocking private/internal addresses
13046
- * to prevent SSRF attacks.
13047
- *
13048
- * @param url - The URL string to validate.
13049
- * @throws DownloadError if the URL is unsafe.
13050
- */
13051
- declare function validateDownloadUrl(url: string): void;
13052
-
13053
12498
  /**
13054
12499
  * Validates the types of an unknown object using a schema and
13055
12500
  * return a strongly-typed object.
@@ -13489,5 +12934,5 @@ export declare function zodSchema<OBJECT>(zodSchema: z4.core.$ZodType<OBJECT, an
13489
12934
  }): Schema<OBJECT>;
13490
12935
 
13491
12936
  export { }
13492
- export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, ToolResultOutput as ToolResultOutput, ToolNeedsApprovalFunction as ToolNeedsApprovalFunction, TypeValidationContext as TypeValidationContext, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, EmbeddingModelV2 as EmbeddingModelV2, EmbeddingModelV3Embedding as EmbeddingModelV3Embedding, EmbeddingModelV3Middleware as EmbeddingModelV3Middleware, ImageModelV2 as ImageModelV2, ImageModelV3ProviderMetadata as ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, ImageModelV3Middleware as ImageModelV3Middleware, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2 as LanguageModelV2, SharedV3Warning as SharedV3Warning, LanguageModelV3Middleware as LanguageModelV3Middleware, SharedV3ProviderMetadata as SharedV3ProviderMetadata, SpeechModelV2 as SpeechModelV2, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV3Usage as ImageModelV3Usage, BaseToolCall as BaseToolCall, Source as Source, DeepPartialInternal as DeepPartialInternal, CallbackModelInfo as CallbackModelInfo, LanguageModelV3ToolChoice as LanguageModelV3ToolChoice, Listener as Listener, AttributeValue as AttributeValue, Tracer as Tracer, LanguageModelV3ToolCall as LanguageModelV3ToolCall, GenerateTextIncludeSettings as GenerateTextIncludeSettings, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextIncludeSettings as StreamTextIncludeSettings, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ResponseMessage as ResponseMessage, MaybePromiseLike as MaybePromiseLike, Output_2 as Output_2, InferAgentTools as InferAgentTools, UIMessageStreamResponseInit as UIMessageStreamResponseInit, getOriginalFetch as getOriginalFetch, InferUIMessageToolCall as InferUIMessageToolCall, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, GenerateImagePrompt as GenerateImagePrompt, JSONValue_2 as JSONValue_2, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModel as VideoModel, EmbeddingModelV3CallOptions as EmbeddingModelV3CallOptions, LanguageModelV3CallOptions as LanguageModelV3CallOptions, JSONObject as JSONObject, LanguageModelV3 as LanguageModelV3, EmbeddingModelV3 as EmbeddingModelV3, ImageModelV3 as ImageModelV3, TranscriptionModelV3 as TranscriptionModelV3, SpeechModelV3 as SpeechModelV3, RerankingModelV3 as RerankingModelV3, VideoModelV3 as VideoModelV3, ProviderV2 as ProviderV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV3 as ProviderV3 };
12937
+ export { GatewayProviderSettings as GatewayProviderSettings, GatewayProvider as GatewayProvider, LazySchema as LazySchema, ZodSchema as ZodSchema, StandardSchema as StandardSchema, ValidationResult as ValidationResult, ParseResult as ParseResult, ProviderOptions as ProviderOptions, ReasoningPart as ReasoningPart, ToolOutputProperties as ToolOutputProperties, ToolResultOutput as ToolResultOutput, ToolNeedsApprovalFunction as ToolNeedsApprovalFunction, TypeValidationContext as TypeValidationContext, JSONSchema7Version as JSONSchema7Version, JSONSchema7Definition as JSONSchema7Definition, JSONSchema7TypeName as JSONSchema7TypeName, JSONSchema7Type as JSONSchema7Type, EmbeddingModelV2 as EmbeddingModelV2, EmbeddingModelV3Embedding as EmbeddingModelV3Embedding, EmbeddingModelV3Middleware as EmbeddingModelV3Middleware, ImageModelV2 as ImageModelV2, ImageModelV3ProviderMetadata as ImageModelV3ProviderMetadata, ImageModelV2ProviderMetadata as ImageModelV2ProviderMetadata, ImageModelV3Middleware as ImageModelV3Middleware, GlobalProviderModelId as GlobalProviderModelId, LanguageModelV2 as LanguageModelV2, SharedV3Warning as SharedV3Warning, LanguageModelV3Middleware as LanguageModelV3Middleware, SharedV3ProviderMetadata as SharedV3ProviderMetadata, SpeechModelV2 as SpeechModelV2, TranscriptionModelV2 as TranscriptionModelV2, ImageModelV3Usage as ImageModelV3Usage, BaseToolCall as BaseToolCall, Source as Source, DeepPartialInternal as DeepPartialInternal, AttributeValue as AttributeValue, Tracer as Tracer, LanguageModelV3ToolCall as LanguageModelV3ToolCall, ValueOf as ValueOf, asUITool as asUITool, _ai_sdk_provider_utils as _ai_sdk_provider_utils, _ai_sdk_provider as _ai_sdk_provider, DataUIMessageChunk as DataUIMessageChunk, InferElementOutput as InferElementOutput, ConsumeStreamOptions as ConsumeStreamOptions, StreamTextOnAbortCallback as StreamTextOnAbortCallback, ResponseMessage as ResponseMessage, Output_2 as Output_2, MaybePromiseLike as MaybePromiseLike, InferAgentTools as InferAgentTools, UIMessageStreamResponseInit as UIMessageStreamResponseInit, getOriginalFetch as getOriginalFetch, InferUIMessageToolCall as InferUIMessageToolCall, UIDataTypesToSchemas as UIDataTypesToSchemas, InferUIMessageData as InferUIMessageData, InferUIMessageMetadata as InferUIMessageMetadata, InferUIMessageTools as InferUIMessageTools, Resolvable as Resolvable, FetchFunction as FetchFunction, SingleRequestTextStreamPart as SingleRequestTextStreamPart, RetryErrorReason as RetryErrorReason, GenerateImagePrompt as GenerateImagePrompt, JSONValue_2 as JSONValue_2, Job as Job, StreamObjectOnErrorCallback as StreamObjectOnErrorCallback, VideoModelResponseMetadata as VideoModelResponseMetadata, VideoModelProviderMetadata as VideoModelProviderMetadata, VideoModel as VideoModel, EmbeddingModelV3CallOptions as EmbeddingModelV3CallOptions, LanguageModelV3CallOptions as LanguageModelV3CallOptions, JSONObject as JSONObject, LanguageModelV3 as LanguageModelV3, EmbeddingModelV3 as EmbeddingModelV3, ImageModelV3 as ImageModelV3, TranscriptionModelV3 as TranscriptionModelV3, SpeechModelV3 as SpeechModelV3, RerankingModelV3 as RerankingModelV3, ProviderV2 as ProviderV2, ExtractModelId as ExtractModelId, ExtractLiteralUnion as ExtractLiteralUnion, ProviderV3 as ProviderV3 };
13493
12938
  export { 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$a_2, symbol$b, symbol$b_2, symbol$c, symbol$c_2, symbol$d, symbol$d_2, symbol$e, symbol$f, symbol$g, symbol$h, symbol$i, symbol$j, symbol, symbol_2, symbol_3 };