The language model to use.
Optionaltools?: TOOLSOptional_internal?: { generateCallId?: IdGenerator; generateId?: IdGenerator; now?: () => number }Internal. For test use only. May change without notice.
OptionalactiveTools?: readonly (NoInfer<keyof TOOLS> & string)[]Limits the tools that are available for the model to call without changing the tool call and result types in the result.
Optionalexperimental_download?: DownloadFunctionCustom download function to use for URLs.
By default, files are downloaded if the model does not support the URL for the given media type.
Optionalexperimental_include?: GenerateTextIncludeSettings for controlling what data is included in step results.
Optionalexperimental_onLanguageModelCallEnd?: OnLanguageModelCallEndCallback<NoInfer<TOOLS>>Callback that is called after the model response has been normalized and parsed, but before any client-side tool execution begins.
Optionalexperimental_onLanguageModelCallStart?: OnLanguageModelCallStartCallbackCallback that is called immediately before the provider model call begins.
Optionalexperimental_onStart?: GenerateTextOnStartCallback<Callback that is called when the generateText operation begins, before any LLM calls are made.
Optionalexperimental_onStepStart?: GenerateTextOnStepStartCallback<Callback that is called when a step (LLM call) begins, before the provider is called.
Optionalexperimental_onToolCallFinish?: OnToolExecutionEndCallback<NoInfer<TOOLS>>Callback that is called right after a tool's execute function completes (or errors).
Optionalexperimental_onToolCallStart?: OnToolExecutionStartCallback<NoInfer<TOOLS>>Callback that is called right before a tool's execute function runs.
Optionalexperimental_refineToolInput?: ToolInputRefinement<NoInfer<TOOLS>>Optional mapping of tool names to functions that refine parsed tool inputs.
The refined input must have the same type shape as the tool input. Refined inputs are used for tool execution, outputs, callbacks, and telemetry.
Optionalexperimental_repairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>A function that attempts to repair a tool call that failed to parse.
Optionalexperimental_sandbox?: SandboxSessionThe sandbox environment that is passed through to tool execution.
Optionalexperimental_telemetry?: TelemetryOptions<RUNTIME_CONTEXT, NoInfer<TOOLS>>Optional telemetry configuration.
Optionalexperimental_toolApprovalSecret?: string | Uint8Array<ArrayBufferLike>Secret for HMAC-signing tool approval requests. When set, the server signs each approval request at issuance and verifies the signature when the approval is replayed, preventing client-forged approvals.
Optionalexperimental_toolCallers?: Experimental_ToolCallers<NoInfer<TOOLS>>Configures which caller tools may invoke each tool.
Optionalinclude?: GenerateTextIncludeSettings for controlling what data is included in step results. Disabling inclusion can help reduce memory usage when processing large payloads like images.
By default, request bodies, request messages, and response bodies are excluded.
The language model to use.
OptionalonEnd?: GenerateTextOnEndCallback<NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>>Callback that is called when all steps are finished and the response is complete.
OptionalonFinish?: GenerateTextOnEndCallback<NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>>Callback that is called when all steps are finished and the response is complete.
OptionalonLanguageModelCallEnd?: OnLanguageModelCallEndCallback<NoInfer<TOOLS>>Callback that is called after the model response has been normalized and parsed, but before any client-side tool execution begins.
OptionalonLanguageModelCallStart?: OnLanguageModelCallStartCallbackCallback that is called immediately before the provider model call begins.
OptionalonStart?: GenerateTextOnStartCallback<Callback that is called when the generateText operation begins, before any LLM calls are made.
OptionalonStepEnd?: GenerateTextOnStepEndCallback<NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>>Callback that is called when each step (LLM call) ends, including intermediate steps.
OptionalonStepFinish?: GenerateTextOnStepFinishCallback<NoInfer<TOOLS>, NoInfer<RUNTIME_CONTEXT>>Callback that is called when each step (LLM call) ends, including intermediate steps.
OptionalonStepStart?: GenerateTextOnStepStartCallback<Callback that is called when a step (LLM call) begins, before the provider is called.
OptionalonToolExecutionEnd?: OnToolExecutionEndCallback<NoInfer<TOOLS>>Callback that is called right after a tool's execute function completes (or errors).
OptionalonToolExecutionStart?: OnToolExecutionStartCallback<NoInfer<TOOLS>>Callback that is called right before a tool's execute function runs.
Optionaloutput?: OUTPUTOptional specification for parsing structured outputs from the LLM response.
OptionalprepareStep?: PrepareStepFunction<NoInfer<TOOLS>, RUNTIME_CONTEXT>Optional function that you can use to provide different settings for a step.
OptionalproviderOptions?: ProviderOptionsAdditional provider-specific options. They are passed through to the provider from the AI SDK and enable provider-specific functionality that can be fully encapsulated in the provider.
OptionalrepairToolCall?: ToolCallRepairFunction<NoInfer<TOOLS>>A function that attempts to repair a tool call that failed to parse.
OptionalruntimeContext?: RUNTIME_CONTEXTRuntime context. Treat runtime context as immutable.
If you need to mutate runtime context, update it in prepareStep.
OptionalstopWhen?: Arrayable<StopCondition<NoInfer<TOOLS>, RUNTIME_CONTEXT>>Condition for stopping the generation when there are tool results in the last step. When the condition is an array, any of the conditions can be met to stop the generation.
Optionaltelemetry?: TelemetryOptions<RUNTIME_CONTEXT, NoInfer<TOOLS>>Optional telemetry configuration.
OptionaltoolApproval?: ToolApprovalConfiguration<TOOLS, RUNTIME_CONTEXT>Optional tool approval configuration.
This configuration takes precedence over tool-defined approval settings.
OptionaltoolChoice?: ToolChoice<NoInfer<TOOLS>>The tool choice strategy. Default: 'auto'.
OptionaltoolOrder?: readonly (NoInfer<keyof TOOLS> & string)[]Controls the order in which tools are sent to the provider.
The list can be partial. Tools not listed in toolOrder are sent after
the listed tools, sorted alphabetically. This can improve provider-side
caching by keeping tool definitions in a stable order.
A result object that contains the generated text, the results of the tool calls, and additional information.
Generate a text and call tools for a given prompt using a language model.
This function does not stream the output. If you want to stream the output, use
streamTextinstead.