chatStreamWithTools

abstract fun chatStreamWithTools(request: ChatRequest, autoExecute: Boolean = true, maxSteps: Int? = null, currentStep: Int = 0, onFullToolCollected: ToolCapable.ToolCallCallback = null, onToolCall: ToolCapable.ToolCallCallback = null, onToolExecutionFailed: ToolCapable.ToolExecutionFailedCallback = null): Flow<ChatChunk>

Streams a chat with automatic tool execution.

Tool call deltas are accumulated across chunks. Once a complete tool call is collected, onFullToolCollected is invoked. If autoExecute is true, the tool is executed and the conversation continues with a new stream.

Return

A Flow of ChatChunk streaming responses.

Parameters

request

The chat request with tools attached.

autoExecute

Whether to automatically execute tool calls (default: true).

onFullToolCollected

Callback invoked when a complete tool call is accumulated.

onToolCall

Callback invoked before each tool execution.


abstract fun chatStreamWithTools(autoExecute: Boolean = true, maxSteps: Int? = null, currentStep: Int = 0, onFullToolCollected: ToolCapable.ToolCallCallback = null, onToolCall: ToolCapable.ToolCallCallback = null, onToolExecutionFailed: ToolCapable.ToolExecutionFailedCallback = null, block: ChatRequestBuilder.() -> Unit): Flow<ChatChunk>

Streams a chat with tools using full DSL configuration.

Return

A Flow of ChatChunk streaming responses.

Parameters

autoExecute

Whether to automatically execute tool calls (default: true).

onFullToolCollected

Callback invoked when a complete tool call is accumulated.

onToolCall

Callback invoked before each tool execution.

block

A ChatRequestBuilder lambda for configuring the request.