ai 5.0.0-alpha.3 → 5.0.0-alpha.4
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 +17 -0
- package/dist/index.d.mts +64 -12
- package/dist/index.d.ts +64 -12
- package/dist/index.js +71 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# ai
|
2
2
|
|
3
|
+
## 5.0.0-alpha.4
|
4
|
+
|
5
|
+
### Major Changes
|
6
|
+
|
7
|
+
- 72d7d72: chore (ai): stable activeTools
|
8
|
+
- 9315076: chore (ai): rename continueUntil to stopWhen. Rename maxSteps stop condition to stepCountIs.
|
9
|
+
|
10
|
+
### Patch Changes
|
11
|
+
|
12
|
+
- b32c141: feat (ai): add array support to stopWhen
|
13
|
+
- 7d97ab6: release alpha.4
|
14
|
+
- 37a916d: feat (ai): add prepareSteps to streamText
|
15
|
+
- 5f2b3d4: chore (ai): stable prepareStep
|
16
|
+
- Updated dependencies [dc714f3]
|
17
|
+
- @ai-sdk/provider@2.0.0-alpha.4
|
18
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.4
|
19
|
+
|
3
20
|
## 5.0.0-alpha.3
|
4
21
|
|
5
22
|
### Major Changes
|
package/dist/index.d.mts
CHANGED
@@ -2696,7 +2696,7 @@ declare namespace output {
|
|
2696
2696
|
type StopCondition<TOOLS extends ToolSet> = (options: {
|
2697
2697
|
steps: Array<StepResult<TOOLS>>;
|
2698
2698
|
}) => PromiseLike<boolean> | boolean;
|
2699
|
-
declare function
|
2699
|
+
declare function stepCountIs(stepCount: number): StopCondition<any>;
|
2700
2700
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
2701
2701
|
|
2702
2702
|
/**
|
@@ -2751,7 +2751,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2751
2751
|
@returns
|
2752
2752
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
2753
2753
|
*/
|
2754
|
-
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers,
|
2754
|
+
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
2755
2755
|
/**
|
2756
2756
|
The language model to use.
|
2757
2757
|
*/
|
@@ -2764,7 +2764,13 @@ The tools that the model can call. The model needs to support calling tools.
|
|
2764
2764
|
The tool choice strategy. Default: 'auto'.
|
2765
2765
|
*/
|
2766
2766
|
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2767
|
-
|
2767
|
+
/**
|
2768
|
+
Condition for stopping the generation when there are tool results in the last step.
|
2769
|
+
When the condition is an array, any of the conditions can be met to stop the generation.
|
2770
|
+
|
2771
|
+
@default stepCountIs(1)
|
2772
|
+
*/
|
2773
|
+
stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
|
2768
2774
|
/**
|
2769
2775
|
Optional telemetry configuration (experimental).
|
2770
2776
|
*/
|
@@ -2776,15 +2782,31 @@ functionality that can be fully encapsulated in the provider.
|
|
2776
2782
|
*/
|
2777
2783
|
providerOptions?: ProviderOptions;
|
2778
2784
|
/**
|
2785
|
+
* @deprecated Use `activeTools` instead.
|
2786
|
+
*/
|
2787
|
+
experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2788
|
+
/**
|
2779
2789
|
Limits the tools that are available for the model to call without
|
2780
2790
|
changing the tool call and result types in the result.
|
2781
2791
|
*/
|
2782
|
-
|
2792
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2783
2793
|
/**
|
2784
2794
|
Optional specification for parsing structured outputs from the LLM response.
|
2785
2795
|
*/
|
2786
2796
|
experimental_output?: Output$1<OUTPUT, OUTPUT_PARTIAL>;
|
2787
2797
|
/**
|
2798
|
+
* @deprecated Use `prepareStep` instead.
|
2799
|
+
*/
|
2800
|
+
experimental_prepareStep?: (options: {
|
2801
|
+
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
2802
|
+
stepNumber: number;
|
2803
|
+
model: LanguageModel;
|
2804
|
+
}) => PromiseLike<{
|
2805
|
+
model?: LanguageModel;
|
2806
|
+
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2807
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2808
|
+
} | undefined>;
|
2809
|
+
/**
|
2788
2810
|
Optional function that you can use to provide different settings for a step.
|
2789
2811
|
|
2790
2812
|
@param options - The options for the step.
|
@@ -2795,14 +2817,14 @@ Optional function that you can use to provide different settings for a step.
|
|
2795
2817
|
@returns An object that contains the settings for the step.
|
2796
2818
|
If you return undefined (or for undefined settings), the settings from the outer level will be used.
|
2797
2819
|
*/
|
2798
|
-
|
2820
|
+
prepareStep?: (options: {
|
2799
2821
|
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
2800
2822
|
stepNumber: number;
|
2801
2823
|
model: LanguageModel;
|
2802
2824
|
}) => PromiseLike<{
|
2803
2825
|
model?: LanguageModel;
|
2804
2826
|
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2805
|
-
|
2827
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2806
2828
|
} | undefined>;
|
2807
2829
|
/**
|
2808
2830
|
A function that attempts to repair a tool call that failed to parse.
|
@@ -3241,7 +3263,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
3241
3263
|
@return
|
3242
3264
|
A result object for accessing different stream types and additional information.
|
3243
3265
|
*/
|
3244
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers,
|
3266
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
3245
3267
|
/**
|
3246
3268
|
The language model to use.
|
3247
3269
|
*/
|
@@ -3254,7 +3276,13 @@ The tools that the model can call. The model needs to support calling tools.
|
|
3254
3276
|
The tool choice strategy. Default: 'auto'.
|
3255
3277
|
*/
|
3256
3278
|
toolChoice?: ToolChoice<TOOLS>;
|
3257
|
-
|
3279
|
+
/**
|
3280
|
+
Condition for stopping the generation when there are tool results in the last step.
|
3281
|
+
When the condition is an array, any of the conditions can be met to stop the generation.
|
3282
|
+
|
3283
|
+
@default stepCountIs(1)
|
3284
|
+
*/
|
3285
|
+
stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
|
3258
3286
|
/**
|
3259
3287
|
Optional telemetry configuration (experimental).
|
3260
3288
|
*/
|
@@ -3266,15 +3294,39 @@ functionality that can be fully encapsulated in the provider.
|
|
3266
3294
|
*/
|
3267
3295
|
providerOptions?: ProviderOptions;
|
3268
3296
|
/**
|
3269
|
-
|
3270
|
-
changing the tool call and result types in the result.
|
3297
|
+
* @deprecated Use `activeTools` instead.
|
3271
3298
|
*/
|
3272
|
-
experimental_activeTools?: Array<keyof TOOLS
|
3299
|
+
experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
|
3300
|
+
/**
|
3301
|
+
Limits the tools that are available for the model to call without
|
3302
|
+
changing the tool call and result types in the result.
|
3303
|
+
*/
|
3304
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
3273
3305
|
/**
|
3274
3306
|
Optional specification for parsing structured outputs from the LLM response.
|
3275
3307
|
*/
|
3276
3308
|
experimental_output?: Output$1<OUTPUT, PARTIAL_OUTPUT>;
|
3277
3309
|
/**
|
3310
|
+
Optional function that you can use to provide different settings for a step.
|
3311
|
+
|
3312
|
+
@param options - The options for the step.
|
3313
|
+
@param options.steps - The steps that have been executed so far.
|
3314
|
+
@param options.stepNumber - The number of the step that is being executed.
|
3315
|
+
@param options.model - The model that is being used.
|
3316
|
+
|
3317
|
+
@returns An object that contains the settings for the step.
|
3318
|
+
If you return undefined (or for undefined settings), the settings from the outer level will be used.
|
3319
|
+
*/
|
3320
|
+
prepareStep?: (options: {
|
3321
|
+
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
3322
|
+
stepNumber: number;
|
3323
|
+
model: LanguageModel;
|
3324
|
+
}) => PromiseLike<{
|
3325
|
+
model?: LanguageModel;
|
3326
|
+
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
3327
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
3328
|
+
} | undefined>;
|
3329
|
+
/**
|
3278
3330
|
A function that attempts to repair a tool call that failed to parse.
|
3279
3331
|
*/
|
3280
3332
|
experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
|
@@ -4992,4 +5044,4 @@ type UseCompletionOptions = {
|
|
4992
5044
|
fetch?: FetchFunction;
|
4993
5045
|
};
|
4994
5046
|
|
4995
|
-
export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData,
|
5047
|
+
export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
|
package/dist/index.d.ts
CHANGED
@@ -2696,7 +2696,7 @@ declare namespace output {
|
|
2696
2696
|
type StopCondition<TOOLS extends ToolSet> = (options: {
|
2697
2697
|
steps: Array<StepResult<TOOLS>>;
|
2698
2698
|
}) => PromiseLike<boolean> | boolean;
|
2699
|
-
declare function
|
2699
|
+
declare function stepCountIs(stepCount: number): StopCondition<any>;
|
2700
2700
|
declare function hasToolCall(toolName: string): StopCondition<any>;
|
2701
2701
|
|
2702
2702
|
/**
|
@@ -2751,7 +2751,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
2751
2751
|
@returns
|
2752
2752
|
A result object that contains the generated text, the results of the tool calls, and additional information.
|
2753
2753
|
*/
|
2754
|
-
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers,
|
2754
|
+
declare function generateText<TOOLS extends ToolSet, OUTPUT = never, OUTPUT_PARTIAL = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries: maxRetriesArg, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, providerOptions, experimental_activeTools, activeTools, experimental_prepareStep, prepareStep, experimental_repairToolCall: repairToolCall, _internal: { generateId, currentDate, }, onStepFinish, ...settings }: CallSettings & Prompt & {
|
2755
2755
|
/**
|
2756
2756
|
The language model to use.
|
2757
2757
|
*/
|
@@ -2764,7 +2764,13 @@ The tools that the model can call. The model needs to support calling tools.
|
|
2764
2764
|
The tool choice strategy. Default: 'auto'.
|
2765
2765
|
*/
|
2766
2766
|
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2767
|
-
|
2767
|
+
/**
|
2768
|
+
Condition for stopping the generation when there are tool results in the last step.
|
2769
|
+
When the condition is an array, any of the conditions can be met to stop the generation.
|
2770
|
+
|
2771
|
+
@default stepCountIs(1)
|
2772
|
+
*/
|
2773
|
+
stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
|
2768
2774
|
/**
|
2769
2775
|
Optional telemetry configuration (experimental).
|
2770
2776
|
*/
|
@@ -2776,15 +2782,31 @@ functionality that can be fully encapsulated in the provider.
|
|
2776
2782
|
*/
|
2777
2783
|
providerOptions?: ProviderOptions;
|
2778
2784
|
/**
|
2785
|
+
* @deprecated Use `activeTools` instead.
|
2786
|
+
*/
|
2787
|
+
experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2788
|
+
/**
|
2779
2789
|
Limits the tools that are available for the model to call without
|
2780
2790
|
changing the tool call and result types in the result.
|
2781
2791
|
*/
|
2782
|
-
|
2792
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2783
2793
|
/**
|
2784
2794
|
Optional specification for parsing structured outputs from the LLM response.
|
2785
2795
|
*/
|
2786
2796
|
experimental_output?: Output$1<OUTPUT, OUTPUT_PARTIAL>;
|
2787
2797
|
/**
|
2798
|
+
* @deprecated Use `prepareStep` instead.
|
2799
|
+
*/
|
2800
|
+
experimental_prepareStep?: (options: {
|
2801
|
+
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
2802
|
+
stepNumber: number;
|
2803
|
+
model: LanguageModel;
|
2804
|
+
}) => PromiseLike<{
|
2805
|
+
model?: LanguageModel;
|
2806
|
+
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2807
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2808
|
+
} | undefined>;
|
2809
|
+
/**
|
2788
2810
|
Optional function that you can use to provide different settings for a step.
|
2789
2811
|
|
2790
2812
|
@param options - The options for the step.
|
@@ -2795,14 +2817,14 @@ Optional function that you can use to provide different settings for a step.
|
|
2795
2817
|
@returns An object that contains the settings for the step.
|
2796
2818
|
If you return undefined (or for undefined settings), the settings from the outer level will be used.
|
2797
2819
|
*/
|
2798
|
-
|
2820
|
+
prepareStep?: (options: {
|
2799
2821
|
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
2800
2822
|
stepNumber: number;
|
2801
2823
|
model: LanguageModel;
|
2802
2824
|
}) => PromiseLike<{
|
2803
2825
|
model?: LanguageModel;
|
2804
2826
|
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
2805
|
-
|
2827
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
2806
2828
|
} | undefined>;
|
2807
2829
|
/**
|
2808
2830
|
A function that attempts to repair a tool call that failed to parse.
|
@@ -3241,7 +3263,7 @@ If set and supported by the model, calls will generate deterministic results.
|
|
3241
3263
|
@return
|
3242
3264
|
A result object for accessing different stream types and additional information.
|
3243
3265
|
*/
|
3244
|
-
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers,
|
3266
|
+
declare function streamText<TOOLS extends ToolSet, OUTPUT = never, PARTIAL_OUTPUT = never>({ model, tools, toolChoice, system, prompt, messages, maxRetries, abortSignal, headers, stopWhen, experimental_output: output, experimental_telemetry: telemetry, prepareStep, providerOptions, experimental_toolCallStreaming, toolCallStreaming, experimental_activeTools, activeTools, experimental_repairToolCall: repairToolCall, experimental_transform: transform, onChunk, onError, onFinish, onStepFinish, _internal: { now, generateId, currentDate, }, ...settings }: CallSettings & Prompt & {
|
3245
3267
|
/**
|
3246
3268
|
The language model to use.
|
3247
3269
|
*/
|
@@ -3254,7 +3276,13 @@ The tools that the model can call. The model needs to support calling tools.
|
|
3254
3276
|
The tool choice strategy. Default: 'auto'.
|
3255
3277
|
*/
|
3256
3278
|
toolChoice?: ToolChoice<TOOLS>;
|
3257
|
-
|
3279
|
+
/**
|
3280
|
+
Condition for stopping the generation when there are tool results in the last step.
|
3281
|
+
When the condition is an array, any of the conditions can be met to stop the generation.
|
3282
|
+
|
3283
|
+
@default stepCountIs(1)
|
3284
|
+
*/
|
3285
|
+
stopWhen?: StopCondition<NoInfer<TOOLS>> | Array<StopCondition<NoInfer<TOOLS>>>;
|
3258
3286
|
/**
|
3259
3287
|
Optional telemetry configuration (experimental).
|
3260
3288
|
*/
|
@@ -3266,15 +3294,39 @@ functionality that can be fully encapsulated in the provider.
|
|
3266
3294
|
*/
|
3267
3295
|
providerOptions?: ProviderOptions;
|
3268
3296
|
/**
|
3269
|
-
|
3270
|
-
changing the tool call and result types in the result.
|
3297
|
+
* @deprecated Use `activeTools` instead.
|
3271
3298
|
*/
|
3272
|
-
experimental_activeTools?: Array<keyof TOOLS
|
3299
|
+
experimental_activeTools?: Array<keyof NoInfer<TOOLS>>;
|
3300
|
+
/**
|
3301
|
+
Limits the tools that are available for the model to call without
|
3302
|
+
changing the tool call and result types in the result.
|
3303
|
+
*/
|
3304
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
3273
3305
|
/**
|
3274
3306
|
Optional specification for parsing structured outputs from the LLM response.
|
3275
3307
|
*/
|
3276
3308
|
experimental_output?: Output$1<OUTPUT, PARTIAL_OUTPUT>;
|
3277
3309
|
/**
|
3310
|
+
Optional function that you can use to provide different settings for a step.
|
3311
|
+
|
3312
|
+
@param options - The options for the step.
|
3313
|
+
@param options.steps - The steps that have been executed so far.
|
3314
|
+
@param options.stepNumber - The number of the step that is being executed.
|
3315
|
+
@param options.model - The model that is being used.
|
3316
|
+
|
3317
|
+
@returns An object that contains the settings for the step.
|
3318
|
+
If you return undefined (or for undefined settings), the settings from the outer level will be used.
|
3319
|
+
*/
|
3320
|
+
prepareStep?: (options: {
|
3321
|
+
steps: Array<StepResult<NoInfer<TOOLS>>>;
|
3322
|
+
stepNumber: number;
|
3323
|
+
model: LanguageModel;
|
3324
|
+
}) => PromiseLike<{
|
3325
|
+
model?: LanguageModel;
|
3326
|
+
toolChoice?: ToolChoice<NoInfer<TOOLS>>;
|
3327
|
+
activeTools?: Array<keyof NoInfer<TOOLS>>;
|
3328
|
+
} | undefined>;
|
3329
|
+
/**
|
3278
3330
|
A function that attempts to repair a tool call that failed to parse.
|
3279
3331
|
*/
|
3280
3332
|
experimental_repairToolCall?: ToolCallRepairFunction<TOOLS>;
|
@@ -4992,4 +5044,4 @@ type UseCompletionOptions = {
|
|
4992
5044
|
fetch?: FetchFunction;
|
4993
5045
|
};
|
4994
5046
|
|
4995
|
-
export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData,
|
5047
|
+
export { AssistantContent, AssistantModelMessage, CallSettings, CallWarning, ChatRequestOptions, ChatStatus, ChatStore, ChatStoreEvent, ChatTransport, ChunkDetector, CompletionRequestOptions, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreToolMessage, CoreUserMessage, CreateUIMessage, DataContent, DataUIPart, DeepPartial, DefaultChatTransport, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingModelUsage, GenerateImageResult as Experimental_GenerateImageResult, GeneratedFile as Experimental_GeneratedImage, SpeechResult as Experimental_SpeechResult, TranscriptionResult as Experimental_TranscriptionResult, FilePart, FileUIPart, FinishReason, GenerateObjectResult, GenerateTextOnStepFinishCallback, GenerateTextResult, GeneratedAudioFile, GeneratedFile, ImageModel, ImageGenerationWarning as ImageModelCallWarning, ImageModelProviderMetadata, ImageModelResponseMetadata, ImagePart, InferUIDataParts as InferUIDataTypes, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolArgumentsError, JSONRPCError, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, MCPClientError, MCPTransport, MessageConversionError, ModelMessage, NoImageGeneratedError, NoObjectGeneratedError, NoOutputSpecifiedError, NoSuchProviderError, NoSuchToolError, ObjectStreamPart, OriginalUseChatOptions, output as Output, Prompt, Provider, ProviderMetadata, ProviderOptions, ProviderRegistryProvider, ReasoningUIPart, RepairTextFunction, RetryError, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechWarning, StepResult, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextOnFinishCallback, StreamTextOnStepFinishCallback, StreamTextResult, StreamTextTransform, SystemModelMessage, TelemetrySettings, TextPart, TextStreamChatTransport, TextStreamPart, TextUIPart, Tool, ToolCallPart, ToolCallRepairError, ToolCallRepairFunction, ToolCallUnion, ToolChoice, ToolContent, ToolExecutionError, ToolExecutionOptions, ToolInvocation, ToolInvocationUIPart, ToolModelMessage, ToolResultPart, ToolResultUnion, ToolSet, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionWarning, UIDataTypes, UIDataPartSchemas as UIDataTypesSchemas, UIMessage, UIMessagePart, UIMessageStreamOptions, UIMessageStreamPart, UIMessageStreamWriter, UseChatOptions, UseCompletionOptions, UserContent, UserModelMessage, appendClientMessage, assistantModelMessageSchema, callChatApi, callCompletionApi, convertFileListToFileUIParts, convertToCoreMessages, convertToModelMessages, coreAssistantMessageSchema, coreMessageSchema, coreSystemMessageSchema, coreToolMessageSchema, coreUserMessageSchema, cosineSimilarity, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultChatStore, defaultSettingsMiddleware, embed, embedMany, createMCPClient as experimental_createMCPClient, experimental_createProviderRegistry, experimental_customProvider, generateImage as experimental_generateImage, generateSpeech as experimental_generateSpeech, transcribe as experimental_transcribe, extractMaxToolInvocationStep, extractReasoningMiddleware, generateObject, generateText, getTextFromDataUrl, getToolInvocations, hasToolCall, isAssistantMessageWithCompletedToolCalls, isDeepEqualData, modelMessageSchema, parsePartialJson, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, shouldResubmitMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, stepCountIs, streamObject, streamText, systemModelMessageSchema, tool, toolModelMessageSchema, updateToolCallResult, userModelMessageSchema, wrapLanguageModel };
|