ai 7.0.97 → 7.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { EmbeddingModelV4Embedding, EmbeddingModelV4, EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV4Middleware, ImageModelV4ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV4, ImageModelV3, ImageModelV2, ImageModelV4Middleware, JSONValue as JSONValue$1, LanguageModelV4Source, SharedV4Warning, LanguageModelV4, LanguageModelV3, LanguageModelV2, LanguageModelV4Middleware, RerankingModelV4, RerankingModelV3, SharedV4ProviderMetadata, SharedV4ProviderReference, SpeechModelV4, SpeechModelV3, SpeechModelV2, TranscriptionModelV4, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV4Usage, LanguageModelV4CallOptions, LanguageModelV4Prompt, AISDKError, LanguageModelV4ToolCall, JSONSchema7, ProviderV4, ProviderV3, ProviderV2, Experimental_BatchV4Status, Experimental_BatchV4Error, Experimental_BatchV4, Experimental_BatchV4ModelIds, Experimental_BatchV4StartResult, SharedV4Headers, LanguageModelV4ToolChoice, LanguageModelV4Content, JSONParseError, TypeValidationError, Experimental_VideoModelV4, Experimental_VideoModelV3, Experimental_VideoModelV4FrameType, Experimental_VideoModelV4OperationWebhook, Experimental_VideoModelV4OperationStatusResult, EmbeddingModelV4CallOptions, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4SessionConfig, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeFactoryV4, Experimental_RealtimeFactoryV4GetTokenOptions, Experimental_RealtimeFactoryV4GetTokenResult, Experimental_RealtimeModelV4ToolDefinition, FilesV4, SkillsV4, NoSuchModelError, SharedV4AudioFormat, Experimental_SpeechTranslationModelV4, Experimental_SpeechTranslationModelV4Usage, FilesV4UploadFileCallOptions, SkillsV4UploadSkillResult, SkillsV4UploadSkillCallOptions, SkillsV4File } from '@ai-sdk/provider';
1
+ import { EmbeddingModelV4Embedding, EmbeddingModelV4, EmbeddingModelV3, EmbeddingModelV2, EmbeddingModelV4Middleware, ImageModelV4ProviderMetadata, ImageModelV2ProviderMetadata, ImageModelV4, ImageModelV3, ImageModelV2, ImageModelV4Middleware, JSONValue as JSONValue$1, LanguageModelV4Source, SharedV4Warning, LanguageModelV4, LanguageModelV3, LanguageModelV2, LanguageModelV4Middleware, RerankingModelV4, RerankingModelV3, SharedV4ProviderMetadata, SharedV4ProviderReference, SpeechModelV4, SpeechModelV3, SpeechModelV2, TranscriptionModelV4, TranscriptionModelV3, TranscriptionModelV2, JSONObject, ImageModelV4Usage, LanguageModelV4CallOptions, LanguageModelV4Prompt, AISDKError, LanguageModelV4ToolCall, JSONSchema7, ProviderV4, ProviderV3, ProviderV2, SharedV4Headers, Experimental_BatchV4Status, Experimental_BatchV4Error, Experimental_BatchV4, Experimental_BatchV4ModelIds, Experimental_BatchV4StartResult, LanguageModelV4ToolChoice, LanguageModelV4Content, JSONParseError, TypeValidationError, Experimental_VideoModelV4, Experimental_VideoModelV3, Experimental_VideoModelV4FrameType, Experimental_VideoModelV4OperationWebhook, Experimental_VideoModelV4OperationStatusResult, EmbeddingModelV4CallOptions, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4SessionConfig, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeFactoryV4, Experimental_RealtimeFactoryV4GetTokenOptions, Experimental_RealtimeFactoryV4GetTokenResult, Experimental_RealtimeModelV4ToolDefinition, FilesV4, SkillsV4, NoSuchModelError, SharedV4AudioFormat, Experimental_SpeechTranslationModelV4, Experimental_SpeechTranslationModelV4Usage, FilesV4UploadFileCallOptions, SkillsV4UploadSkillResult, SkillsV4UploadSkillCallOptions, SkillsV4File } from '@ai-sdk/provider';
2
2
  export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, JSONSchema7, LoadAPIKeyError, LoadSettingError, NoContentGeneratedError, NoSuchModelError, NoSuchProviderReferenceError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
3
3
  import { GatewayModelId } from '@ai-sdk/gateway';
4
4
  export { GatewayAsyncJobMetadata, GatewayModelId, GatewayProviderMetadata, createGateway, gateway } from '@ai-sdk/gateway';
