Planck.Agent.StreamBuffer (Planck.Agent v0.1.7)

Copy Markdown View Source

Accumulates the output of a single LLM stream turn.

Text deltas, thinking deltas, and tool call completions are appended as the stream arrives. At stream end the buffer is consumed to build the assistant message and hand off tool calls for execution.

Summary

Functions

Add a completed tool call.

Append a text delta.

Append a thinking delta.

Return an empty buffer.

Types

t()

@type t() :: %Planck.Agent.StreamBuffer{
  calls: [map()],
  text: String.t(),
  thinking: String.t()
}
  • :text — accumulated text content from :text_delta events
  • :thinking — accumulated thinking content from :thinking_delta events
  • :calls — completed tool calls from :tool_call_complete events, in order

Functions

add_call(stream_buffer, call)

@spec add_call(t(), map()) :: t()

Add a completed tool call.

append_text(stream_buffer, text)

@spec append_text(t(), String.t()) :: t()

Append a text delta.

append_thinking(stream_buffer, text)

@spec append_thinking(t(), String.t()) :: t()

Append a thinking delta.

new()

@spec new() :: t()

Return an empty buffer.