ai 7.0.0-beta.89 → 7.0.0-beta.90

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,11 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.0-beta.90
4
+
5
+ ### Patch Changes
6
+
7
+ - 1db29c8: feat(ai): break `CallSettings` apart into `LanguageModelCallOptions` and `RequestOptions`
8
+
3
9
  ## 7.0.0-beta.89
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -640,22 +640,11 @@ type PartialObject<ObjectType extends object> = {
640
640
  };
641
641
 
642
642
  /**
643
- * Timeout configuration for API calls. Can be specified as:
644
- * - A number representing milliseconds
645
- * - An object with `totalMs` property for the total timeout in milliseconds
646
- * - An object with `stepMs` property for the timeout of each step in milliseconds
647
- * - An object with `chunkMs` property for the timeout between stream chunks (streaming only)
648
- * - An object with `toolMs` property for the default timeout for all tool executions
649
- * - An object with `tools` property for per-tool timeout overrides using `{toolName}Ms` keys
643
+ * Model-facing generation controls. These settings influence how the model
644
+ * generates its response (token limits, sampling, penalties, stop sequences,
645
+ * seed, reasoning).
650
646
  */
651
- type TimeoutConfiguration<TOOLS extends ToolSet> = number | {
652
- totalMs?: number;
653
- stepMs?: number;
654
- chunkMs?: number;
655
- toolMs?: number;
656
- tools?: Partial<Record<`${keyof TOOLS & string}Ms`, number>>;
657
- };
658
- type CallSettings = {
647
+ type LanguageModelCallOptions = {
659
648
  /**
660
649
  * Maximum number of tokens to generate.
661
650
  */
@@ -717,6 +706,52 @@ type CallSettings = {
717
706
  * Use `'none'` to disable reasoning (if supported by the provider).
718
707
  */
719
708
  reasoning?: LanguageModelV4CallOptions['reasoning'];
709
+ };
710
+
711
+ /**
712
+ * Timeout configuration for API calls. Can be specified as:
713
+ * - A number representing milliseconds
714
+ * - An object with `totalMs` property for the total timeout in milliseconds
715
+ * - An object with `stepMs` property for the timeout of each step in milliseconds
716
+ * - An object with `chunkMs` property for the timeout between stream chunks (streaming only)
717
+ * - An object with `toolMs` property for the default timeout for all tool executions
718
+ * - An object with `tools` property for per-tool timeout overrides using `{toolName}Ms` keys
719
+ */
720
+ type TimeoutConfiguration<TOOLS extends ToolSet> = number | {
721
+ totalMs?: number;
722
+ stepMs?: number;
723
+ chunkMs?: number;
724
+ toolMs?: number;
725
+ tools?: Partial<Record<`${keyof TOOLS & string}Ms`, number>>;
726
+ };
727
+ /**
728
+ * Extracts the total timeout value in milliseconds from a TimeoutConfiguration.
729
+ *
730
+ * @param timeout - The timeout configuration.
731
+ * @returns The total timeout in milliseconds, or undefined if no timeout is configured.
732
+ */
733
+ declare function getTotalTimeoutMs(timeout: TimeoutConfiguration<any> | undefined): number | undefined;
734
+ /**
735
+ * Extracts the step timeout value in milliseconds from a TimeoutConfiguration.
736
+ *
737
+ * @param timeout - The timeout configuration.
738
+ * @returns The step timeout in milliseconds, or undefined if no step timeout is configured.
739
+ */
740
+ declare function getStepTimeoutMs(timeout: TimeoutConfiguration<any> | undefined): number | undefined;
741
+ /**
742
+ * Extracts the chunk timeout value in milliseconds from a TimeoutConfiguration.
743
+ * This timeout is for streaming only - it aborts if no new chunk is received within the specified duration.
744
+ *
745
+ * @param timeout - The timeout configuration.
746
+ * @returns The chunk timeout in milliseconds, or undefined if no chunk timeout is configured.
747
+ */
748
+ declare function getChunkTimeoutMs(timeout: TimeoutConfiguration<any> | undefined): number | undefined;
749
+ declare function getToolTimeoutMs<TOOLS extends ToolSet>(timeout: TimeoutConfiguration<TOOLS> | undefined, toolName: keyof TOOLS & string): number | undefined;
750
+ /**
751
+ * Request-facing controls. These settings affect transport, retries,
752
+ * cancellation, headers, and timeout – not model generation behavior.
753
+ */
754
+ type RequestOptions<TOOLS extends ToolSet = ToolSet> = {
720
755
  /**
721
756
  * Maximum number of retries. Set to 0 to disable retries.
722
757
  *
@@ -732,6 +767,10 @@ type CallSettings = {
732
767
  * Only applicable for HTTP-based providers.
733
768
  */
734
769
  headers?: Record<string, string | undefined>;
770
+ /**
771
+ * Timeout configuration for the request.
772
+ */
773
+ timeout?: TimeoutConfiguration<TOOLS>;
735
774
  };
736
775
 
737
776
  /**
@@ -1452,6 +1491,9 @@ declare const modelMessageSchema: z.ZodType<ModelMessage>;
1452
1491
  */
1453
1492
  declare function convertDataContentToBase64String(content: DataContent): string;
1454
1493
 
1494
+ /** @deprecated Use `LanguageModelCallOptions` combined with `RequestOptions` instead. */
1495
+ type CallSettings = LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>;
1496
+
1455
1497
  /**
1456
1498
  * A function that attempts to repair a tool call that failed to parse.
1457
1499
  *
@@ -1599,18 +1641,11 @@ type GenerateTextOnFinishCallback<TOOLS extends ToolSet = ToolSet, USER_CONTEXT
1599
1641
  * @returns
1600
1642
  * A result object that contains the generated text, the results of the tool calls, and additional information.
1601
1643
  */
1602
- declare function generateText<TOOLS extends ToolSet, USER_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, context: contextArg, experimental_include: include, _internal: { generateId, generateCallId, }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: CallSettings & Prompt & ContextParameter<TOOLS, USER_CONTEXT> & {
1644
+ declare function generateText<TOOLS extends ToolSet, USER_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string>>({ model: modelArg, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, experimental_download: download, context: contextArg, experimental_include: include, _internal: { generateId, generateCallId, }, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, onStepFinish, onFinish, ...settings }: LanguageModelCallOptions & RequestOptions<TOOLS> & Prompt & ContextParameter<TOOLS, USER_CONTEXT> & {
1603
1645
  /**
1604
1646
  * The language model to use.
1605
1647
  */
1606
1648
  model: LanguageModel;
1607
- /**
1608
- * Timeout in milliseconds. The call will be aborted if it takes longer
1609
- * than the specified timeout. Can be used alongside abortSignal.
1610
- *
1611
- * Can be specified as a number (milliseconds) or as an object with `totalMs`.
1612
- */
1613
- timeout?: TimeoutConfiguration<TOOLS>;
1614
1649
  /**
1615
1650
  * The tool choice strategy. Default: 'auto'.
1616
1651
  */
@@ -1871,6 +1906,7 @@ declare function streamLanguageModelCall<TOOLS extends ToolSet, OUTPUT extends O
1871
1906
  output?: OUTPUT;
1872
1907
  toolChoice?: ToolChoice<TOOLS>;
1873
1908
  download?: DownloadFunction;
1909
+ abortSignal?: AbortSignal;
1874
1910
  headers?: Record<string, string | undefined>;
1875
1911
  includeRawChunks?: boolean;
1876
1912
  providerOptions?: ProviderOptions;
@@ -1878,7 +1914,7 @@ declare function streamLanguageModelCall<TOOLS extends ToolSet, OUTPUT extends O
1878
1914
  onStart?: (args: {
1879
1915
  promptMessages: LanguageModelV4Prompt;
1880
1916
  }) => Promise<void> | void;
1881
- } & Prompt & Omit<CallSettings, 'maxRetries'>): Promise<{
1917
+ } & Prompt & LanguageModelCallOptions): Promise<{
1882
1918
  stream: AsyncIterableStream<LanguageModelStreamPart<TOOLS>>;
1883
1919
  request?: {
1884
1920
  /**
@@ -3747,18 +3783,11 @@ type StreamTextOnToolCallFinishCallback<TOOLS extends ToolSet = ToolSet> = Callb
3747
3783
  * @returns
3748
3784
  * A result object for accessing different stream types and additional information.
3749
3785
  */
3750
- declare function streamText<TOOLS extends ToolSet, USER_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, context: contextArg, experimental_include: include, _internal: { now, generateId, generateCallId, }, ...settings }: CallSettings & Prompt & ContextParameter<TOOLS, USER_CONTEXT> & {
3786
+ declare function streamText<TOOLS extends ToolSet, USER_CONTEXT extends Context = Context, OUTPUT extends Output = Output<string, string, never>>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, timeout, headers, stopWhen, experimental_output, output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, experimental_download: download, includeRawChunks, onChunk, onError, onFinish, onAbort, onStepFinish, experimental_onStart: onStart, experimental_onStepStart: onStepStart, experimental_onToolCallStart: onToolCallStart, experimental_onToolCallFinish: onToolCallFinish, context: contextArg, experimental_include: include, _internal: { now, generateId, generateCallId, }, ...settings }: LanguageModelCallOptions & RequestOptions<TOOLS> & Prompt & ContextParameter<TOOLS, USER_CONTEXT> & {
3751
3787
  /**
3752
3788
  * The language model to use.
3753
3789
  */
3754
3790
  model: LanguageModel;
3755
- /**
3756
- * Timeout in milliseconds. The call will be aborted if it takes longer
3757
- * than the specified timeout. Can be used alongside abortSignal.
3758
- *
3759
- * Can be specified as a number (milliseconds) or as an object with `totalMs`.
3760
- */
3761
- timeout?: TimeoutConfiguration<TOOLS>;
3762
3791
  /**
3763
3792
  * The tool choice strategy. Default: 'auto'.
3764
3793
  */
@@ -4183,14 +4212,7 @@ type ToolLoopAgentOnFinishCallback<TOOLS extends ToolSet = ToolSet, USER_CONTEXT
4183
4212
  /**
4184
4213
  * Configuration options for an agent.
4185
4214
  */
4186
- type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, USER_CONTEXT extends Context = Context, OUTPUT extends Output = never> = Omit<CallSettings, 'abortSignal'> & ContextParameter<TOOLS, USER_CONTEXT> & {
4187
- /**
4188
- * Timeout in milliseconds. The call will be aborted if it takes longer
4189
- * than the specified timeout. Can be used alongside abortSignal.
4190
- *
4191
- * Can be specified as a number (milliseconds) or as an object with `totalMs`.
4192
- */
4193
- timeout?: TimeoutConfiguration<TOOLS>;
4215
+ type ToolLoopAgentSettings<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, USER_CONTEXT extends Context = Context, OUTPUT extends Output = never> = LanguageModelCallOptions & Omit<RequestOptions<TOOLS>, 'abortSignal'> & ContextParameter<TOOLS, USER_CONTEXT> & {
4194
4216
  /**
4195
4217
  * The id of the agent.
4196
4218
  */
@@ -6084,7 +6106,7 @@ type RepairTextFunction = (options: {
6084
6106
  *
6085
6107
  * @deprecated Use `generateText` with an `output` setting instead.
6086
6108
  */
6087
- declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue$1>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
6109
+ declare function generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue$1>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<LanguageModelCallOptions, 'stopSequences'> & Omit<RequestOptions, 'timeout'> & Prompt & (OUTPUT extends 'enum' ? {
6088
6110
  /**
6089
6111
  * The enum values that the model should use.
6090
6112
  */
@@ -6452,7 +6474,7 @@ type StreamObjectOnFinishCallback<RESULT> = (event: {
6452
6474
  *
6453
6475
  * @deprecated Use `streamText` with an `output` setting instead.
6454
6476
  */
6455
- declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue$1>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<CallSettings, 'stopSequences'> & Prompt & (OUTPUT extends 'enum' ? {
6477
+ declare function streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue$1>, OUTPUT extends 'object' | 'array' | 'enum' | 'no-schema' = InferSchema<SCHEMA> extends string ? 'enum' : 'object', RESULT = OUTPUT extends 'array' ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(options: Omit<LanguageModelCallOptions, 'stopSequences'> & Omit<RequestOptions, 'timeout'> & Prompt & (OUTPUT extends 'enum' ? {
6456
6478
  /**
6457
6479
  * The enum values that the model should use.
6458
6480
  */
@@ -7446,4 +7468,4 @@ declare global {
7446
7468
  var AI_SDK_TELEMETRY_INTEGRATIONS: TelemetryIntegration[] | undefined;
7447
7469
  }
7448
7470
 
7449
- 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, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, 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, OnChunkEvent, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, 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, 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, UploadFileResult, UploadSkillResult, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, 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, streamLanguageModelCall as experimental_streamLanguageModelCall, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getStaticToolName, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
7471
+ 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, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, 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, LanguageModelCallOptions, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectOnFinishEvent, ObjectOnStartEvent, ObjectOnStepFinishEvent, ObjectOnStepStartEvent, ObjectStreamPart, OnChunkEvent, OnFinishEvent, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, output as Output, Output as OutputInterface, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, 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, 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, UploadFileResult, UploadSkillResult, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, 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, streamLanguageModelCall as experimental_streamLanguageModelCall, transcribe as experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateText, getChunkTimeoutMs, 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, registerTelemetryIntegration, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toolModelMessageSchema, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
package/dist/index.js CHANGED
@@ -1002,7 +1002,102 @@ function getGlobalProvider() {
1002
1002
  return asProviderV4(provider);
1003
1003
  }
1004
1004
 
1005
- // src/prompt/call-settings.ts
1005
+ // src/prompt/prepare-language-model-call-options.ts
1006
+ function prepareLanguageModelCallOptions({
1007
+ maxOutputTokens,
1008
+ temperature,
1009
+ topP,
1010
+ topK,
1011
+ presencePenalty,
1012
+ frequencyPenalty,
1013
+ seed,
1014
+ stopSequences,
1015
+ reasoning
1016
+ }) {
1017
+ if (maxOutputTokens != null) {
1018
+ if (!Number.isInteger(maxOutputTokens)) {
1019
+ throw new InvalidArgumentError({
1020
+ parameter: "maxOutputTokens",
1021
+ value: maxOutputTokens,
1022
+ message: "maxOutputTokens must be an integer"
1023
+ });
1024
+ }
1025
+ if (maxOutputTokens < 1) {
1026
+ throw new InvalidArgumentError({
1027
+ parameter: "maxOutputTokens",
1028
+ value: maxOutputTokens,
1029
+ message: "maxOutputTokens must be >= 1"
1030
+ });
1031
+ }
1032
+ }
1033
+ if (temperature != null) {
1034
+ if (typeof temperature !== "number") {
1035
+ throw new InvalidArgumentError({
1036
+ parameter: "temperature",
1037
+ value: temperature,
1038
+ message: "temperature must be a number"
1039
+ });
1040
+ }
1041
+ }
1042
+ if (topP != null) {
1043
+ if (typeof topP !== "number") {
1044
+ throw new InvalidArgumentError({
1045
+ parameter: "topP",
1046
+ value: topP,
1047
+ message: "topP must be a number"
1048
+ });
1049
+ }
1050
+ }
1051
+ if (topK != null) {
1052
+ if (typeof topK !== "number") {
1053
+ throw new InvalidArgumentError({
1054
+ parameter: "topK",
1055
+ value: topK,
1056
+ message: "topK must be a number"
1057
+ });
1058
+ }
1059
+ }
1060
+ if (presencePenalty != null) {
1061
+ if (typeof presencePenalty !== "number") {
1062
+ throw new InvalidArgumentError({
1063
+ parameter: "presencePenalty",
1064
+ value: presencePenalty,
1065
+ message: "presencePenalty must be a number"
1066
+ });
1067
+ }
1068
+ }
1069
+ if (frequencyPenalty != null) {
1070
+ if (typeof frequencyPenalty !== "number") {
1071
+ throw new InvalidArgumentError({
1072
+ parameter: "frequencyPenalty",
1073
+ value: frequencyPenalty,
1074
+ message: "frequencyPenalty must be a number"
1075
+ });
1076
+ }
1077
+ }
1078
+ if (seed != null) {
1079
+ if (!Number.isInteger(seed)) {
1080
+ throw new InvalidArgumentError({
1081
+ parameter: "seed",
1082
+ value: seed,
1083
+ message: "seed must be an integer"
1084
+ });
1085
+ }
1086
+ }
1087
+ return {
1088
+ maxOutputTokens,
1089
+ temperature,
1090
+ topP,
1091
+ topK,
1092
+ presencePenalty,
1093
+ frequencyPenalty,
1094
+ stopSequences,
1095
+ seed,
1096
+ reasoning
1097
+ };
1098
+ }
1099
+
1100
+ // src/prompt/request-options.ts
1006
1101
  function getTotalTimeoutMs(timeout) {
1007
1102
  if (timeout == null) {
1008
1103
  return void 0;
@@ -1285,7 +1380,7 @@ import {
1285
1380
  } from "@ai-sdk/provider-utils";
1286
1381
 
1287
1382
  // src/version.ts
1288
- var VERSION = true ? "7.0.0-beta.89" : "0.0.0-test";
1383
+ var VERSION = true ? "7.0.0-beta.90" : "0.0.0-test";
1289
1384
 
1290
1385
  // src/util/download/download.ts
1291
1386
  var download = async ({
@@ -1962,101 +2057,6 @@ function toJSONValue(value) {
1962
2057
  return value === void 0 ? null : value;
1963
2058
  }
1964
2059
 
1965
- // src/prompt/prepare-call-settings.ts
1966
- function prepareCallSettings({
1967
- maxOutputTokens,
1968
- temperature,
1969
- topP,
1970
- topK,
1971
- presencePenalty,
1972
- frequencyPenalty,
1973
- seed,
1974
- stopSequences,
1975
- reasoning
1976
- }) {
1977
- if (maxOutputTokens != null) {
1978
- if (!Number.isInteger(maxOutputTokens)) {
1979
- throw new InvalidArgumentError({
1980
- parameter: "maxOutputTokens",
1981
- value: maxOutputTokens,
1982
- message: "maxOutputTokens must be an integer"
1983
- });
1984
- }
1985
- if (maxOutputTokens < 1) {
1986
- throw new InvalidArgumentError({
1987
- parameter: "maxOutputTokens",
1988
- value: maxOutputTokens,
1989
- message: "maxOutputTokens must be >= 1"
1990
- });
1991
- }
1992
- }
1993
- if (temperature != null) {
1994
- if (typeof temperature !== "number") {
1995
- throw new InvalidArgumentError({
1996
- parameter: "temperature",
1997
- value: temperature,
1998
- message: "temperature must be a number"
1999
- });
2000
- }
2001
- }
2002
- if (topP != null) {
2003
- if (typeof topP !== "number") {
2004
- throw new InvalidArgumentError({
2005
- parameter: "topP",
2006
- value: topP,
2007
- message: "topP must be a number"
2008
- });
2009
- }
2010
- }
2011
- if (topK != null) {
2012
- if (typeof topK !== "number") {
2013
- throw new InvalidArgumentError({
2014
- parameter: "topK",
2015
- value: topK,
2016
- message: "topK must be a number"
2017
- });
2018
- }
2019
- }
2020
- if (presencePenalty != null) {
2021
- if (typeof presencePenalty !== "number") {
2022
- throw new InvalidArgumentError({
2023
- parameter: "presencePenalty",
2024
- value: presencePenalty,
2025
- message: "presencePenalty must be a number"
2026
- });
2027
- }
2028
- }
2029
- if (frequencyPenalty != null) {
2030
- if (typeof frequencyPenalty !== "number") {
2031
- throw new InvalidArgumentError({
2032
- parameter: "frequencyPenalty",
2033
- value: frequencyPenalty,
2034
- message: "frequencyPenalty must be a number"
2035
- });
2036
- }
2037
- }
2038
- if (seed != null) {
2039
- if (!Number.isInteger(seed)) {
2040
- throw new InvalidArgumentError({
2041
- parameter: "seed",
2042
- value: seed,
2043
- message: "seed must be an integer"
2044
- });
2045
- }
2046
- }
2047
- return {
2048
- maxOutputTokens,
2049
- temperature,
2050
- topP,
2051
- topK,
2052
- presencePenalty,
2053
- frequencyPenalty,
2054
- stopSequences,
2055
- seed,
2056
- reasoning
2057
- };
2058
- }
2059
-
2060
2060
  // src/prompt/prepare-tool-choice.ts
2061
2061
  function prepareToolChoice({
2062
2062
  toolChoice
@@ -4227,7 +4227,7 @@ async function generateText({
4227
4227
  maxRetries: maxRetriesArg,
4228
4228
  abortSignal: mergedAbortSignal
4229
4229
  });
4230
- const callSettings = prepareCallSettings(settings);
4230
+ const callSettings = prepareLanguageModelCallOptions(settings);
4231
4231
  const headersWithUserAgent = withUserAgentSuffix2(
4232
4232
  headers != null ? headers : {},
4233
4233
  `ai/${VERSION}`
@@ -4360,7 +4360,7 @@ async function generateText({
4360
4360
  content: toolContent
4361
4361
  });
4362
4362
  }
4363
- const callSettings2 = prepareCallSettings(settings);
4363
+ const callSettings2 = prepareLanguageModelCallOptions(settings);
4364
4364
  let currentModelResponse;
4365
4365
  let clientToolCalls = [];
4366
4366
  let clientToolOutputs = [];
@@ -7080,7 +7080,7 @@ var DefaultStreamTextResult = class {
7080
7080
  maxRetries: maxRetriesArg,
7081
7081
  abortSignal
7082
7082
  });
7083
- const callSettings = prepareCallSettings(settings);
7083
+ const callSettings = prepareLanguageModelCallOptions(settings);
7084
7084
  const self = this;
7085
7085
  const callId = generateCallId();
7086
7086
  const callbackTelemetryProps = {
@@ -10328,7 +10328,7 @@ async function generateObject(options) {
10328
10328
  schema: inputSchema,
10329
10329
  enumValues
10330
10330
  });
10331
- const callSettings = prepareCallSettings(settings);
10331
+ const callSettings = prepareLanguageModelCallOptions(settings);
10332
10332
  const headersWithUserAgent = withUserAgentSuffix6(
10333
10333
  headers != null ? headers : {},
10334
10334
  `ai/${VERSION}`
@@ -10405,7 +10405,7 @@ async function generateObject(options) {
10405
10405
  name: schemaName,
10406
10406
  description: schemaDescription
10407
10407
  },
10408
- ...prepareCallSettings(settings),
10408
+ ...prepareLanguageModelCallOptions(settings),
10409
10409
  prompt: promptMessages,
10410
10410
  providerOptions,
10411
10411
  abortSignal,
@@ -10778,7 +10778,7 @@ var DefaultStreamObjectResult = class {
10778
10778
  maxRetries: maxRetriesArg,
10779
10779
  abortSignal
10780
10780
  });
10781
- const callSettings = prepareCallSettings(settings);
10781
+ const callSettings = prepareLanguageModelCallOptions(settings);
10782
10782
  const unifiedTelemetry = createUnifiedTelemetry({
10783
10783
  integrations: telemetry == null ? void 0 : telemetry.integrations
10784
10784
  });
@@ -10840,7 +10840,7 @@ var DefaultStreamObjectResult = class {
10840
10840
  name: schemaName,
10841
10841
  description: schemaDescription
10842
10842
  },
10843
- ...prepareCallSettings(settings),
10843
+ ...prepareLanguageModelCallOptions(settings),
10844
10844
  prompt: await convertToLanguageModelPrompt({
10845
10845
  prompt: standardizedPrompt,
10846
10846
  supportedUrls: await model.supportedUrls,
@@ -13880,10 +13880,14 @@ export {
13880
13880
  generateImage,
13881
13881
  generateObject,
13882
13882
  generateText,
13883
+ getChunkTimeoutMs,
13883
13884
  getStaticToolName,
13885
+ getStepTimeoutMs,
13884
13886
  getTextFromDataUrl,
13885
13887
  getToolName,
13886
13888
  getToolOrDynamicToolName,
13889
+ getToolTimeoutMs,
13890
+ getTotalTimeoutMs,
13887
13891
  hasToolCall,
13888
13892
  isCustomContentUIPart,
13889
13893
  isDataUIPart,