Turns streamed tool-call fragments into complete LlmCall.ToolCall values.
Pure and protocol-neutral: it never executes a tool and never sends a result.
Pending calls are keyed by LlmCall.StreamEvent.index, so several calls can
complete independently and out of order.
The core has no JSON decoder, so new/1 takes one:
assembler = LlmCall.StreamAssembler.new(json_decoder: &JSON.decode/1)Without a decoder, a call still arrives with its raw_arguments and an
arguments_error of :no_json_decoder; it never arrives with invented
arguments. The decoder's own message becomes the reason of
{:invalid_json, reason}.
Fragments are accumulated across events, so LlmCall.SSE's single-frame cap
cannot bound them. new/1 takes max_argument_bytes (8 MiB by default); past it
the call finalises with {:too_large, bytes} and raw_arguments holding the
prefix that fit.
Summary
Types
Functions
@spec feed(t(), LlmCall.StreamEvent.t()) :: {:ok, t(), [LlmCall.ToolCall.t()]}
@spec finish(t()) :: {:ok, t(), [LlmCall.ToolCall.t()]}