StreamEvent

sealed interface StreamEvent

Public stream event surfaced by com.mojentic.llm.Broker.LlmBroker.stream.

Cold Flow<StreamEvent> returned by the broker emits these in arrival order. The broker handles tool execution internally; a tool round-trip surfaces to callers as a ToolCall / ToolResult pair followed by further TextChunks from the recursive completion.

Inheritors

Types

Link copied to clipboard
data class TextChunk(val text: String) : StreamEvent

A chunk of assistant text content as it arrives.

Link copied to clipboard
data class ThinkingChunk(val text: String) : StreamEvent

A chunk of reasoning / thinking trace, when the provider streams it.

Link copied to clipboard
data class ToolCall(val call: LlmToolCall) : StreamEvent

A tool call the broker is about to dispatch.

Link copied to clipboard
data class ToolResult(val call: LlmToolCall, val result: String, val isError: Boolean) : StreamEvent

The serialised result of a tool call the broker dispatched.