5
5
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
6
- import { ModelMessage, AssistantModelMessage, ToolModelMessage, ProviderOptions, ToolSet, SystemModelMessage, UserModelMessage, DataContent, FlexibleSchema, InferSchema, Context, InferToolSetContext, Arrayable, InferToolInput, InferToolOutput, ReasoningPart, ReasoningFilePart, Experimental_SandboxSession, Tool, ToolCall, IdGenerator, MaybePromiseLike, ToolExecutionOptions, InferToolContext, Experimental_ToolCallerTool, HasRequiredKey, TextPart, FilePart, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
6
+ import { ModelMessage, AssistantModelMessage, ToolModelMessage, Context, ProviderOptions, ToolSet, SystemModelMessage, UserModelMessage, DataContent, FlexibleSchema, InferSchema, InferToolSetContext, Arrayable, InferToolInput, InferToolOutput, ReasoningPart, ReasoningFilePart, Experimental_SandboxSession, Tool, ToolCall, IdGenerator, MaybePromiseLike, ToolExecutionOptions, InferToolContext, Experimental_ToolCallerTool, HasRequiredKey, TextPart, FilePart, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
7
7
  export { AssistantContent, AssistantModelMessage, DataContent, DownloadError, Experimental_SandboxProcess, Experimental_SandboxSession, Experimental_ToolCallerTool, FilePart, FlexibleSchema, IdGenerator, ImagePart, InferSchema, InferToolInput, InferToolOutput, ModelMessage, Schema, SystemModelMessage, TextPart, Tool, ToolApprovalRequest, ToolApprovalResponse, ToolCallPart, ToolContent, ToolExecuteFunction, ToolExecutionOptions, ToolModelMessage, ToolResultPart, ToolSet, UserContent, UserModelMessage, asSchema, createIdGenerator, dynamicTool, experimental_toolCaller, generateId, jsonSchema, parseJsonEventStream, tool, zodSchema } from '@ai-sdk/provider-utils';
8
8
  import { ServerResponse } from 'node:http';
9
9
  import { ServerResponse as ServerResponse$1 } from 'http';
@@ -420,7 +420,9 @@ type LogWarningsFunction = (options: {
420
420
  *
421
421
  * Called when the operation begins, before the embedding model is called.
422
422
  */
423
- type EmbedStartEvent = {
423
+ type EmbedStartEvent<RUNTIME_CONTEXT extends Context = Context> = {
424
+ /** User-defined runtime context. */
425
+ readonly runtimeContext: RUNTIME_CONTEXT;
424
426
  /** Unique identifier for this embed call, used to correlate events. */
425
427
  readonly callId: string;
426
428
  /** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
@@ -443,7 +445,9 @@ type EmbedStartEvent = {
443
445
  *
444
446
  * Called when the operation completes, after the embedding model returns.
445
447
  */
446
- type EmbedEndEvent = {
448
+ type EmbedEndEvent<RUNTIME_CONTEXT extends Context = Context> = {
449
+ /** User-defined runtime context. */
450
+ readonly runtimeContext: RUNTIME_CONTEXT;
447
451
  /** Unique identifier for this embed call, used to correlate events. */
448
452
  readonly callId: string;
449
453
  /** Identifies the operation type (e.g. 'ai.embed' or 'ai.embedMany'). */
@@ -2240,6 +2244,15 @@ type DynamicToolUIPart = {
2240
2244
  signature?: string;
2241
2245
  };
2242
2246
  });
2247
+ /**
2248
+ * A static or dynamic tool UI part whose execution failed.
2249
+ *
2250
+ * Use `isToolOutputErrorUIPart` to identify tool output errors without
2251
+ * depending on the underlying tool state discriminator.
2252
+ */
2253
+ type ToolOutputErrorUIPart<TOOLS extends UITools = UITools> = Extract<ToolUIPart<TOOLS> | DynamicToolUIPart, {
2254
+ state: 'output-error';
2255
+ }>;
2243
2256
  /**
2244
2257
  * Type guard to check if a message part is a text part.
2245
2258
  */
@@ -2280,6 +2293,12 @@ declare function isDynamicToolUIPart(part: UIMessagePart<UIDataTypes, UITools>):
2280
2293
  * Use `isStaticToolUIPart` or `isDynamicToolUIPart` to check the type of the tool.
2281
2294
  */
2282
2295
  declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS> | DynamicToolUIPart;
2296
+ /**
2297
+ * Check if a message part is a tool output error part.
2298
+ *
2299
+ * This works for both static and dynamic tools.
2300
+ */
2301
+ declare function isToolOutputErrorUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolOutputErrorUIPart<TOOLS>;
2283
2302
  /**
2284
2303
  * Returns the name of the static tool.
2285
2304
  *
@@ -4171,7 +4190,9 @@ type GenerateTextOnFinishCallback<TOOLS extends ToolSet = ToolSet, RUNTIME_CONTE
4171
4190
  *
4172
4191
  * Called when the operation begins, before the reranking model is called.
4173
4192
  */
4174
- type RerankStartEvent = {
4193
+ type RerankStartEvent<RUNTIME_CONTEXT extends Context = Context> = {
4194
+ /** User-defined runtime context. */
4195
+ readonly runtimeContext: RUNTIME_CONTEXT;
4175
4196
  /** Unique identifier for this rerank call, used to correlate events. */
4176
4197
  readonly callId: string;
4177
4198
  /** Identifies the operation type ('ai.rerank'). */
@@ -4197,7 +4218,9 @@ type RerankStartEvent = {
4197
4218
  *
4198
4219
  * Called when the operation completes, after the reranking model returns.
4199
4220
  */
4200
- type RerankEndEvent = {
4221
+ type RerankEndEvent<RUNTIME_CONTEXT extends Context = Context> = {
4222
+ /** User-defined runtime context. */
4223
+ readonly runtimeContext: RUNTIME_CONTEXT;
4201
4224
  /** Unique identifier for this rerank call, used to correlate events. */
4202
4225
  readonly callId: string;
4203
4226
  /** Identifies the operation type ('ai.rerank'). */
@@ -5975,7 +5998,10 @@ type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
5975
5998
  [NAME in keyof InferUIMessageData<UI_MESSAGE> & string]?: FlexibleSchema<InferUIMessageData<UI_MESSAGE>[NAME]>;
5976
5999
  };
5977
6000
  tools?: {
5978
- [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
6001
+ [NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: Tool<InferUIMessageTools<UI_MESSAGE>[NAME]['input'], InferUIMessageTools<UI_MESSAGE>[NAME]['output']> | {
6002
+ inputSchema: FlexibleSchema<InferUIMessageTools<UI_MESSAGE>[NAME]['input']>;
6003
+ outputSchema?: FlexibleSchema<InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
6004
+ };
5979
6005
  };
5980
6006
  };
5981
6007
  /**
@@ -6229,84 +6255,468 @@ declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends
6229
6255
  onStepFinish?: GenerateTextOnStepFinishCallback<TOOLS>;
6230
6256
  } & UIMessageStreamResponseInit & UIMessageStreamOptions<UIMessage<MESSAGE_METADATA, never, InferUITools<TOOLS>>>): Promise<void>;
6231
6257
 
6258
+ type ActiveToolSubset<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>> = TOOLS extends undefined ? undefined : [ACTIVE_TOOL_NAMES] extends [NonNullable<ActiveTools<NonNullable<TOOLS>>>] ? Pick<NonNullable<TOOLS>, ACTIVE_TOOL_NAMES[number]> : TOOLS;
6232
6259
  /**
6233
- * Provider or lower-level batch interface used for batch processing.
6234
- */
6235
- type BatchProvider = ProviderV4 | Experimental_BatchV4;
6236
- type InferBatchModelIds<PROVIDER extends BatchProvider> = PROVIDER extends Experimental_BatchV4<infer MODEL_IDS> ? MODEL_IDS : PROVIDER extends {
6237
- experimental_batch(): Experimental_BatchV4<infer MODEL_IDS>;
6238
- } ? MODEL_IDS : Experimental_BatchV4ModelIds;
6239
- /**
6240
- * The persisted reference for a batch.
6260
+ * Filters the tools to only include the active tools.
6261
+ * When activeTools is provided, we only include the tools that are in the list.
6262
+ *
6263
+ * @param tools - The tools to filter.
6264
+ * @param activeTools - The active tools to include.
6265
+ * @returns The filtered tools.
6241
6266
  */
6242
- type BatchReference = {
6243
- readonly version: 2;
6244
- readonly id: string;
6245
- readonly provider: string;
6246
- };
6267
+ declare function filterActiveTools<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>>({ tools, activeTools, }: {
6268
+ tools: TOOLS;
6269
+ activeTools: ACTIVE_TOOL_NAMES;
6270
+ }): ActiveToolSubset<TOOLS, ACTIVE_TOOL_NAMES>;
6271
+
6247
6272
  /**
6248
- * Serializable error information for a batch or batch item.
6273
+ * Prunes model messages from a list of model messages.
6274
+ *
6275
+ * @param messages - The list of model messages to prune.
6276
+ * @param reasoning - How to remove reasoning content from assistant messages. Default is `'none'`.
6277
+ * @param toolCalls - How to prune tool call/results/approval content. Default is `[]`.
6278
+ * @param emptyMessages - Whether to keep or remove messages whose content is empty after pruning. Default is `'remove'`.
6279
+ *
6280
+ * @returns The pruned list of model messages.
6249
6281
  */
6250
- type BatchError = Experimental_BatchV4Error;
6282
+ declare function pruneMessages({ messages, reasoning, toolCalls, emptyMessages, }: {
6283
+ messages: ModelMessage[];
6284
+ reasoning?: 'all' | 'before-last-message' | 'none';
6285
+ toolCalls?: 'all' | 'before-last-message' | `before-last-${number}-messages` | 'none' | Array<{
6286
+ type: 'all' | 'before-last-message' | `before-last-${number}-messages`;
6287
+ tools?: string[];
6288
+ }>;
6289
+ emptyMessages?: 'keep' | 'remove';
6290
+ }): ModelMessage[];
6291
+
6251
6292
  /**
6252
- * The latest normalized lifecycle status for a batch.
6293
+ * Detects the first chunk in a buffer.
6294
+ *
6295
+ * @param buffer - The buffer to detect the first chunk in.
6296
+ *
6297
+ * @returns The first detected chunk, or `undefined` if no chunk was detected.
6253
6298
  */
6254
- type BatchStatus = Experimental_BatchV4Status;
6299
+ type ChunkDetector = (buffer: string) => string | undefined | null;
6255
6300
  /**
6256
- * A batch and its latest normalized lifecycle status.
6301
+ * Smooths text and reasoning streaming output.
6302
+ *
6303
+ * @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.
6304
+ * @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, provide a custom RegExp pattern that does not match the empty string for custom chunking, provide an Intl.Segmenter for locale-aware word segmentation (recommended for CJK languages), or provide a custom ChunkDetector function.
6305
+ *
6306
+ * @returns A transform stream that smooths text streaming output.
6257
6307
  */
6258
- type Batch = BatchReference & BatchStatus;
6308
+ declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunking, _internal: { delay }, }?: {
6309
+ delayInMs?: number | null;
6310
+ chunking?: 'word' | 'line' | RegExp | ChunkDetector | Intl.Segmenter;
6311
+ /**
6312
+ * Internal. For test use only. May change without notice.
6313
+ */
6314
+ _internal?: {
6315
+ delay?: (delayInMs: number | null) => Promise<void>;
6316
+ };
6317
+ }): (options: {
6318
+ tools: TOOLS;
6319
+ }) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
6320
+
6321
+ type LanguageModelStreamPart<TOOLS extends ToolSet = ToolSet> = Exclude<TextStreamPart<TOOLS>, {
6322
+ type: 'finish' | 'stream-start' | 'tool-output-denied' | 'start-step' | 'finish-step' | 'start' | 'abort';
6323
+ }> | TextStreamTextDeltaPart | TextStreamReasoningDeltaPart | TextStreamFilePart | TextStreamReasoningFilePart | TextStreamToolApprovalRequestPart<TOOLS> | TextStreamToolApprovalResponsePart<TOOLS> | TextStreamToolCallPart<TOOLS> | TextStreamToolResultPart<TOOLS> | TextStreamToolErrorPart<TOOLS> | {
6324
+ type: 'model-call-end';
6325
+ finishReason: FinishReason;
6326
+ rawFinishReason: string | undefined;
6327
+ usage: LanguageModelUsage;
6328
+ providerMetadata?: ProviderMetadata;
6329
+ performance: {
6330
+ responseTimeMs: number;
6331
+ effectiveOutputTokensPerSecond: number;
6332
+ outputTokensPerSecond: number | undefined;
6333
+ inputTokensPerSecond: number | undefined;
6334
+ effectiveTotalTokensPerSecond: number;
6335
+ timeToFirstOutputMs: number | undefined;
6336
+ timeBetweenOutputChunksMs?: OutputChunkTimingStats;
6337
+ };
6338
+ } | {
6339
+ type: 'model-call-start';
6340
+ warnings: Array<CallWarning>;
6341
+ } | {
6342
+ type: 'model-call-response-metadata';
6343
+ /**
6344
+ * ID for the generated response, if the provider sends one.
6345
+ */
6346
+ id?: string;
6347
+ /**
6348
+ * Timestamp for the start of the generated response, if the provider sends one.
6349
+ */
6350
+ timestamp?: Date;
6351
+ /**
6352
+ * The ID of the response model that was used to generate the response, if the provider sends one.
6353
+ */
6354
+ modelId?: string;
6355
+ };
6259
6356
  /**
6260
- * One text generation request within a batch.
6357
+ * Streams a single language model call after standardizing the prompt and tools.
6358
+ *
6359
+ * The returned stream emits model call parts together with request and response
6360
+ * metadata when available.
6361
+ *
6362
+ * @param model - The language model to use.
6363
+ * @param tools - Tools that are accessible to and can be called by the model. The model needs to support calling tools.
6364
+ * @param output - Output configuration that controls the response format requested from the model.
6365
+ * @param toolChoice - The tool choice strategy for the model call.
6366
+ *
6367
+ * @param system - A system message that will be part of the prompt.
6368
+ * @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
6369
+ * @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
6370
+ * @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. Default: false.
6371
+ *
6372
+ * @param maxOutputTokens - Maximum number of tokens to generate.
6373
+ * @param temperature - Temperature setting.
6374
+ * The value is passed through to the provider. The range depends on the provider and model.
6375
+ * It is recommended to set either `temperature` or `topP`, but not both.
6376
+ * @param topP - Nucleus sampling.
6377
+ * The value is passed through to the provider. The range depends on the provider and model.
6378
+ * It is recommended to set either `temperature` or `topP`, but not both.
6379
+ * @param topK - Only sample from the top K options for each subsequent token.
6380
+ * Used to remove "long tail" low probability responses.
6381
+ * Recommended for advanced use cases only. You usually only need to use temperature.
6382
+ * @param presencePenalty - Presence penalty setting.
6383
+ * It affects the likelihood of the model to repeat information that is already in the prompt.
6384
+ * The value is passed through to the provider. The range depends on the provider and model.
6385
+ * @param frequencyPenalty - Frequency penalty setting.
6386
+ * It affects the likelihood of the model to repeatedly use the same words or phrases.
6387
+ * The value is passed through to the provider. The range depends on the provider and model.
6388
+ * @param stopSequences - Stop sequences.
6389
+ * If set, the model will stop generating text when one of the stop sequences is generated.
6390
+ * @param seed - The seed (integer) to use for random sampling.
6391
+ * If set and supported by the model, calls will generate deterministic results.
6392
+ * @param reasoning - Reasoning configuration for the model call.
6393
+ *
6394
+ * @param download - A function that downloads URLs as part of prompt conversion.
6395
+ * @param abortSignal - An optional abort signal that can be used to cancel the call.
6396
+ * @param headers - Additional HTTP headers to be sent with the request.
6397
+ * @param includeRawChunks - Whether to include raw provider stream chunks in the model stream.
6398
+ * @param providerOptions - Additional provider-specific options.
6399
+ * @param repairToolCall - A function that can repair invalid tool calls before they are emitted.
6400
+ * @param refineToolInput - Optional mapping of tool names to functions that refine parsed tool inputs before they are emitted, used for telemetry, or executed.
6401
+ * @param onStart - A callback that receives the fully converted prompt before the model call starts.
6402
+ *
6403
+ * @returns A stream of model call parts together with request and response metadata when available.
6261
6404
  */
6262
- type TextBatchRequest<ModelId extends string = string, TOOLS extends ToolSet = ToolSet> = Prompt & LanguageModelCallOptions & {
6263
- id: string;
6264
- type: 'text';
6265
- model: ModelId;
6405
+ declare function streamLanguageModelCall<TOOLS extends ToolSet, OUTPUT extends Output = Output>({ model, tools, toolOrder, output, toolChoice, prompt, system, instructions, messages, allowSystemInMessages, download, abortSignal, headers, includeRawChunks, providerOptions, repairToolCall, refineToolInput, executeLanguageModelCallInTelemetryContext, callId, toolsContext, experimental_sandbox: sandbox, _internal: { generateId, generateCallId, now, }, onStart, onLanguageModelCallStart, onLanguageModelCallEnd, ...callSettings }: {
6406
+ model: LanguageModel;
6266
6407
  tools?: TOOLS;
6267
- toolChoice?: ToolChoice<NoInfer<TOOLS>>;
6268
6408
  toolOrder?: ToolOrder<TOOLS>;
6269
- toolsContext?: InferToolSetContext<TOOLS>;
6270
- providerOptions?: ProviderOptions;
6271
- };
6272
- /**
6273
- * One request within a batch, discriminated by modality.
6274
- */
6275
- type BatchRequest<ModelIds extends Experimental_BatchV4ModelIds = Experimental_BatchV4ModelIds, TOOLS extends ToolSet = ToolSet> = TextBatchRequest<ModelIds['text'], TOOLS>;
6276
- type BatchCallOptions = {
6409
+ output?: OUTPUT;
6410
+ toolChoice?: ToolChoice<TOOLS>;
6411
+ download?: DownloadFunction;
6277
6412
  abortSignal?: AbortSignal;
6278
6413
  headers?: Record<string, string | undefined>;
6279
- timeout?: number | {
6280
- totalMs?: number;
6281
- };
6282
- };
6283
- /**
6284
- * Options for starting a batch.
6285
- */
6286
- type StartBatchOptions<TOOLS extends ToolSet = ToolSet, PROVIDER extends BatchProvider = BatchProvider> = {
6414
+ includeRawChunks?: boolean;
6415
+ providerOptions?: ProviderOptions;
6416
+ repairToolCall?: ToolCallRepairFunction<TOOLS> | undefined;
6417
+ refineToolInput?: ToolInputRefinement<TOOLS> | undefined;
6418
+ executeLanguageModelCallInTelemetryContext?: Telemetry['executeLanguageModelCall'];
6419
+ callId?: string;
6287
6420
  /**
6288
- * Provider used to process the batch. Defaults to the global provider, or
6289
- * the Vercel AI Gateway when no global provider is configured.
6421
+ * Tool context used to resolve per-call tool metadata such as function
6422
+ * descriptions before sending tools to the model.
6290
6423
  */
6291
- provider?: PROVIDER;
6292
- requests: ReadonlyArray<BatchRequest<InferBatchModelIds<PROVIDER>, TOOLS>>;
6293
- providerOptions?: ProviderOptions;
6424
+ toolsContext?: InferToolSetContext<TOOLS>;
6294
6425
  /**
6295
- * URL that the provider should notify when the batch reaches a terminal
6296
- * state. Providers that do not support completion webhooks return an
6297
- * unsupported warning.
6426
+ * Sandbox session passed through for resolving tool descriptions that depend on it.
6298
6427
  */
6299
- webhookUrl?: string;
6300
- } & BatchCallOptions;
6428
+ experimental_sandbox?: Experimental_SandboxSession;
6429
+ _internal?: {
6430
+ generateId?: IdGenerator;
6431
+ generateCallId?: IdGenerator;
6432
+ now?: () => number;
6433
+ };
6434
+ onLanguageModelCallStart?: Arrayable<OnLanguageModelCallStartCallback>;
6435
+ onLanguageModelCallEnd?: Arrayable<OnLanguageModelCallEndCallback<TOOLS>>;
6436
+ onStart?: (args: {
6437
+ promptMessages: LanguageModelV4Prompt;
6438
+ }) => Promise<void> | void;
6439
+ } & Prompt & LanguageModelCallOptions): Promise<{
6440
+ stream: AsyncIterableStream<LanguageModelStreamPart<TOOLS>>;
6441
+ request?: {
6442
+ /**
6443
+ * Request HTTP body that was sent to the provider API.
6444
+ */
6445
+ body?: unknown;
6446
+ };
6447
+ response?: {
6448
+ /**
6449
+ * Response headers.
6450
+ */
6451
+ headers?: SharedV4Headers;
6452
+ };
6453
+ }>;
6454
+
6301
6455
  /**
6302
- * The acknowledged batch and warnings produced while starting it.
6456
+ * Fingerprint the server-controlled, security-relevant fields of each tool in a
6457
+ * `ToolSet`: `description` (string form only), the resolved input JSON schema,
6458
+ * and `title`. Returns a map of tool name to a stable digest.
6459
+ *
6460
+ * Capture a baseline at trust time (first connect, human-reviewed) and compare
6461
+ * later fetches with {@link detectToolDrift} to catch MCP tool-definition drift
6462
+ * ("rug pull"). Baseline storage and the drift response are the app's concern.
6303
6463
  */
6304
- type StartBatchResult = Batch & {
6305
- readonly warnings: Experimental_BatchV4StartResult['warnings'];
6306
- };
6464
+ declare function fingerprintTools(tools: ToolSet): Promise<Record<string, string>>;
6307
6465
  /**
6308
- * Options for requesting cancellation of a batch.
6309
- */
6466
+ * Pure diff of two fingerprint maps produced by {@link fingerprintTools}.
6467
+ * `added`/`removed` are tools present in only one map; `changed` are tools whose
6468
+ * pinned definition differs. Uses own-property lookups so a tool literally named
6469
+ * `constructor` or `toString` diffs correctly.
6470
+ */
6471
+ declare function detectToolDrift(current: Record<string, string>, baseline: Record<string, string>): {
6472
+ added: string[];
6473
+ removed: string[];
6474
+ changed: string[];
6475
+ };
6476
+
6477
+ /**
6478
+ * The result of one underlying image model call.
6479
+ */
6480
+ interface GenerateImageCall {
6481
+ /**
6482
+ * The images generated by this call.
6483
+ */
6484
+ readonly images: Array<GeneratedFile>;
6485
+ /**
6486
+ * Provider-specific metadata for this call.
6487
+ */
6488
+ readonly providerMetadata?: ImageModelV4ProviderMetadata;
6489
+ /**
6490
+ * Response metadata from the provider.
6491
+ */
6492
+ readonly response: ImageModelResponseMetadata;
6493
+ /**
6494
+ * Warnings for this call, e.g. unsupported settings.
6495
+ */
6496
+ readonly warnings: Array<Warning>;
6497
+ /**
6498
+ * Token usage for this call, if reported by the provider.
6499
+ */
6500
+ readonly usage?: ImageModelUsage;
6501
+ }
6502
+ /**
6503
+ * The result of a `generateImage` call.
6504
+ * It contains the images and additional information.
6505
+ */
6506
+ interface GenerateImageResult {
6507
+ /**
6508
+ * The first image that was generated.
6509
+ */
6510
+ readonly image: GeneratedFile;
6511
+ /**
6512
+ * The images that were generated.
6513
+ */
6514
+ readonly images: Array<GeneratedFile>;
6515
+ /**
6516
+ * The results of the underlying image model calls.
6517
+ */
6518
+ readonly calls: Array<GenerateImageCall>;
6519
+ /**
6520
+ * Warnings for the call, e.g. unsupported settings.
6521
+ */
6522
+ readonly warnings: Array<Warning>;
6523
+ /**
6524
+ * Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
6525
+ *
6526
+ * @deprecated Use `calls` to preserve each response with its corresponding images, metadata, warnings, and usage.
6527
+ */
6528
+ readonly responses: Array<ImageModelResponseMetadata>;
6529
+ /**
6530
+ * Provider-specific metadata. They are passed through from the provider to the AI SDK and enable provider-specific
6531
+ * results that can be fully encapsulated in the provider.
6532
+ *
6533
+ * @deprecated Use the provider metadata in `calls` or on individual `images` to preserve its scope.
6534
+ */
6535
+ readonly providerMetadata: ImageModelProviderMetadata;
6536
+ /**
6537
+ * Combined token usage across all underlying provider calls for this image generation.
6538
+ */
6539
+ readonly usage: ImageModelUsage;
6540
+ }
6541
+
6542
+ type GenerateImagePrompt = string | {
6543
+ images: Array<DataContent>;
6544
+ text?: string;
6545
+ mask?: DataContent;
6546
+ };
6547
+ /**
6548
+ * Generates images using an image model.
6549
+ *
6550
+ * @param model - The image model to use.
6551
+ * @param prompt - The prompt that should be used to generate the image.
6552
+ * @param n - Number of images to generate. Default: 1.
6553
+ * @param maxImagesPerCall - Maximum number of images to generate in a single API call.
6554
+ * @param size - Size of the images to generate. Must have the format `{width}x{height}`.
6555
+ * @param aspectRatio - Aspect ratio of the images to generate. Must have the format `{width}:{height}`.
6556
+ * @param seed - Seed for the image generation.
6557
+ * @param providerOptions - Additional provider-specific options that are passed through to the provider
6558
+ * as body parameters.
6559
+ * @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.
6560
+ * @param abortSignal - An optional abort signal that can be used to cancel the call.
6561
+ * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
6562
+ *
6563
+ * @returns A result object that contains the generated images.
6564
+ */
6565
+ declare function generateImage({ model: modelArg, prompt: promptArg, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
6566
+ /**
6567
+ * The image model to use.
6568
+ */
6569
+ model: ImageModel;
6570
+ /**
6571
+ * The prompt that should be used to generate the image.
6572
+ */
6573
+ prompt: GenerateImagePrompt;
6574
+ /**
6575
+ * Number of images to generate.
6576
+ */
6577
+ n?: number;
6578
+ /**
6579
+ * Maximum number of images to generate in a single API call. If not provided, the model's default will be used.
6580
+ */
6581
+ maxImagesPerCall?: number;
6582
+ /**
6583
+ * Size of the images to generate. Must have the format `{width}x{height}`. If not provided, the default size will be used.
6584
+ */
6585
+ size?: `${number}x${number}`;
6586
+ /**
6587
+ * Aspect ratio of the images to generate. Must have the format `{width}:{height}`. If not provided, the default aspect ratio will be used.
6588
+ */
6589
+ aspectRatio?: `${number}:${number}`;
6590
+ /**
6591
+ * Seed for the image generation. If not provided, the default seed will be used.
6592
+ */
6593
+ seed?: number;
6594
+ /**
6595
+ * Additional provider-specific options that are passed through to the provider
6596
+ * as body parameters.
6597
+ *
6598
+ * The outer record is keyed by the provider name, and the inner
6599
+ * record is keyed by the provider-specific metadata key.
6600
+ * ```ts
6601
+ * {
6602
+ * "openai": {
6603
+ * "style": "vivid"
6604
+ * }
6605
+ * }
6606
+ * ```
6607
+ */
6608
+ providerOptions?: ProviderOptions;
6609
+ /**
6610
+ * Maximum number of retries per image model call, including retries after
6611
+ * unclassified empty responses. Empty responses marked as not retryable by
6612
+ * the provider are not retried. Set to 0 to disable retries.
6613
+ *
6614
+ * @default 2
6615
+ */
6616
+ maxRetries?: number;
6617
+ /**
6618
+ * Abort signal.
6619
+ */
6620
+ abortSignal?: AbortSignal;
6621
+ /**
6622
+ * Additional headers to include in the request.
6623
+ * Only applicable for HTTP-based providers.
6624
+ */
6625
+ headers?: Record<string, string>;
6626
+ }): Promise<GenerateImageResult>;
6627
+
6628
+ /**
6629
+ * Provider or lower-level batch interface used for batch processing.
6630
+ */
6631
+ type BatchProvider = ProviderV4 | Experimental_BatchV4;
6632
+ type InferBatchModelIds<PROVIDER extends BatchProvider> = PROVIDER extends Experimental_BatchV4<infer MODEL_IDS> ? MODEL_IDS : PROVIDER extends {
6633
+ experimental_batch(): Experimental_BatchV4<infer MODEL_IDS>;
6634
+ } ? MODEL_IDS : Experimental_BatchV4ModelIds;
6635
+ /**
6636
+ * The persisted reference for a batch.
6637
+ */
6638
+ type BatchReference = {
6639
+ readonly version: 2;
6640
+ readonly id: string;
6641
+ readonly provider: string;
6642
+ };
6643
+ /**
6644
+ * Serializable error information for a batch or batch item.
6645
+ */
6646
+ type BatchError = Experimental_BatchV4Error;
6647
+ /**
6648
+ * The latest normalized lifecycle status for a batch.
6649
+ */
6650
+ type BatchStatus = Experimental_BatchV4Status;
6651
+ /**
6652
+ * A batch and its latest normalized lifecycle status.
6653
+ */
6654
+ type Batch = BatchReference & BatchStatus;
6655
+ /**
6656
+ * One text generation request within a batch.
6657
+ */
6658
+ type TextBatchRequest<ModelId extends string = string, TOOLS extends ToolSet = ToolSet> = Prompt & LanguageModelCallOptions & {
6659
+ id: string;
6660
+ type: 'text';
6661
+ model: ModelId;
6662
+ tools?: TOOLS;
6663
+ toolChoice?: ToolChoice<NoInfer<TOOLS>>;
6664
+ toolOrder?: ToolOrder<TOOLS>;
6665
+ toolsContext?: InferToolSetContext<TOOLS>;
6666
+ providerOptions?: ProviderOptions;
6667
+ };
6668
+ /**
6669
+ * One image generation request within a batch.
6670
+ */
6671
+ type ImageBatchRequest<ModelId extends string = string> = {
6672
+ id: string;
6673
+ type: 'image';
6674
+ model: ModelId;
6675
+ prompt: GenerateImagePrompt;
6676
+ n?: number;
6677
+ size?: `${number}x${number}`;
6678
+ aspectRatio?: `${number}:${number}`;
6679
+ seed?: number;
6680
+ providerOptions?: ProviderOptions;
6681
+ };
6682
+ /**
6683
+ * One request within a batch, discriminated by modality.
6684
+ */
6685
+ type BatchRequest<ModelIds extends Experimental_BatchV4ModelIds = Experimental_BatchV4ModelIds, TOOLS extends ToolSet = ToolSet> = TextBatchRequest<ModelIds['text'] & string, TOOLS> | ImageBatchRequest<ModelIds['image'] & string>;
6686
+ type BatchCallOptions = {
6687
+ abortSignal?: AbortSignal;
6688
+ headers?: Record<string, string | undefined>;
6689
+ timeout?: number | {
6690
+ totalMs?: number;
6691
+ };
6692
+ };
6693
+ /**
6694
+ * Options for starting a batch.
6695
+ */
6696
+ type StartBatchOptions<TOOLS extends ToolSet = ToolSet, PROVIDER extends BatchProvider = BatchProvider> = {
6697
+ /**
6698
+ * Provider used to process the batch. Defaults to the global provider, or
6699
+ * the Vercel AI Gateway when no global provider is configured.
6700
+ */
6701
+ provider?: PROVIDER;
6702
+ requests: ReadonlyArray<BatchRequest<InferBatchModelIds<PROVIDER>, TOOLS>>;
6703
+ providerOptions?: ProviderOptions;
6704
+ /**
6705
+ * URL that the provider should notify when the batch reaches a terminal
6706
+ * state. Providers that do not support completion webhooks return an
6707
+ * unsupported warning.
6708
+ */
6709
+ webhookUrl?: string;
6710
+ } & BatchCallOptions;
6711
+ /**
6712
+ * The acknowledged batch and warnings produced while starting it.
6713
+ */
6714
+ type StartBatchResult = Batch & {
6715
+ readonly warnings: Experimental_BatchV4StartResult['warnings'];
6716
+ };
6717
+ /**
6718
+ * Options for requesting cancellation of a batch.
6719
+ */
6310
6720
  type CancelBatchOptions = {
6311
6721
  provider?: BatchProvider;
6312
6722
  batch: BatchReference;
@@ -6381,7 +6791,9 @@ type TextBatchGenerationResult<TOOLS extends ToolSet = ToolSet> = {
6381
6791
  /**
6382
6792
  * A complete terminal result for one request in a text batch.
6383
6793
  */
6384
- type TextBatchItemResult<TOOLS extends ToolSet = ToolSet> = (TextBatchGenerationResult<TOOLS> & {
6794
+ type TextBatchItemResult<TOOLS extends ToolSet = ToolSet> = {
6795
+ readonly type: 'text';
6796
+ } & ((TextBatchGenerationResult<TOOLS> & {
6385
6797
  readonly id: string;
6386
6798
  readonly status: 'succeeded';
6387
6799
  }) | {
@@ -6394,11 +6806,40 @@ type TextBatchItemResult<TOOLS extends ToolSet = ToolSet> = (TextBatchGeneration
6394
6806
  readonly status: 'cancelled' | 'expired';
6395
6807
  readonly error?: BatchError;
6396
6808
  readonly providerMetadata?: ProviderMetadata;
6809
+ });
6810
+ /**
6811
+ * A normalized result for a successful image batch item.
6812
+ */
6813
+ type ImageBatchGenerationResult = {
6814
+ readonly images: Array<GeneratedFile>;
6815
+ readonly warnings: Array<Warning>;
6816
+ readonly response: ImageModelResponseMetadata;
6817
+ readonly providerMetadata?: ImageModelV4ProviderMetadata;
6818
+ readonly usage?: ImageModelUsage;
6397
6819
  };
6820
+ /**
6821
+ * A complete terminal result for one request in an image batch.
6822
+ */
6823
+ type ImageBatchItemResult = {
6824
+ readonly type: 'image';
6825
+ } & ((ImageBatchGenerationResult & {
6826
+ readonly id: string;
6827
+ readonly status: 'succeeded';
6828
+ }) | {
6829
+ readonly id: string;
6830
+ readonly status: 'failed';
6831
+ readonly error: BatchError;
6832
+ readonly providerMetadata?: ProviderMetadata;
6833
+ } | {
6834
+ readonly id: string;
6835
+ readonly status: 'cancelled' | 'expired';
6836
+ readonly error?: BatchError;
6837
+ readonly providerMetadata?: ProviderMetadata;
6838
+ });
6398
6839
  /**
6399
6840
  * A complete terminal result for one request in a batch.
6400
6841
  */
6401
- type BatchItemResult<TOOLS extends ToolSet = ToolSet> = TextBatchItemResult<TOOLS>;
6842
+ type BatchItemResult<TOOLS extends ToolSet = ToolSet> = TextBatchItemResult<TOOLS> | ImageBatchItemResult;
6402
6843
 
6403
6844
  /**
6404
6845
  * Requests cancellation of a batch.
@@ -6472,6 +6913,7 @@ interface EmbedResult {
6472
6913
  * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
6473
6914
  *
6474
6915
  * @param telemetry - Optional telemetry configuration.
6916
+ * @param runtimeContext - User-defined runtime context passed to callbacks and, when explicitly included, telemetry.
6475
6917
  *
6476
6918
  * @param providerOptions - Additional provider-specific options. They are passed through
6477
6919
  * to the provider from the AI SDK and enable provider-specific
@@ -6479,7 +6921,7 @@ interface EmbedResult {
6479
6921
  *
6480
6922
  * @returns A result object that contains the embedding, the value, and additional information.
6481
6923
  */
6482
- declare function embed({ model: modelArg, value, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, experimental_telemetry, telemetry, onStart, experimental_onStart, onEnd, experimental_onEnd, _internal: { generateCallId }, }: {
6924
+ declare function embed<RUNTIME_CONTEXT extends Context = Context>({ model: modelArg, value, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, experimental_telemetry, telemetry, runtimeContext, onStart, experimental_onStart, onEnd, experimental_onEnd, _internal: { generateCallId }, }: {
6483
6925
  /**
6484
6926
  * The embedding model to use.
6485
6927
  */
@@ -6512,37 +6954,41 @@ declare function embed({ model: modelArg, value, providerOptions, maxRetries: ma
6512
6954
  /**
6513
6955
  * Optional telemetry configuration.
6514
6956
  */
6515
- telemetry?: TelemetryOptions;
6957
+ telemetry?: TelemetryOptions<RUNTIME_CONTEXT>;
6516
6958
  /**
6517
6959
  * Optional telemetry configuration.
6518
6960
  *
6519
6961
  * @deprecated Use `telemetry` instead. This alias will be removed in a future major release.
6520
6962
  */
6521
- experimental_telemetry?: TelemetryOptions;
6963
+ experimental_telemetry?: TelemetryOptions<RUNTIME_CONTEXT>;
6964
+ /**
6965
+ * User-defined runtime context. Treat runtime context as immutable.
6966
+ */
6967
+ runtimeContext?: RUNTIME_CONTEXT;
6522
6968
  /**
6523
6969
  * Callback that is called when the embed operation begins,
6524
6970
  * before the embedding model is called.
6525
6971
  */
6526
- onStart?: Callback<EmbedStartEvent>;
6972
+ onStart?: Callback<EmbedStartEvent<RUNTIME_CONTEXT>>;
6527
6973
  /**
6528
6974
  * Callback that is called when the embed operation begins,
6529
6975
  * before the embedding model is called.
6530
6976
  *
6531
6977
  * @deprecated Use `onStart` instead.
6532
6978
  */
6533
- experimental_onStart?: Callback<EmbedStartEvent>;
6979
+ experimental_onStart?: Callback<EmbedStartEvent<RUNTIME_CONTEXT>>;
6534
6980
  /**
6535
6981
  * Callback that is called when the embed operation completes,
6536
6982
  * after the embedding model returns.
6537
6983
  */
6538
- onEnd?: Callback<EmbedEndEvent>;
6984
+ onEnd?: Callback<EmbedEndEvent<RUNTIME_CONTEXT>>;
6539
6985
  /**
6540
6986
  * Callback that is called when the embed operation completes,
6541
6987
  * after the embedding model returns.
6542
6988
  *
6543
6989
  * @deprecated Use `onEnd` instead.
6544
6990
  */
6545
- experimental_onEnd?: Callback<EmbedEndEvent>;
6991
+ experimental_onEnd?: Callback<EmbedEndEvent<RUNTIME_CONTEXT>>;
6546
6992
  /**
6547
6993
  * Internal. For test use only. May change without notice.
6548
6994
  */
@@ -6609,6 +7055,7 @@ interface EmbedManyResult {
6609
7055
  * @param maxParallelCalls - Maximum number of concurrent requests. Default: Infinity.
6610
7056
  *
6611
7057
  * @param telemetry - Optional telemetry configuration.
7058
+ * @param runtimeContext - User-defined runtime context passed to callbacks and, when explicitly included, telemetry.
6612
7059
  *
6613
7060
  * @param providerOptions - Additional provider-specific options. They are passed through
6614
7061
  * to the provider from the AI SDK and enable provider-specific
@@ -6616,7 +7063,7 @@ interface EmbedManyResult {
6616
7063
  *
6617
7064
  * @returns A result object that contains the embeddings, the value, and additional information.
6618
7065
  */
6619
- declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry, telemetry, onStart, experimental_onStart, onEnd, experimental_onEnd, _internal: { generateCallId }, }: {
7066
+ declare function embedMany<RUNTIME_CONTEXT extends Context = Context>({ model: modelArg, values, maxParallelCalls, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry, telemetry, runtimeContext, onStart, experimental_onStart, onEnd, experimental_onEnd, _internal: { generateCallId }, }: {
6620
7067
  /**
6621
7068
  * The embedding model to use.
6622
7069
  */
@@ -6643,13 +7090,17 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
6643
7090
  /**
6644
7091
  * Optional telemetry configuration.
6645
7092
  */
6646
- telemetry?: TelemetryOptions;
7093
+ telemetry?: TelemetryOptions<RUNTIME_CONTEXT>;
6647
7094
  /**
6648
7095
  * Optional telemetry configuration.
6649
7096
  *
6650
7097
  * @deprecated Use `telemetry` instead. This alias will be removed in a future major release.
6651
7098
  */
6652
- experimental_telemetry?: TelemetryOptions;
7099
+ experimental_telemetry?: TelemetryOptions<RUNTIME_CONTEXT>;
7100
+ /**
7101
+ * User-defined runtime context. Treat runtime context as immutable.
7102
+ */
7103
+ runtimeContext?: RUNTIME_CONTEXT;
6653
7104
  /**
6654
7105
  * Additional provider-specific options. They are passed through
6655
7106
  * to the provider from the AI SDK and enable provider-specific
@@ -6666,180 +7117,46 @@ declare function embedMany({ model: modelArg, values, maxParallelCalls, maxRetri
6666
7117
  * Callback that is called when the embedMany operation begins,
6667
7118
  * before the embedding model is called.
6668
7119
  */
6669
- onStart?: Callback<EmbedStartEvent>;
7120
+ onStart?: Callback<EmbedStartEvent<RUNTIME_CONTEXT>>;
6670
7121
  /**
6671
7122
  * Callback that is called when the embedMany operation begins,
6672
7123
  * before the embedding model is called.
6673
7124
  *
6674
7125
  * @deprecated Use `onStart` instead.
6675
7126
  */
6676
- experimental_onStart?: Callback<EmbedStartEvent>;
7127
+ experimental_onStart?: Callback<EmbedStartEvent<RUNTIME_CONTEXT>>;
6677
7128
  /**
6678
7129
  * Callback that is called when the embedMany operation completes,
6679
7130
  * after all embedding model calls return.
6680
7131
  */
6681
- onEnd?: Callback<EmbedEndEvent>;
7132
+ onEnd?: Callback<EmbedEndEvent<RUNTIME_CONTEXT>>;
6682
7133
  /**
6683
7134
  * Callback that is called when the embedMany operation completes,
6684
7135
  * after all embedding model calls return.
6685
7136
  *
6686
7137
  * @deprecated Use `onEnd` instead.
6687
7138
  */
6688
- experimental_onEnd?: Callback<EmbedEndEvent>;
7139
+ experimental_onEnd?: Callback<EmbedEndEvent<RUNTIME_CONTEXT>>;
6689
7140
  /**
6690
7141
  * Internal. For test use only. May change without notice.
6691
7142
  */
6692
7143
  _internal?: {
6693
7144
  generateCallId?: () => string;
6694
7145
  };
6695
- }): Promise<EmbedManyResult>;
6696
-
6697
- declare const symbol$l: unique symbol;
6698
- declare class InvalidArgumentError extends AISDKError {
6699
- private readonly [symbol$l];
6700
- readonly parameter: string;
6701
- readonly value: unknown;
6702
- constructor({ parameter, value, message, }: {
6703
- parameter: string;
6704
- value: unknown;
6705
- message: string;
6706
- });
6707
- static isInstance(error: unknown): error is InvalidArgumentError;
6708
- }
6709
-
6710
- type LanguageModelStreamPart<TOOLS extends ToolSet = ToolSet> = Exclude<TextStreamPart<TOOLS>, {
6711
- type: 'finish' | 'stream-start' | 'tool-output-denied' | 'start-step' | 'finish-step' | 'start' | 'abort';
6712
- }> | TextStreamTextDeltaPart | TextStreamReasoningDeltaPart | TextStreamFilePart | TextStreamReasoningFilePart | TextStreamToolApprovalRequestPart<TOOLS> | TextStreamToolApprovalResponsePart<TOOLS> | TextStreamToolCallPart<TOOLS> | TextStreamToolResultPart<TOOLS> | TextStreamToolErrorPart<TOOLS> | {
6713
- type: 'model-call-end';
6714
- finishReason: FinishReason;
6715
- rawFinishReason: string | undefined;
6716
- usage: LanguageModelUsage;
6717
- providerMetadata?: ProviderMetadata;
6718
- performance: {
6719
- responseTimeMs: number;
6720
- effectiveOutputTokensPerSecond: number;
6721
- outputTokensPerSecond: number | undefined;
6722
- inputTokensPerSecond: number | undefined;
6723
- effectiveTotalTokensPerSecond: number;
6724
- timeToFirstOutputMs: number | undefined;
6725
- timeBetweenOutputChunksMs?: OutputChunkTimingStats;
6726
- };
6727
- } | {
6728
- type: 'model-call-start';
6729
- warnings: Array<CallWarning>;
6730
- } | {
6731
- type: 'model-call-response-metadata';
6732
- /**
6733
- * ID for the generated response, if the provider sends one.
6734
- */
6735
- id?: string;
6736
- /**
6737
- * Timestamp for the start of the generated response, if the provider sends one.
6738
- */
6739
- timestamp?: Date;
6740
- /**
6741
- * The ID of the response model that was used to generate the response, if the provider sends one.
6742
- */
6743
- modelId?: string;
6744
- };
6745
- /**
6746
- * Streams a single language model call after standardizing the prompt and tools.
6747
- *
6748
- * The returned stream emits model call parts together with request and response
6749
- * metadata when available.
6750
- *
6751
- * @param model - The language model to use.
6752
- * @param tools - Tools that are accessible to and can be called by the model. The model needs to support calling tools.
6753
- * @param output - Output configuration that controls the response format requested from the model.
6754
- * @param toolChoice - The tool choice strategy for the model call.
6755
- *
6756
- * @param system - A system message that will be part of the prompt.
6757
- * @param prompt - A simple text prompt. You can either use `prompt` or `messages` but not both.
6758
- * @param messages - A list of messages. You can either use `prompt` or `messages` but not both.
6759
- * @param allowSystemInMessages - Whether system messages are allowed in the `prompt` or `messages` fields. Default: false.
6760
- *
6761
- * @param maxOutputTokens - Maximum number of tokens to generate.
6762
- * @param temperature - Temperature setting.
6763
- * The value is passed through to the provider. The range depends on the provider and model.
6764
- * It is recommended to set either `temperature` or `topP`, but not both.
6765
- * @param topP - Nucleus sampling.
6766
- * The value is passed through to the provider. The range depends on the provider and model.
6767
- * It is recommended to set either `temperature` or `topP`, but not both.
6768
- * @param topK - Only sample from the top K options for each subsequent token.
6769
- * Used to remove "long tail" low probability responses.
6770
- * Recommended for advanced use cases only. You usually only need to use temperature.
6771
- * @param presencePenalty - Presence penalty setting.
6772
- * It affects the likelihood of the model to repeat information that is already in the prompt.
6773
- * The value is passed through to the provider. The range depends on the provider and model.
6774
- * @param frequencyPenalty - Frequency penalty setting.
6775
- * It affects the likelihood of the model to repeatedly use the same words or phrases.
6776
- * The value is passed through to the provider. The range depends on the provider and model.
6777
- * @param stopSequences - Stop sequences.
6778
- * If set, the model will stop generating text when one of the stop sequences is generated.
6779
- * @param seed - The seed (integer) to use for random sampling.
6780
- * If set and supported by the model, calls will generate deterministic results.
6781
- * @param reasoning - Reasoning configuration for the model call.
6782
- *
6783
- * @param download - A function that downloads URLs as part of prompt conversion.
6784
- * @param abortSignal - An optional abort signal that can be used to cancel the call.
6785
- * @param headers - Additional HTTP headers to be sent with the request.
6786
- * @param includeRawChunks - Whether to include raw provider stream chunks in the model stream.
6787
- * @param providerOptions - Additional provider-specific options.
6788
- * @param repairToolCall - A function that can repair invalid tool calls before they are emitted.
6789
- * @param refineToolInput - Optional mapping of tool names to functions that refine parsed tool inputs before they are emitted, used for telemetry, or executed.
6790
- * @param onStart - A callback that receives the fully converted prompt before the model call starts.
6791
- *
6792
- * @returns A stream of model call parts together with request and response metadata when available.
6793
- */
6794
- declare function streamLanguageModelCall<TOOLS extends ToolSet, OUTPUT extends Output = Output>({ model, tools, toolOrder, output, toolChoice, prompt, system, instructions, messages, allowSystemInMessages, download, abortSignal, headers, includeRawChunks, providerOptions, repairToolCall, refineToolInput, executeLanguageModelCallInTelemetryContext, callId, toolsContext, experimental_sandbox: sandbox, _internal: { generateId, generateCallId, now, }, onStart, onLanguageModelCallStart, onLanguageModelCallEnd, ...callSettings }: {
6795
- model: LanguageModel;
6796
- tools?: TOOLS;
6797
- toolOrder?: ToolOrder<TOOLS>;
6798
- output?: OUTPUT;
6799
- toolChoice?: ToolChoice<TOOLS>;
6800
- download?: DownloadFunction;
6801
- abortSignal?: AbortSignal;
6802
- headers?: Record<string, string | undefined>;
6803
- includeRawChunks?: boolean;
6804
- providerOptions?: ProviderOptions;
6805
- repairToolCall?: ToolCallRepairFunction<TOOLS> | undefined;
6806
- refineToolInput?: ToolInputRefinement<TOOLS> | undefined;
6807
- executeLanguageModelCallInTelemetryContext?: Telemetry['executeLanguageModelCall'];
6808
- callId?: string;
6809
- /**
6810
- * Tool context used to resolve per-call tool metadata such as function
6811
- * descriptions before sending tools to the model.
6812
- */
6813
- toolsContext?: InferToolSetContext<TOOLS>;
6814
- /**
6815
- * Sandbox session passed through for resolving tool descriptions that depend on it.
6816
- */
6817
- experimental_sandbox?: Experimental_SandboxSession;
6818
- _internal?: {
6819
- generateId?: IdGenerator;
6820
- generateCallId?: IdGenerator;
6821
- now?: () => number;
6822
- };
6823
- onLanguageModelCallStart?: Arrayable<OnLanguageModelCallStartCallback>;
6824
- onLanguageModelCallEnd?: Arrayable<OnLanguageModelCallEndCallback<TOOLS>>;
6825
- onStart?: (args: {
6826
- promptMessages: LanguageModelV4Prompt;
6827
- }) => Promise<void> | void;
6828
- } & Prompt & LanguageModelCallOptions): Promise<{
6829
- stream: AsyncIterableStream<LanguageModelStreamPart<TOOLS>>;
6830
- request?: {
6831
- /**
6832
- * Request HTTP body that was sent to the provider API.
6833
- */
6834
- body?: unknown;
6835
- };
6836
- response?: {
6837
- /**
6838
- * Response headers.
6839
- */
6840
- headers?: SharedV4Headers;
6841
- };
6842
- }>;
7146
+ }): Promise<EmbedManyResult>;
7147
+
7148
+ declare const symbol$l: unique symbol;
7149
+ declare class InvalidArgumentError extends AISDKError {
7150
+ private readonly [symbol$l];
7151
+ readonly parameter: string;
7152
+ readonly value: unknown;
7153
+ constructor({ parameter, value, message, }: {
7154
+ parameter: string;
7155
+ value: unknown;
7156
+ message: string;
7157
+ });
7158
+ static isInstance(error: unknown): error is InvalidArgumentError;
7159
+ }
6843
7160
 
6844
7161
  declare const symbol$k: unique symbol;
6845
7162
  declare class InvalidStreamPartError extends AISDKError {
@@ -6897,156 +7214,6 @@ declare class MissingToolResultsError extends AISDKError {
6897
7214
  static isInstance(error: unknown): error is MissingToolResultsError;
6898
7215
  }
6899
7216
 
6900
- type ActiveToolSubset<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>> = TOOLS extends undefined ? undefined : [ACTIVE_TOOL_NAMES] extends [NonNullable<ActiveTools<NonNullable<TOOLS>>>] ? Pick<NonNullable<TOOLS>, ACTIVE_TOOL_NAMES[number]> : TOOLS;
6901
- /**
6902
- * Filters the tools to only include the active tools.
6903
- * When activeTools is provided, we only include the tools that are in the list.
6904
- *
6905
- * @param tools - The tools to filter.
6906
- * @param activeTools - The active tools to include.
6907
- * @returns The filtered tools.
6908
- */
6909
- declare function filterActiveTools<TOOLS extends ToolSet | undefined, ACTIVE_TOOL_NAMES extends ActiveTools<NonNullable<TOOLS>>>({ tools, activeTools, }: {
6910
- tools: TOOLS;
6911
- activeTools: ACTIVE_TOOL_NAMES;
6912
- }): ActiveToolSubset<TOOLS, ACTIVE_TOOL_NAMES>;
6913
-
6914
- /**
6915
- * Prunes model messages from a list of model messages.
6916
- *
6917
- * @param messages - The list of model messages to prune.
6918
- * @param reasoning - How to remove reasoning content from assistant messages. Default is `'none'`.
6919
- * @param toolCalls - How to prune tool call/results/approval content. Default is `[]`.
6920
- * @param emptyMessages - Whether to keep or remove messages whose content is empty after pruning. Default is `'remove'`.
6921
- *
6922
- * @returns The pruned list of model messages.
6923
- */
6924
- declare function pruneMessages({ messages, reasoning, toolCalls, emptyMessages, }: {
6925
- messages: ModelMessage[];
6926
- reasoning?: 'all' | 'before-last-message' | 'none';
6927
- toolCalls?: 'all' | 'before-last-message' | `before-last-${number}-messages` | 'none' | Array<{
6928
- type: 'all' | 'before-last-message' | `before-last-${number}-messages`;
6929
- tools?: string[];
6930
- }>;
6931
- emptyMessages?: 'keep' | 'remove';
6932
- }): ModelMessage[];
6933
-
6934
- /**
6935
- * Detects the first chunk in a buffer.
6936
- *
6937
- * @param buffer - The buffer to detect the first chunk in.
6938
- *
6939
- * @returns The first detected chunk, or `undefined` if no chunk was detected.
6940
- */
6941
- type ChunkDetector = (buffer: string) => string | undefined | null;
6942
- /**
6943
- * Smooths text and reasoning streaming output.
6944
- *
6945
- * @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.
6946
- * @param chunking - Controls how the text is chunked for streaming. Use "word" to stream word by word (default), "line" to stream line by line, provide a custom RegExp pattern that does not match the empty string for custom chunking, provide an Intl.Segmenter for locale-aware word segmentation (recommended for CJK languages), or provide a custom ChunkDetector function.
6947
- *
6948
- * @returns A transform stream that smooths text streaming output.
6949
- */
6950
- declare function smoothStream<TOOLS extends ToolSet>({ delayInMs, chunking, _internal: { delay }, }?: {
6951
- delayInMs?: number | null;
6952
- chunking?: 'word' | 'line' | RegExp | ChunkDetector | Intl.Segmenter;
6953
- /**
6954
- * Internal. For test use only. May change without notice.
6955
- */
6956
- _internal?: {
6957
- delay?: (delayInMs: number | null) => Promise<void>;
6958
- };
6959
- }): (options: {
6960
- tools: TOOLS;
6961
- }) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
6962
-
6963
- /**
6964
- * Fingerprint the server-controlled, security-relevant fields of each tool in a
6965
- * `ToolSet`: `description` (string form only), the resolved input JSON schema,
6966
- * and `title`. Returns a map of tool name to a stable digest.
6967
- *
6968
- * Capture a baseline at trust time (first connect, human-reviewed) and compare
6969
- * later fetches with {@link detectToolDrift} to catch MCP tool-definition drift
6970
- * ("rug pull"). Baseline storage and the drift response are the app's concern.
6971
- */
6972
- declare function fingerprintTools(tools: ToolSet): Promise<Record<string, string>>;
6973
- /**
6974
- * Pure diff of two fingerprint maps produced by {@link fingerprintTools}.
6975
- * `added`/`removed` are tools present in only one map; `changed` are tools whose
6976
- * pinned definition differs. Uses own-property lookups so a tool literally named
6977
- * `constructor` or `toString` diffs correctly.
6978
- */
6979
- declare function detectToolDrift(current: Record<string, string>, baseline: Record<string, string>): {
6980
- added: string[];
6981
- removed: string[];
6982
- changed: string[];
6983
- };
6984
-
6985
- /**
6986
- * The result of one underlying image model call.
6987
- */
6988
- interface GenerateImageCall {
6989
- /**
6990
- * The images generated by this call.
6991
- */
6992
- readonly images: Array<GeneratedFile>;
6993
- /**
6994
- * Provider-specific metadata for this call.
6995
- */
6996
- readonly providerMetadata?: ImageModelV4ProviderMetadata;
6997
- /**
6998
- * Response metadata from the provider.
6999
- */
7000
- readonly response: ImageModelResponseMetadata;
7001
- /**
7002
- * Warnings for this call, e.g. unsupported settings.
7003
- */
7004
- readonly warnings: Array<Warning>;
7005
- /**
7006
- * Token usage for this call, if reported by the provider.
7007
- */
7008
- readonly usage?: ImageModelUsage;
7009
- }
7010
- /**
7011
- * The result of a `generateImage` call.
7012
- * It contains the images and additional information.
7013
- */
7014
- interface GenerateImageResult {
7015
- /**
7016
- * The first image that was generated.
7017
- */
7018
- readonly image: GeneratedFile;
7019
- /**
7020
- * The images that were generated.
7021
- */
7022
- readonly images: Array<GeneratedFile>;
7023
- /**
7024
- * The results of the underlying image model calls.
7025
- */
7026
- readonly calls: Array<GenerateImageCall>;
7027
- /**
7028
- * Warnings for the call, e.g. unsupported settings.
7029
- */
7030
- readonly warnings: Array<Warning>;
7031
- /**
7032
- * Response metadata from the provider. There may be multiple responses if we made multiple calls to the model.
7033
- *
7034
- * @deprecated Use `calls` to preserve each response with its corresponding images, metadata, warnings, and usage.
7035
- */
7036
- readonly responses: Array<ImageModelResponseMetadata>;
7037
- /**
7038
- * Provider-specific metadata. They are passed through from the provider to the AI SDK and enable provider-specific
7039
- * results that can be fully encapsulated in the provider.
7040
- *
7041
- * @deprecated Use the provider metadata in `calls` or on individual `images` to preserve its scope.
7042
- */
7043
- readonly providerMetadata: ImageModelProviderMetadata;
7044
- /**
7045
- * Combined token usage across all underlying provider calls for this image generation.
7046
- */
7047
- readonly usage: ImageModelUsage;
7048
- }
7049
-
7050
7217
  declare const symbol$f: unique symbol;
7051
7218
  /**
7052
7219
  * Thrown when no image could be generated. This can have multiple causes:
@@ -7425,92 +7592,6 @@ declare class RetryError extends AISDKError {
7425
7592
  static isInstance(error: unknown): error is RetryError;
7426
7593
  }
7427
7594
 
7428
- type GenerateImagePrompt = string | {
7429
- images: Array<DataContent>;
7430
- text?: string;
7431
- mask?: DataContent;
7432
- };
7433
- /**
7434
- * Generates images using an image model.
7435
- *
7436
- * @param model - The image model to use.
7437
- * @param prompt - The prompt that should be used to generate the image.
7438
- * @param n - Number of images to generate. Default: 1.
7439
- * @param maxImagesPerCall - Maximum number of images to generate in a single API call.
7440
- * @param size - Size of the images to generate. Must have the format `{width}x{height}`.
7441
- * @param aspectRatio - Aspect ratio of the images to generate. Must have the format `{width}:{height}`.
7442
- * @param seed - Seed for the image generation.
7443
- * @param providerOptions - Additional provider-specific options that are passed through to the provider
7444
- * as body parameters.
7445
- * @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.
7446
- * @param abortSignal - An optional abort signal that can be used to cancel the call.
7447
- * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
7448
- *
7449
- * @returns A result object that contains the generated images.
7450
- */
7451
- declare function generateImage({ model: modelArg, prompt: promptArg, n, maxImagesPerCall, size, aspectRatio, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, }: {
7452
- /**
7453
- * The image model to use.
7454
- */
7455
- model: ImageModel;
7456
- /**
7457
- * The prompt that should be used to generate the image.
7458
- */
7459
- prompt: GenerateImagePrompt;
7460
- /**
7461
- * Number of images to generate.
7462
- */
7463
- n?: number;
7464
- /**
7465
- * Maximum number of images to generate in a single API call. If not provided, the model's default will be used.
7466
- */
7467
- maxImagesPerCall?: number;
7468
- /**
7469
- * Size of the images to generate. Must have the format `{width}x{height}`. If not provided, the default size will be used.
7470
- */
7471
- size?: `${number}x${number}`;
7472
- /**
7473
- * Aspect ratio of the images to generate. Must have the format `{width}:{height}`. If not provided, the default aspect ratio will be used.
7474
- */
7475
- aspectRatio?: `${number}:${number}`;
7476
- /**
7477
- * Seed for the image generation. If not provided, the default seed will be used.
7478
- */
7479
- seed?: number;
7480
- /**
7481
- * Additional provider-specific options that are passed through to the provider
7482
- * as body parameters.
7483
- *
7484
- * The outer record is keyed by the provider name, and the inner
7485
- * record is keyed by the provider-specific metadata key.
7486
- * ```ts
7487
- * {
7488
- * "openai": {
7489
- * "style": "vivid"
7490
- * }
7491
- * }
7492
- * ```
7493
- */
7494
- providerOptions?: ProviderOptions;
7495
- /**
7496
- * Maximum number of retries per image model call, including retries after
7497
- * unclassified empty responses. Empty responses marked as not retryable by
7498
- * the provider are not retried. Set to 0 to disable retries.
7499
- *
7500
- * @default 2
7501
- */
7502
- maxRetries?: number;
7503
- /**
7504
- * Abort signal.
7505
- */
7506
- abortSignal?: AbortSignal;
7507
- /**
7508
- * Additional headers to include in the request.
7509
- * Only applicable for HTTP-based providers.
7510
- */
7511
- headers?: Record<string, string>;
7512
- }): Promise<GenerateImageResult>;
7513
-
7514
7595
  /**
7515
7596
  * The result of a `generateObject` call.
7516
7597
  */
@@ -9141,10 +9222,11 @@ interface RerankResult<VALUE> {
9141
9222
  * @param headers - Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
9142
9223
  * @param providerOptions - Additional provider-specific options.
9143
9224
  * @param telemetry - Optional telemetry configuration.
9225
+ * @param runtimeContext - User-defined runtime context passed to callbacks and, when explicitly included, telemetry.
9144
9226
  *
9145
9227
  * @returns A result object that contains the reranked documents, the reranked indices, and additional information.
9146
9228
  */
9147
- declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry, telemetry, onStart, experimental_onStart, onEnd, experimental_onEnd, _internal: { generateCallId }, }: {
9229
+ declare function rerank<VALUE extends JSONObject | string, RUNTIME_CONTEXT extends Context = Context>({ model: modelArg, documents, query, topN, maxRetries: maxRetriesArg, abortSignal, headers, providerOptions, experimental_telemetry, telemetry, runtimeContext, onStart, experimental_onStart, onEnd, experimental_onEnd, _internal: { generateCallId }, }: {
9148
9230
  /**
9149
9231
  * The reranking model to use.
9150
9232
  */
@@ -9179,13 +9261,17 @@ declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, do
9179
9261
  /**
9180
9262
  * Optional telemetry configuration.
9181
9263
  */
9182
- telemetry?: TelemetryOptions;
9264
+ telemetry?: TelemetryOptions<RUNTIME_CONTEXT>;
9183
9265
  /**
9184
9266
  * Optional telemetry configuration.
9185
9267
  *
9186
9268
  * @deprecated Use `telemetry` instead. This alias will be removed in a future major release.
9187
9269
  */
9188
- experimental_telemetry?: TelemetryOptions;
9270
+ experimental_telemetry?: TelemetryOptions<RUNTIME_CONTEXT>;
9271
+ /**
9272
+ * User-defined runtime context. Treat runtime context as immutable.
9273
+ */
9274
+ runtimeContext?: RUNTIME_CONTEXT;
9189
9275
  /**
9190
9276
  * Additional provider-specific options. They are passed through
9191
9277
  * to the provider from the AI SDK and enable provider-specific
@@ -9196,26 +9282,26 @@ declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, do
9196
9282
  * Callback that is called when the rerank operation begins,
9197
9283
  * before the reranking model is called.
9198
9284
  */
9199
- onStart?: Callback<RerankStartEvent>;
9285
+ onStart?: Callback<RerankStartEvent<RUNTIME_CONTEXT>>;
9200
9286
  /**
9201
9287
  * Callback that is called when the rerank operation begins,
9202
9288
  * before the reranking model is called.
9203
9289
  *
9204
9290
  * @deprecated Use `onStart` instead.
9205
9291
  */
9206
- experimental_onStart?: Callback<RerankStartEvent>;
9292
+ experimental_onStart?: Callback<RerankStartEvent<RUNTIME_CONTEXT>>;
9207
9293
  /**
9208
9294
  * Callback that is called when the rerank operation completes,
9209
9295
  * after the reranking model returns.
9210
9296
  */
9211
- onEnd?: Callback<RerankEndEvent>;
9297
+ onEnd?: Callback<RerankEndEvent<RUNTIME_CONTEXT>>;
9212
9298
  /**
9213
9299
  * Callback that is called when the rerank operation completes,
9214
9300
  * after the reranking model returns.
9215
9301
  *
9216
9302
  * @deprecated Use `onEnd` instead.
9217
9303
  */
9218
- experimental_onEnd?: Callback<RerankEndEvent>;
9304
+ experimental_onEnd?: Callback<RerankEndEvent<RUNTIME_CONTEXT>>;
9219
9305
  /**
9220
9306
  * Internal. For test use only. May change without notice.
9221
9307
  */
@@ -9782,4 +9868,4 @@ declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
9782
9868
  files: UploadSkillFile[];
9783
9869
  }): Promise<UploadSkillResult>;
9784
9870
 
9785
- export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, type ActiveTools, type Agent, type AgentCallParameters, type AgentStreamParameters, type AsyncIterableStream, type CallSettings, type CallWarning, type ChatAddToolApproveResponseFunction, type ChatAddToolOutputFunction, type ChatInit, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatOnToolCallCallback, type ChatRequestOptions, type ChatState, type ChatStatus, type ChatTransport, type ChunkDetector, type CompletionRequestOptions, type ContentPart, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, type DirectChatTransportOptions, type DynamicToolCall, type DynamicToolError, type DynamicToolResult, type DynamicToolUIPart, type EmbedEndEvent, type EmbedManyResult, type EmbedResult, type EmbedStartEvent, type Embedding, type EmbeddingModel, type EmbeddingModelCallEndEvent, type EmbeddingModelCallStartEvent, type EmbeddingModelMiddleware, type EmbeddingModelUsage, type ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, type ToolLoopAgentSettings as Experimental_AgentSettings, type Batch as Experimental_Batch, type BatchError as Experimental_BatchError, type BatchItemResult as Experimental_BatchItemResult, type BatchProvider as Experimental_BatchProvider, type BatchReference as Experimental_BatchReference, type BatchRequest as Experimental_BatchRequest, type BatchStatus as Experimental_BatchStatus, type CancelBatchOptions as Experimental_CancelBatchOptions, type CancelBatchResult as Experimental_CancelBatchResult, type DownloadFunction as Experimental_DownloadFunction, type Experimental_GeneratedImage, type GetBatchResultsOptions as Experimental_GetBatchResultsOptions, type GetBatchStatusOptions as Experimental_GetBatchStatusOptions, type InferAgentUIMessage as Experimental_InferAgentUIMessage, type LanguageModelStreamPart as Experimental_LanguageModelStreamPart, type ListBatchesOptions as Experimental_ListBatchesOptions, type ListBatchesResult as Experimental_ListBatchesResult, type LogWarningsFunction as Experimental_LogWarningsFunction, type RealtimeClientEvent as Experimental_RealtimeClientEvent, type RealtimeFactory as Experimental_RealtimeFactory, type RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, type RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, type RealtimeModel as Experimental_RealtimeModel, type RealtimeServerEvent as Experimental_RealtimeServerEvent, type RealtimeSessionConfig as Experimental_RealtimeSessionConfig, type RealtimeSessionOptions as Experimental_RealtimeSessionOptions, type RealtimeSetupResponse as Experimental_RealtimeSetupResponse, type RealtimeState as Experimental_RealtimeState, type RealtimeStatus as Experimental_RealtimeStatus, type RealtimeToolDefinition as Experimental_RealtimeToolDefinition, type Experimental_SpeechResult, type StartBatchOptions as Experimental_StartBatchOptions, type StartBatchResult as Experimental_StartBatchResult, type StreamTranslationResult as Experimental_StreamTranslationResult, type TextBatchGenerationResult as Experimental_TextBatchGenerationResult, type TextBatchItemResult as Experimental_TextBatchItemResult, type TextBatchRequest as Experimental_TextBatchRequest, type Experimental_ToolCallers, type Experimental_TranscriptionResult, type TranslationStreamPart as Experimental_TranslationStreamPart, type FileUIPart, type FinishReason, type GenerateImageCall, type GenerateImageResult, type GenerateObjectEndEvent, type GenerateObjectResult, type GenerateObjectStartEvent, type GenerateObjectStepEndEvent, type GenerateObjectStepStartEvent, type GenerateTextAbortEvent, type GenerateTextEndEvent, type GenerateTextInclude, type GenerateTextOnAbortCallback, type GenerateTextOnEndCallback, type GenerateTextOnFinishCallback, type GenerateTextOnStartCallback, type GenerateTextOnStepEndCallback, type GenerateTextOnStepFinishCallback, type GenerateTextOnStepStartCallback, type GenerateTextResult, type GenerateTextStartEvent, type GenerateTextStepEndEvent, type GenerateTextStepStartEvent, type GenerateVideoPrompt, type GenerateVideoResult, type GeneratedAudioFile, type GeneratedFile, type GenericToolApprovalFunction, type GetVideoStatusResult, HttpChatTransport, type HttpChatTransportInitOptions, type ImageModel, type ImageModelMiddleware, type ImageModelProviderMetadata, type ImageModelResponseMetadata, type ImageModelUsage, type InferAgentUIMessage, type InferCompleteOutput as InferGenerateOutput, type InferPartialOutput as InferStreamOutput, type InferTelemetryEvent, type InferUIDataParts, type InferUIMessageChunk, type InferUITool, type InferUITools, type Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, type JSONValue, JsonToSseTransformStream, type LanguageModel, type LanguageModelCallEndEvent, type LanguageModelCallOptions, type LanguageModelCallStartEvent, type LanguageModelMiddleware, type LanguageModelRequestMetadata, type LanguageModelResponseMetadata, type LanguageModelUsage, type LogWarningsFunction, MessageConversionError, MissingToolResultsError, type ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, type ObjectStreamPart, type OnFinishEvent, type OnLanguageModelCallEndCallback, type OnLanguageModelCallStartCallback, type OnStartEvent, type OnStepFinishEvent, type OnStepStartEvent, type OnToolCallFinishEvent, type OnToolCallStartEvent, type OnToolExecutionEndCallback, type OnToolExecutionStartCallback, output as Output, type OutputChunkTimingStats, type Output as OutputInterface, type PrepareReconnectToStreamRequest, type PrepareSendMessagesRequest, type PrepareStepFunction, type PrepareStepResult, type Prompt, type Provider, type ProviderMetadata, type ProviderReference, type ProviderRegistryProvider, type ReasoningFileOutput, type ReasoningFileUIPart, type ReasoningOutput, type ReasoningUIPart, type RepairTextFunction, type RequestOptions, type RerankEndEvent, type RerankResult, type RerankStartEvent, type RerankingModel, type RerankingModelCallEndEvent, type RerankingModelCallStartEvent, RetryError, type SafeValidateUIMessagesResult, SerialJobExecutor, type SingleToolApprovalFunction, type SourceDocumentUIPart, type SourceUrlUIPart, type SpeechModel, type SpeechModelResponseMetadata, type SpeechResult, type StartVideoResult, type StaticToolCall, type StaticToolError, type StaticToolOutputDenied, type StaticToolResult, type StepResult, type StepResultPerformance, type StepStartUIPart, type StopCondition, type StreamObjectOnFinishCallback, type StreamObjectResult, StreamProviderError, type StreamTextEndEvent, type StreamTextInclude, type StreamTextOnChunkCallback, type StreamTextOnEndCallback, type StreamTextOnErrorCallback, type StreamTextOnErrorResult, type StreamTextOnErrorRetryCallback, type StreamTextResult, type StreamTextTransform, type StreamTranscriptionResult, type Telemetry, type TelemetryOptions, type TelemetryTracingChannelMessage, type TelemetryTracingEventType, TextStreamChatTransport, type TextStreamPart, type TextUIPart, type TimeoutConfiguration, type ToUIMessageChunkOptions, type ToolApprovalConfiguration, type ToolApprovalRequestOutput, type ToolApprovalResponseOutput, type ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, type ToolCallRepairFunction, type ToolChoice, ToolChoiceViolationError, type ToolExecutionEndEvent, type ToolExecutionStartEvent, type ToolInputRefinement, ToolLoopAgent, type ToolLoopAgentSettings, type ToolOrder, type ToolUIPart, type TranscriptionModel, type TranscriptionModelResponseMetadata, type TranscriptionResult, type TranscriptionStreamPart, type TypedToolCall, type TypedToolError, type TypedToolOutputDenied, type TypedToolResult, type UIDataPartSchemas, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, UIMessageStreamError, type UIMessageStreamOnEndCallback, type UIMessageStreamOnFinishCallback, type UIMessageStreamOnStepEndCallback, type UIMessageStreamOnStepFinishCallback, type UIMessageStreamOptions, type UIMessageStreamOutcome, type UIMessageStreamWriter, type UIMessageStreamWriterWithOutcome, type UITool, type UIToolInvocation, type UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, type UploadFileResult, type UploadSkillResult, type UseCompletionOptions, type Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, cancelBatch as experimental_cancelBatch, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, listBatches as experimental_listBatches, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
9871
+ export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, type ActiveTools, type Agent, type AgentCallParameters, type AgentStreamParameters, type AsyncIterableStream, type CallSettings, type CallWarning, type ChatAddToolApproveResponseFunction, type ChatAddToolOutputFunction, type ChatInit, type ChatOnDataCallback, type ChatOnErrorCallback, type ChatOnFinishCallback, type ChatOnToolCallCallback, type ChatRequestOptions, type ChatState, type ChatStatus, type ChatTransport, type ChunkDetector, type CompletionRequestOptions, type ContentPart, type CreateUIMessage, type CustomContentUIPart, type DataUIPart, type DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, type DirectChatTransportOptions, type DynamicToolCall, type DynamicToolError, type DynamicToolResult, type DynamicToolUIPart, type EmbedEndEvent, type EmbedManyResult, type EmbedResult, type EmbedStartEvent, type Embedding, type EmbeddingModel, type EmbeddingModelCallEndEvent, type EmbeddingModelCallStartEvent, type EmbeddingModelMiddleware, type EmbeddingModelUsage, type ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, type ToolLoopAgentSettings as Experimental_AgentSettings, type Batch as Experimental_Batch, type BatchError as Experimental_BatchError, type BatchItemResult as Experimental_BatchItemResult, type BatchProvider as Experimental_BatchProvider, type BatchReference as Experimental_BatchReference, type BatchRequest as Experimental_BatchRequest, type BatchStatus as Experimental_BatchStatus, type CancelBatchOptions as Experimental_CancelBatchOptions, type CancelBatchResult as Experimental_CancelBatchResult, type DownloadFunction as Experimental_DownloadFunction, type Experimental_GeneratedImage, type GetBatchResultsOptions as Experimental_GetBatchResultsOptions, type GetBatchStatusOptions as Experimental_GetBatchStatusOptions, type ImageBatchGenerationResult as Experimental_ImageBatchGenerationResult, type ImageBatchItemResult as Experimental_ImageBatchItemResult, type ImageBatchRequest as Experimental_ImageBatchRequest, type InferAgentUIMessage as Experimental_InferAgentUIMessage, type LanguageModelStreamPart as Experimental_LanguageModelStreamPart, type ListBatchesOptions as Experimental_ListBatchesOptions, type ListBatchesResult as Experimental_ListBatchesResult, type LogWarningsFunction as Experimental_LogWarningsFunction, type RealtimeClientEvent as Experimental_RealtimeClientEvent, type RealtimeFactory as Experimental_RealtimeFactory, type RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, type RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, type RealtimeModel as Experimental_RealtimeModel, type RealtimeServerEvent as Experimental_RealtimeServerEvent, type RealtimeSessionConfig as Experimental_RealtimeSessionConfig, type RealtimeSessionOptions as Experimental_RealtimeSessionOptions, type RealtimeSetupResponse as Experimental_RealtimeSetupResponse, type RealtimeState as Experimental_RealtimeState, type RealtimeStatus as Experimental_RealtimeStatus, type RealtimeToolDefinition as Experimental_RealtimeToolDefinition, type Experimental_SpeechResult, type StartBatchOptions as Experimental_StartBatchOptions, type StartBatchResult as Experimental_StartBatchResult, type StreamTranslationResult as Experimental_StreamTranslationResult, type TextBatchGenerationResult as Experimental_TextBatchGenerationResult, type TextBatchItemResult as Experimental_TextBatchItemResult, type TextBatchRequest as Experimental_TextBatchRequest, type Experimental_ToolCallers, type Experimental_TranscriptionResult, type TranslationStreamPart as Experimental_TranslationStreamPart, type FileUIPart, type FinishReason, type GenerateImageCall, type GenerateImageResult, type GenerateObjectEndEvent, type GenerateObjectResult, type GenerateObjectStartEvent, type GenerateObjectStepEndEvent, type GenerateObjectStepStartEvent, type GenerateTextAbortEvent, type GenerateTextEndEvent, type GenerateTextInclude, type GenerateTextOnAbortCallback, type GenerateTextOnEndCallback, type GenerateTextOnFinishCallback, type GenerateTextOnStartCallback, type GenerateTextOnStepEndCallback, type GenerateTextOnStepFinishCallback, type GenerateTextOnStepStartCallback, type GenerateTextResult, type GenerateTextStartEvent, type GenerateTextStepEndEvent, type GenerateTextStepStartEvent, type GenerateVideoPrompt, type GenerateVideoResult, type GeneratedAudioFile, type GeneratedFile, type GenericToolApprovalFunction, type GetVideoStatusResult, HttpChatTransport, type HttpChatTransportInitOptions, type ImageModel, type ImageModelMiddleware, type ImageModelProviderMetadata, type ImageModelResponseMetadata, type ImageModelUsage, type InferAgentUIMessage, type InferCompleteOutput as InferGenerateOutput, type InferPartialOutput as InferStreamOutput, type InferTelemetryEvent, type InferUIDataParts, type InferUIMessageChunk, type InferUITool, type InferUITools, type Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, type JSONValue, JsonToSseTransformStream, type LanguageModel, type LanguageModelCallEndEvent, type LanguageModelCallOptions, type LanguageModelCallStartEvent, type LanguageModelMiddleware, type LanguageModelRequestMetadata, type LanguageModelResponseMetadata, type LanguageModelUsage, type LogWarningsFunction, MessageConversionError, MissingToolResultsError, type ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoTranslationGeneratedError, NoVideoGeneratedError, type ObjectStreamPart, type OnFinishEvent, type OnLanguageModelCallEndCallback, type OnLanguageModelCallStartCallback, type OnStartEvent, type OnStepFinishEvent, type OnStepStartEvent, type OnToolCallFinishEvent, type OnToolCallStartEvent, type OnToolExecutionEndCallback, type OnToolExecutionStartCallback, output as Output, type OutputChunkTimingStats, type Output as OutputInterface, type PrepareReconnectToStreamRequest, type PrepareSendMessagesRequest, type PrepareStepFunction, type PrepareStepResult, type Prompt, type Provider, type ProviderMetadata, type ProviderReference, type ProviderRegistryProvider, type ReasoningFileOutput, type ReasoningFileUIPart, type ReasoningOutput, type ReasoningUIPart, type RepairTextFunction, type RequestOptions, type RerankEndEvent, type RerankResult, type RerankStartEvent, type RerankingModel, type RerankingModelCallEndEvent, type RerankingModelCallStartEvent, RetryError, type SafeValidateUIMessagesResult, SerialJobExecutor, type SingleToolApprovalFunction, type SourceDocumentUIPart, type SourceUrlUIPart, type SpeechModel, type SpeechModelResponseMetadata, type SpeechResult, type StartVideoResult, type StaticToolCall, type StaticToolError, type StaticToolOutputDenied, type StaticToolResult, type StepResult, type StepResultPerformance, type StepStartUIPart, type StopCondition, type StreamObjectOnFinishCallback, type StreamObjectResult, StreamProviderError, type StreamTextEndEvent, type StreamTextInclude, type StreamTextOnChunkCallback, type StreamTextOnEndCallback, type StreamTextOnErrorCallback, type StreamTextOnErrorResult, type StreamTextOnErrorRetryCallback, type StreamTextResult, type StreamTextTransform, type StreamTranscriptionResult, type Telemetry, type TelemetryOptions, type TelemetryTracingChannelMessage, type TelemetryTracingEventType, TextStreamChatTransport, type TextStreamPart, type TextUIPart, type TimeoutConfiguration, type ToUIMessageChunkOptions, type ToolApprovalConfiguration, type ToolApprovalRequestOutput, type ToolApprovalResponseOutput, type ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, type ToolCallRepairFunction, type ToolChoice, ToolChoiceViolationError, type ToolExecutionEndEvent, type ToolExecutionStartEvent, type ToolInputRefinement, ToolLoopAgent, type ToolLoopAgentSettings, type ToolOrder, type ToolOutputErrorUIPart, type ToolUIPart, type TranscriptionModel, type TranscriptionModelResponseMetadata, type TranscriptionResult, type TranscriptionStreamPart, type TypedToolCall, type TypedToolError, type TypedToolOutputDenied, type TypedToolResult, type UIDataPartSchemas, type UIDataTypes, type UIMessage, type UIMessageChunk, type UIMessagePart, UIMessageStreamError, type UIMessageStreamOnEndCallback, type UIMessageStreamOnFinishCallback, type UIMessageStreamOnStepEndCallback, type UIMessageStreamOnStepFinishCallback, type UIMessageStreamOptions, type UIMessageStreamOutcome, type UIMessageStreamWriter, type UIMessageStreamWriterWithOutcome, type UITool, type UIToolInvocation, type UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, type UploadFileResult, type UploadSkillResult, type UseCompletionOptions, type Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultInstructionsMiddleware, defaultSettingsMiddleware, detectToolDrift, embed, embedMany, cancelBatch as experimental_cancelBatch, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getBatchResults as experimental_getBatchResults, getBatchStatus as experimental_getBatchStatus, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, experimental_getVideoStatus, listBatches as experimental_listBatches, resampleAudio as experimental_resampleAudio, startBatch as experimental_startBatch, experimental_startVideo, streamLanguageModelCall as experimental_streamLanguageModelCall, streamTranscribe as experimental_streamTranscribe, streamTranslate as experimental_streamTranslate, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, fingerprintTools, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getFirstChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolOutputErrorUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };