@fondation-io/ai 7.0.0-beta.45 → 7.0.0-beta.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.0-beta.47
4
+
5
+ ### Patch Changes
6
+
7
+ - bc67b4f: feat(ai): add experimental callbacks for structured outputs
8
+
9
+ ## 7.0.0-beta.46
10
+
11
+ ### Patch Changes
12
+
13
+ - 31ee822: refactoring(ai): extract filterActiveTools and expose it as experimental_filterActiveTools
14
+
3
15
  ## 7.0.0-beta.45
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -896,6 +896,20 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
896
896
  declare function stepCountIs(stepCount: number): StopCondition<any>;
897
897
  declare function hasToolCall(toolName: string): StopCondition<any>;
898
898
 
899
+ type ActiveTools<TOOLS extends ToolSet, ACTIVE_TOOL_NAMES extends readonly (keyof TOOLS)[] | undefined> = [ACTIVE_TOOL_NAMES] extends [readonly (keyof TOOLS)[]] ? Pick<TOOLS, ACTIVE_TOOL_NAMES[number]> : TOOLS;
900
+ /**
901
+ * Filters the tools to only include the active tools.
902
+ * When activeTools is provided, we only include the tools that are in the list.
903
+ *
904
+ * @param tools - The tools to filter.
905
+ * @param activeTools - The active tools to include.
906
+ * @returns The filtered tools.
907
+ */
908
+ declare function filterActiveTools<TOOLS extends ToolSet, ACTIVE_TOOL_NAMES extends readonly (keyof TOOLS)[] | undefined>({ tools, activeTools, }: {
909
+ tools: TOOLS | undefined;
910
+ activeTools: ACTIVE_TOOL_NAMES;
911
+ }): ActiveTools<TOOLS, ACTIVE_TOOL_NAMES> | undefined;
912
+
899
913
  /**
900
914
  * Experimental. Can change in patch versions without warning.
901
915
  *
@@ -5661,6 +5675,180 @@ declare const experimental_generateImage: typeof generateImage;
5661
5675
  */
5662
5676
  type Experimental_GenerateImageResult = GenerateImageResult;
5663
5677
 
5678
+ /**
5679
+ * Event passed to the `experimental_onStart` callback of
5680
+ * `generateObject` and `streamObject`.
5681
+ *
5682
+ * Called when the operation begins, before any LLM call.
5683
+ */
5684
+ interface ObjectOnStartEvent {
5685
+ /** Unique identifier for this generation call, used to correlate events. */
5686
+ readonly callId: string;
5687
+ /** Identifies the operation type (e.g. `'ai.generateObject'` or `'ai.streamObject'`). */
5688
+ readonly operationId: string;
5689
+ /** The provider identifier (e.g., 'openai', 'anthropic'). */
5690
+ readonly provider: string;
5691
+ /** The specific model identifier (e.g., 'gpt-4o'). */
5692
+ readonly modelId: string;
5693
+ /** The system message(s) provided to the model. */
5694
+ readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
5695
+ /** The prompt string or array of messages if using the prompt option. */
5696
+ readonly prompt: string | Array<ModelMessage> | undefined;
5697
+ /** The messages array if using the messages option. */
5698
+ readonly messages: Array<ModelMessage> | undefined;
5699
+ /** Maximum number of tokens to generate. */
5700
+ readonly maxOutputTokens: number | undefined;
5701
+ /** Sampling temperature for generation. */
5702
+ readonly temperature: number | undefined;
5703
+ /** Top-p (nucleus) sampling parameter. */
5704
+ readonly topP: number | undefined;
5705
+ /** Top-k sampling parameter. */
5706
+ readonly topK: number | undefined;
5707
+ /** Presence penalty for generation. */
5708
+ readonly presencePenalty: number | undefined;
5709
+ /** Frequency penalty for generation. */
5710
+ readonly frequencyPenalty: number | undefined;
5711
+ /** Random seed for reproducible generation. */
5712
+ readonly seed: number | undefined;
5713
+ /** Maximum number of retries for failed requests. */
5714
+ readonly maxRetries: number;
5715
+ /** Additional HTTP headers sent with the request. */
5716
+ readonly headers: Record<string, string | undefined> | undefined;
5717
+ /** Additional provider-specific options. */
5718
+ readonly providerOptions: ProviderOptions | undefined;
5719
+ /** Abort signal for cancelling the operation. */
5720
+ readonly abortSignal: AbortSignal | undefined;
5721
+ /** The output strategy type. */
5722
+ readonly output: 'object' | 'array' | 'enum' | 'no-schema';
5723
+ /** The JSON Schema used for object generation, if any. */
5724
+ readonly schema: Record<string, unknown> | undefined;
5725
+ /** Optional name of the schema. */
5726
+ readonly schemaName: string | undefined;
5727
+ /** Optional description of the schema. */
5728
+ readonly schemaDescription: string | undefined;
5729
+ /** Whether telemetry is enabled. */
5730
+ readonly isEnabled: boolean | undefined;
5731
+ /** Whether to record inputs in telemetry. Enabled by default. */
5732
+ readonly recordInputs: boolean | undefined;
5733
+ /** Whether to record outputs in telemetry. Enabled by default. */
5734
+ readonly recordOutputs: boolean | undefined;
5735
+ /** Identifier from telemetry settings for grouping related operations. */
5736
+ readonly functionId: string | undefined;
5737
+ /** Additional metadata from telemetry settings. */
5738
+ readonly metadata: Record<string, JSONValue$1> | undefined;
5739
+ }
5740
+ /**
5741
+ * Event passed to the `experimental_onStepStart` callback of
5742
+ * `generateObject` and `streamObject`.
5743
+ *
5744
+ * Called when the model call (step) begins, before the provider is called.
5745
+ * For object generation, there is always exactly one step (step 0).
5746
+ */
5747
+ interface ObjectOnStepStartEvent {
5748
+ /** Unique identifier for this generation call, used to correlate events. */
5749
+ readonly callId: string;
5750
+ /** Zero-based index of the current step. Always `0` for object generation. */
5751
+ readonly stepNumber: 0;
5752
+ /** The provider identifier (e.g., 'openai', 'anthropic'). */
5753
+ readonly provider: string;
5754
+ /** The specific model identifier (e.g., 'gpt-4o'). */
5755
+ readonly modelId: string;
5756
+ /** Additional provider-specific options. */
5757
+ readonly providerOptions: ProviderOptions | undefined;
5758
+ /** Additional HTTP headers sent with the request. */
5759
+ readonly headers: Record<string, string | undefined> | undefined;
5760
+ /** Abort signal for cancelling the operation. */
5761
+ readonly abortSignal: AbortSignal | undefined;
5762
+ /** Identifier from telemetry settings for grouping related operations. */
5763
+ readonly functionId: string | undefined;
5764
+ /** Additional metadata from telemetry settings. */
5765
+ readonly metadata: Record<string, unknown> | undefined;
5766
+ /** The prompt messages in provider format (for telemetry). */
5767
+ readonly promptMessages?: LanguageModelV4Prompt;
5768
+ }
5769
+ /**
5770
+ * Event passed to the `onStepFinish` callback of
5771
+ * `generateObject` and `streamObject`.
5772
+ *
5773
+ * Called when the model call (step) completes, with the raw result
5774
+ * before JSON parsing and schema validation.
5775
+ */
5776
+ interface ObjectOnStepFinishEvent {
5777
+ /** Unique identifier for this generation call, used to correlate events. */
5778
+ readonly callId: string;
5779
+ /** Zero-based index of the current step. Always `0` for object generation. */
5780
+ readonly stepNumber: 0;
5781
+ /** The provider identifier (e.g., 'openai', 'anthropic'). */
5782
+ readonly provider: string;
5783
+ /** The specific model identifier (e.g., 'gpt-4o'). */
5784
+ readonly modelId: string;
5785
+ /** The unified reason why the generation finished. */
5786
+ readonly finishReason: FinishReason;
5787
+ /** The token usage of the generated response. */
5788
+ readonly usage: LanguageModelUsage;
5789
+ /** The raw text output from the model (before JSON parsing). */
5790
+ readonly objectText: string;
5791
+ /** The reasoning generated by the model, if any. */
5792
+ readonly reasoning: string | undefined;
5793
+ /** Warnings from the model provider (e.g. unsupported settings). */
5794
+ readonly warnings: CallWarning[] | undefined;
5795
+ /** Additional request information. */
5796
+ readonly request: LanguageModelRequestMetadata;
5797
+ /** Additional response information. */
5798
+ readonly response: LanguageModelResponseMetadata & {
5799
+ body?: unknown;
5800
+ };
5801
+ /** Additional provider-specific metadata. */
5802
+ readonly providerMetadata: ProviderMetadata | undefined;
5803
+ /** Identifier from telemetry settings for grouping related operations. */
5804
+ readonly functionId: string | undefined;
5805
+ /** Additional metadata from telemetry settings. */
5806
+ readonly metadata: Record<string, unknown> | undefined;
5807
+ }
5808
+ /**
5809
+ * Event passed to the `onFinish` callback of
5810
+ * `generateObject` and `streamObject`.
5811
+ *
5812
+ * Called when the entire operation completes, including JSON parsing
5813
+ * and schema validation. For `streamObject`, the object may be undefined
5814
+ * if validation failed (the error is provided in that case).
5815
+ */
5816
+ interface ObjectOnFinishEvent<RESULT> {
5817
+ /** Unique identifier for this generation call, used to correlate events. */
5818
+ readonly callId: string;
5819
+ /**
5820
+ * The generated object (typed according to the schema).
5821
+ * Always defined for `generateObject`. May be `undefined` for `streamObject`
5822
+ * when parsing or validation fails.
5823
+ */
5824
+ readonly object: RESULT | undefined;
5825
+ /**
5826
+ * Error from parsing or schema validation, if any.
5827
+ * Always `undefined` for `generateObject` (which throws instead).
5828
+ */
5829
+ readonly error: unknown | undefined;
5830
+ /** The reasoning generated by the model, if any. */
5831
+ readonly reasoning: string | undefined;
5832
+ /** The unified reason why the generation finished. */
5833
+ readonly finishReason: FinishReason;
5834
+ /** The token usage of the generated response. */
5835
+ readonly usage: LanguageModelUsage;
5836
+ /** Warnings from the model provider (e.g. unsupported settings). */
5837
+ readonly warnings: CallWarning[] | undefined;
5838
+ /** Additional request information. */
5839
+ readonly request: LanguageModelRequestMetadata;
5840
+ /** Additional response information. */
5841
+ readonly response: LanguageModelResponseMetadata & {
5842
+ body?: unknown;
5843
+ };
5844
+ /** Additional provider-specific metadata. */
5845
+ readonly providerMetadata: ProviderMetadata | undefined;
5846
+ /** Identifier from telemetry settings for grouping related operations. */
5847
+ readonly functionId: string | undefined;
5848
+ /** Additional metadata from telemetry settings. */
5849
+ readonly metadata: Record<string, unknown> | undefined;
5850
+ }
5851
+
5664
5852
  /**
5665
5853
  * The result of a `generateObject` call.
5666
5854
  */
@@ -5783,6 +5971,11 @@ type RepairTextFunction = (options: {
5783
5971
  * to the provider from the AI SDK and enable provider-specific
5784
5972
  * functionality that can be fully encapsulated in the provider.
5785
5973
  *
5974
+ * @param experimental_onStart - Callback invoked when generation begins, before the LLM call.
5975
+ * @param experimental_onStepStart - Callback invoked when the model call begins.
5976
+ * @param onStepFinish - Callback invoked when the model call completes with the raw result.
5977
+ * @param onFinish - Callback invoked when the entire operation completes with the parsed object.
5978
+ *
5786
5979
  * @returns
5787
5980
  * A result object that contains the generated object, the finish reason, the token usage, and additional information.
5788
5981
  *
@@ -5838,6 +6031,26 @@ declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = Flexibl
5838
6031
  * functionality that can be fully encapsulated in the provider.
5839
6032
  */
5840
6033
  providerOptions?: ProviderOptions;
6034
+ /**
6035
+ * Callback that is called when the generateObject operation begins,
6036
+ * before the LLM call is made.
6037
+ */
6038
+ experimental_onStart?: Listener<ObjectOnStartEvent>;
6039
+ /**
6040
+ * Callback that is called when the model call (step) begins,
6041
+ * before the provider is called.
6042
+ */
6043
+ experimental_onStepStart?: Listener<ObjectOnStepStartEvent>;
6044
+ /**
6045
+ * Callback that is called when the model call (step) completes,
6046
+ * with the raw result before JSON parsing.
6047
+ */
6048
+ onStepFinish?: Listener<ObjectOnStepFinishEvent>;
6049
+ /**
6050
+ * Callback that is called when the entire operation completes
6051
+ * with the final parsed and validated object.
6052
+ */
6053
+ onFinish?: Listener<ObjectOnFinishEvent<RESULT>>;
5841
6054
  /**
5842
6055
  * Internal. For test use only. May change without notice.
5843
6056
  */
@@ -6186,6 +6399,21 @@ declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleS
6186
6399
  * functionality that can be fully encapsulated in the provider.
6187
6400
  */
6188
6401
  providerOptions?: ProviderOptions;
6402
+ /**
6403
+ * Callback that is called when the streamObject operation begins,
6404
+ * before the LLM call is made.
6405
+ */
6406
+ experimental_onStart?: Listener<ObjectOnStartEvent>;
6407
+ /**
6408
+ * Callback that is called when the model call (step) begins,
6409
+ * before the provider is called.
6410
+ */
6411
+ experimental_onStepStart?: Listener<ObjectOnStepStartEvent>;
6412
+ /**
6413
+ * Callback that is called when the model streaming step completes,
6414
+ * with the raw accumulated text before final schema validation.
6415
+ */
6416
+ onStepFinish?: Listener<ObjectOnStepFinishEvent>;
6189
6417
  /**
6190
6418
  * Callback that is invoked when an error occurs during streaming.
6191
6419
  * You can use it to log errors.
@@ -6195,7 +6423,7 @@ declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleS
6195
6423
  /**
6196
6424
  * Callback that is called when the LLM response and the final object validation are finished.
6197
6425
  */
6198
- onFinish?: StreamObjectOnFinishCallback<RESULT>;
6426
+ onFinish?: Listener<ObjectOnFinishEvent<RESULT>>;
6199
6427
  /**
6200
6428
  * Internal. For test use only. May change without notice.
6201
6429
  */
@@ -7053,4 +7281,4 @@ declare global {
7053
7281
  var AI_SDK_TELEMETRY_INTEGRATIONS: TelemetryIntegration[] | undefined;
7054
7282
  }
7055
7283
 
7056
- export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedFinishEvent, EmbedManyResult, EmbedOnFinishEvent, EmbedOnStartEvent, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, ModelCallStreamPart as Experimental_ModelCallStreamPart, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankFinishEvent, RerankOnFinishEvent, RerankOnStartEvent, RerankResult, RerankStartEvent, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStartCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentOnStepStartCallback, ToolLoopAgentOnToolCallFinishCallback, ToolLoopAgentOnToolCallStartCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, streamModelCall as experimental_streamModelCall, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
7284
+ export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedFinishEvent, EmbedManyResult, EmbedOnFinishEvent, EmbedOnStartEvent, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, ModelCallStreamPart as Experimental_ModelCallStreamPart, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectOnFinishEvent, ObjectOnStartEvent, ObjectOnStepFinishEvent, ObjectOnStepStartEvent, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankFinishEvent, RerankOnFinishEvent, RerankOnStartEvent, RerankResult, RerankStartEvent, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStartCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentOnStepStartCallback, ToolLoopAgentOnToolCallFinishCallback, ToolLoopAgentOnToolCallStartCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, filterActiveTools as experimental_filterActiveTools, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, streamModelCall as experimental_streamModelCall, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
package/dist/index.d.ts CHANGED
@@ -896,6 +896,20 @@ type StopCondition<TOOLS extends ToolSet> = (options: {
896
896
  declare function stepCountIs(stepCount: number): StopCondition<any>;
897
897
  declare function hasToolCall(toolName: string): StopCondition<any>;
898
898
 
899
+ type ActiveTools<TOOLS extends ToolSet, ACTIVE_TOOL_NAMES extends readonly (keyof TOOLS)[] | undefined> = [ACTIVE_TOOL_NAMES] extends [readonly (keyof TOOLS)[]] ? Pick<TOOLS, ACTIVE_TOOL_NAMES[number]> : TOOLS;
900
+ /**
901
+ * Filters the tools to only include the active tools.
902
+ * When activeTools is provided, we only include the tools that are in the list.
903
+ *
904
+ * @param tools - The tools to filter.
905
+ * @param activeTools - The active tools to include.
906
+ * @returns The filtered tools.
907
+ */
908
+ declare function filterActiveTools<TOOLS extends ToolSet, ACTIVE_TOOL_NAMES extends readonly (keyof TOOLS)[] | undefined>({ tools, activeTools, }: {
909
+ tools: TOOLS | undefined;
910
+ activeTools: ACTIVE_TOOL_NAMES;
911
+ }): ActiveTools<TOOLS, ACTIVE_TOOL_NAMES> | undefined;
912
+
899
913
  /**
900
914
  * Experimental. Can change in patch versions without warning.
901
915
  *
@@ -5661,6 +5675,180 @@ declare const experimental_generateImage: typeof generateImage;
5661
5675
  */
5662
5676
  type Experimental_GenerateImageResult = GenerateImageResult;
5663
5677
 
5678
+ /**
5679
+ * Event passed to the `experimental_onStart` callback of
5680
+ * `generateObject` and `streamObject`.
5681
+ *
5682
+ * Called when the operation begins, before any LLM call.
5683
+ */
5684
+ interface ObjectOnStartEvent {
5685
+ /** Unique identifier for this generation call, used to correlate events. */
5686
+ readonly callId: string;
5687
+ /** Identifies the operation type (e.g. `'ai.generateObject'` or `'ai.streamObject'`). */
5688
+ readonly operationId: string;
5689
+ /** The provider identifier (e.g., 'openai', 'anthropic'). */
5690
+ readonly provider: string;
5691
+ /** The specific model identifier (e.g., 'gpt-4o'). */
5692
+ readonly modelId: string;
5693
+ /** The system message(s) provided to the model. */
5694
+ readonly system: string | SystemModelMessage | Array<SystemModelMessage> | undefined;
5695
+ /** The prompt string or array of messages if using the prompt option. */
5696
+ readonly prompt: string | Array<ModelMessage> | undefined;
5697
+ /** The messages array if using the messages option. */
5698
+ readonly messages: Array<ModelMessage> | undefined;
5699
+ /** Maximum number of tokens to generate. */
5700
+ readonly maxOutputTokens: number | undefined;
5701
+ /** Sampling temperature for generation. */
5702
+ readonly temperature: number | undefined;
5703
+ /** Top-p (nucleus) sampling parameter. */
5704
+ readonly topP: number | undefined;
5705
+ /** Top-k sampling parameter. */
5706
+ readonly topK: number | undefined;
5707
+ /** Presence penalty for generation. */
5708
+ readonly presencePenalty: number | undefined;
5709
+ /** Frequency penalty for generation. */
5710
+ readonly frequencyPenalty: number | undefined;
5711
+ /** Random seed for reproducible generation. */
5712
+ readonly seed: number | undefined;
5713
+ /** Maximum number of retries for failed requests. */
5714
+ readonly maxRetries: number;
5715
+ /** Additional HTTP headers sent with the request. */
5716
+ readonly headers: Record<string, string | undefined> | undefined;
5717
+ /** Additional provider-specific options. */
5718
+ readonly providerOptions: ProviderOptions | undefined;
5719
+ /** Abort signal for cancelling the operation. */
5720
+ readonly abortSignal: AbortSignal | undefined;
5721
+ /** The output strategy type. */
5722
+ readonly output: 'object' | 'array' | 'enum' | 'no-schema';
5723
+ /** The JSON Schema used for object generation, if any. */
5724
+ readonly schema: Record<string, unknown> | undefined;
5725
+ /** Optional name of the schema. */
5726
+ readonly schemaName: string | undefined;
5727
+ /** Optional description of the schema. */
5728
+ readonly schemaDescription: string | undefined;
5729
+ /** Whether telemetry is enabled. */
5730
+ readonly isEnabled: boolean | undefined;
5731
+ /** Whether to record inputs in telemetry. Enabled by default. */
5732
+ readonly recordInputs: boolean | undefined;
5733
+ /** Whether to record outputs in telemetry. Enabled by default. */
5734
+ readonly recordOutputs: boolean | undefined;
5735
+ /** Identifier from telemetry settings for grouping related operations. */
5736
+ readonly functionId: string | undefined;
5737
+ /** Additional metadata from telemetry settings. */
5738
+ readonly metadata: Record<string, JSONValue$1> | undefined;
5739
+ }
5740
+ /**
5741
+ * Event passed to the `experimental_onStepStart` callback of
5742
+ * `generateObject` and `streamObject`.
5743
+ *
5744
+ * Called when the model call (step) begins, before the provider is called.
5745
+ * For object generation, there is always exactly one step (step 0).
5746
+ */
5747
+ interface ObjectOnStepStartEvent {
5748
+ /** Unique identifier for this generation call, used to correlate events. */
5749
+ readonly callId: string;
5750
+ /** Zero-based index of the current step. Always `0` for object generation. */
5751
+ readonly stepNumber: 0;
5752
+ /** The provider identifier (e.g., 'openai', 'anthropic'). */
5753
+ readonly provider: string;
5754
+ /** The specific model identifier (e.g., 'gpt-4o'). */
5755
+ readonly modelId: string;
5756
+ /** Additional provider-specific options. */
5757
+ readonly providerOptions: ProviderOptions | undefined;
5758
+ /** Additional HTTP headers sent with the request. */
5759
+ readonly headers: Record<string, string | undefined> | undefined;
5760
+ /** Abort signal for cancelling the operation. */
5761
+ readonly abortSignal: AbortSignal | undefined;
5762
+ /** Identifier from telemetry settings for grouping related operations. */
5763
+ readonly functionId: string | undefined;
5764
+ /** Additional metadata from telemetry settings. */
5765
+ readonly metadata: Record<string, unknown> | undefined;
5766
+ /** The prompt messages in provider format (for telemetry). */
5767
+ readonly promptMessages?: LanguageModelV4Prompt;
5768
+ }
5769
+ /**
5770
+ * Event passed to the `onStepFinish` callback of
5771
+ * `generateObject` and `streamObject`.
5772
+ *
5773
+ * Called when the model call (step) completes, with the raw result
5774
+ * before JSON parsing and schema validation.
5775
+ */
5776
+ interface ObjectOnStepFinishEvent {
5777
+ /** Unique identifier for this generation call, used to correlate events. */
5778
+ readonly callId: string;
5779
+ /** Zero-based index of the current step. Always `0` for object generation. */
5780
+ readonly stepNumber: 0;
5781
+ /** The provider identifier (e.g., 'openai', 'anthropic'). */
5782
+ readonly provider: string;
5783
+ /** The specific model identifier (e.g., 'gpt-4o'). */
5784
+ readonly modelId: string;
5785
+ /** The unified reason why the generation finished. */
5786
+ readonly finishReason: FinishReason;
5787
+ /** The token usage of the generated response. */
5788
+ readonly usage: LanguageModelUsage;
5789
+ /** The raw text output from the model (before JSON parsing). */
5790
+ readonly objectText: string;
5791
+ /** The reasoning generated by the model, if any. */
5792
+ readonly reasoning: string | undefined;
5793
+ /** Warnings from the model provider (e.g. unsupported settings). */
5794
+ readonly warnings: CallWarning[] | undefined;
5795
+ /** Additional request information. */
5796
+ readonly request: LanguageModelRequestMetadata;
5797
+ /** Additional response information. */
5798
+ readonly response: LanguageModelResponseMetadata & {
5799
+ body?: unknown;
5800
+ };
5801
+ /** Additional provider-specific metadata. */
5802
+ readonly providerMetadata: ProviderMetadata | undefined;
5803
+ /** Identifier from telemetry settings for grouping related operations. */
5804
+ readonly functionId: string | undefined;
5805
+ /** Additional metadata from telemetry settings. */
5806
+ readonly metadata: Record<string, unknown> | undefined;
5807
+ }
5808
+ /**
5809
+ * Event passed to the `onFinish` callback of
5810
+ * `generateObject` and `streamObject`.
5811
+ *
5812
+ * Called when the entire operation completes, including JSON parsing
5813
+ * and schema validation. For `streamObject`, the object may be undefined
5814
+ * if validation failed (the error is provided in that case).
5815
+ */
5816
+ interface ObjectOnFinishEvent<RESULT> {
5817
+ /** Unique identifier for this generation call, used to correlate events. */
5818
+ readonly callId: string;
5819
+ /**
5820
+ * The generated object (typed according to the schema).
5821
+ * Always defined for `generateObject`. May be `undefined` for `streamObject`
5822
+ * when parsing or validation fails.
5823
+ */
5824
+ readonly object: RESULT | undefined;
5825
+ /**
5826
+ * Error from parsing or schema validation, if any.
5827
+ * Always `undefined` for `generateObject` (which throws instead).
5828
+ */
5829
+ readonly error: unknown | undefined;
5830
+ /** The reasoning generated by the model, if any. */
5831
+ readonly reasoning: string | undefined;
5832
+ /** The unified reason why the generation finished. */
5833
+ readonly finishReason: FinishReason;
5834
+ /** The token usage of the generated response. */
5835
+ readonly usage: LanguageModelUsage;
5836
+ /** Warnings from the model provider (e.g. unsupported settings). */
5837
+ readonly warnings: CallWarning[] | undefined;
5838
+ /** Additional request information. */
5839
+ readonly request: LanguageModelRequestMetadata;
5840
+ /** Additional response information. */
5841
+ readonly response: LanguageModelResponseMetadata & {
5842
+ body?: unknown;
5843
+ };
5844
+ /** Additional provider-specific metadata. */
5845
+ readonly providerMetadata: ProviderMetadata | undefined;
5846
+ /** Identifier from telemetry settings for grouping related operations. */
5847
+ readonly functionId: string | undefined;
5848
+ /** Additional metadata from telemetry settings. */
5849
+ readonly metadata: Record<string, unknown> | undefined;
5850
+ }
5851
+
5664
5852
  /**
5665
5853
  * The result of a `generateObject` call.
5666
5854
  */
@@ -5783,6 +5971,11 @@ type RepairTextFunction = (options: {
5783
5971
  * to the provider from the AI SDK and enable provider-specific
5784
5972
  * functionality that can be fully encapsulated in the provider.
5785
5973
  *
5974
+ * @param experimental_onStart - Callback invoked when generation begins, before the LLM call.
5975
+ * @param experimental_onStepStart - Callback invoked when the model call begins.
5976
+ * @param onStepFinish - Callback invoked when the model call completes with the raw result.
5977
+ * @param onFinish - Callback invoked when the entire operation completes with the parsed object.
5978
+ *
5786
5979
  * @returns
5787
5980
  * A result object that contains the generated object, the finish reason, the token usage, and additional information.
5788
5981
  *
@@ -5838,6 +6031,26 @@ declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = Flexibl
5838
6031
  * functionality that can be fully encapsulated in the provider.
5839
6032
  */
5840
6033
  providerOptions?: ProviderOptions;
6034
+ /**
6035
+ * Callback that is called when the generateObject operation begins,
6036
+ * before the LLM call is made.
6037
+ */
6038
+ experimental_onStart?: Listener<ObjectOnStartEvent>;
6039
+ /**
6040
+ * Callback that is called when the model call (step) begins,
6041
+ * before the provider is called.
6042
+ */
6043
+ experimental_onStepStart?: Listener<ObjectOnStepStartEvent>;
6044
+ /**
6045
+ * Callback that is called when the model call (step) completes,
6046
+ * with the raw result before JSON parsing.
6047
+ */
6048
+ onStepFinish?: Listener<ObjectOnStepFinishEvent>;
6049
+ /**
6050
+ * Callback that is called when the entire operation completes
6051
+ * with the final parsed and validated object.
6052
+ */
6053
+ onFinish?: Listener<ObjectOnFinishEvent<RESULT>>;
5841
6054
  /**
5842
6055
  * Internal. For test use only. May change without notice.
5843
6056
  */
@@ -6186,6 +6399,21 @@ declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleS
6186
6399
  * functionality that can be fully encapsulated in the provider.
6187
6400
  */
6188
6401
  providerOptions?: ProviderOptions;
6402
+ /**
6403
+ * Callback that is called when the streamObject operation begins,
6404
+ * before the LLM call is made.
6405
+ */
6406
+ experimental_onStart?: Listener<ObjectOnStartEvent>;
6407
+ /**
6408
+ * Callback that is called when the model call (step) begins,
6409
+ * before the provider is called.
6410
+ */
6411
+ experimental_onStepStart?: Listener<ObjectOnStepStartEvent>;
6412
+ /**
6413
+ * Callback that is called when the model streaming step completes,
6414
+ * with the raw accumulated text before final schema validation.
6415
+ */
6416
+ onStepFinish?: Listener<ObjectOnStepFinishEvent>;
6189
6417
  /**
6190
6418
  * Callback that is invoked when an error occurs during streaming.
6191
6419
  * You can use it to log errors.
@@ -6195,7 +6423,7 @@ declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleS
6195
6423
  /**
6196
6424
  * Callback that is called when the LLM response and the final object validation are finished.
6197
6425
  */
6198
- onFinish?: StreamObjectOnFinishCallback<RESULT>;
6426
+ onFinish?: Listener<ObjectOnFinishEvent<RESULT>>;
6199
6427
  /**
6200
6428
  * Internal. For test use only. May change without notice.
6201
6429
  */
@@ -7053,4 +7281,4 @@ declare global {
7053
7281
  var AI_SDK_TELEMETRY_INTEGRATIONS: TelemetryIntegration[] | undefined;
7054
7282
  }
7055
7283
 
7056
- export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedFinishEvent, EmbedManyResult, EmbedOnFinishEvent, EmbedOnStartEvent, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, ModelCallStreamPart as Experimental_ModelCallStreamPart, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankFinishEvent, RerankOnFinishEvent, RerankOnStartEvent, RerankResult, RerankStartEvent, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStartCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentOnStepStartCallback, ToolLoopAgentOnToolCallFinishCallback, ToolLoopAgentOnToolCallStartCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, streamModelCall as experimental_streamModelCall, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
7284
+ export { AbstractChat, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedFinishEvent, EmbedManyResult, EmbedOnFinishEvent, EmbedOnStartEvent, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LogWarningsFunction as Experimental_LogWarningsFunction, ModelCallStreamPart as Experimental_ModelCallStreamPart, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectResult, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextOnToolCallFinishCallback, GenerateTextOnToolCallStartCallback, GenerateTextResult, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectOnFinishEvent, ObjectOnStartEvent, ObjectOnStepFinishEvent, ObjectOnStepStartEvent, ObjectStreamPart, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RerankFinishEvent, RerankOnFinishEvent, RerankOnStartEvent, RerankResult, RerankStartEvent, RerankingModel, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStartCallback, StreamTextOnStepFinishCallback, StreamTextOnStepStartCallback, StreamTextOnToolCallFinishCallback, StreamTextOnToolCallStartCallback, StreamTextResult, StreamTextTransform, TelemetryIntegration, TelemetrySettings, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToolApprovalRequestOutput, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolLoopAgent, ToolLoopAgentOnFinishCallback, ToolLoopAgentOnStartCallback, ToolLoopAgentOnStepFinishCallback, ToolLoopAgentOnStepStartCallback, ToolLoopAgentOnToolCallFinishCallback, ToolLoopAgentOnToolCallStartCallback, ToolLoopAgentSettings, ToolSet, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, bindTelemetryIntegration, callCompletionApi, consumeStream, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, experimental_customProvider, filterActiveTools as experimental_filterActiveTools, experimental_generateImage, generateSpeech as experimental_generateSpeech, experimental_generateVideo, streamModelCall as experimental_streamModelCall, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };