chatWithToolsCatching

inline suspend fun ToolCapable.chatWithToolsCatching(request: ChatRequest, autoExecute: Boolean = true, maxSteps: Int? = null, currentStep: Int = 0, noinline onToolCall: ERROR CLASS: Symbol not found for ToolCapable.ToolCallCallback = null, noinline onToolExecutionFailed: ERROR CLASS: Symbol not found for ToolCapable.ToolExecutionFailedCallback = null): Result<ChatResponse>

Sends a chat request with tool support and wraps the result in a Result.

Return

A Result with either a ChatResponse or the captured exception.

Parameters

request

A fully configured ChatRequest with tools.

autoExecute

If true, automatically executes tools and continues the conversation. Defaults to true.

maxSteps

Maximum number of tool execution steps. null means unlimited.

currentStep

Current step counter (used internally for recursion).

onToolCall

Callback invoked when a tool is called (name, argumentsJson).

onToolExecutionFailed

Callback invoked when tool execution fails.

See also


inline suspend fun ToolCapable.chatWithToolsCatching(autoExecute: Boolean = true, maxSteps: Int? = null, currentStep: Int = 0, noinline onToolCall: ERROR CLASS: Symbol not found for ToolCapable.ToolCallCallback = null, noinline onToolExecutionFailed: ERROR CLASS: Symbol not found for ToolCapable.ToolExecutionFailedCallback = null, noinline block: ChatRequestBuilder.() -> Unit): Result<ChatResponse>

Sends a chat request with tool support using the request DSL and wraps the result in a Result.

Return

A Result with either a ChatResponse or the captured exception.

Parameters

autoExecute

If true, automatically executes tools and continues the conversation. Defaults to true.

maxSteps

Maximum number of tool execution steps. null means unlimited.

currentStep

Current step counter (used internally for recursion).

onToolCall

Callback invoked when a tool is called (name, argumentsJson).

onToolExecutionFailed

Callback invoked when tool execution fails.

block

DSL builder for configuring messages, temperature, maxTokens, tools, etc.

See also