StreamFrameFlowBuilder

Represents a wrapper around a FlowCollector that provides methods for emitting StreamFrame objects.

This is mainly used for combining chunked tool calls and only emit completed tool calls.

Constructors

Link copied to clipboard
constructor(flowCollector: FlowCollector<StreamFrame>)

Functions

Link copied to clipboard
suspend fun emitAppend(text: String)

Emits a StreamFrame.Append with the given text.

Link copied to clipboard
suspend fun emitEnd(finishReason: String? = null, metaInfo: ResponseMetaInfo? = null)

Emits a StreamFrame.End with the given finishReason.

Link copied to clipboard

Emits a pendingToolCallRef if it exists and then clears it.

Link copied to clipboard
suspend fun upsertToolCall(index: Int, id: String? = null, name: String? = null, args: String? = null)

Updates the coroutine context to signal we're currently combining a tool call, this does not emit anything yet, that happens only in tryEmitPendingToolCall.