# `LlmCall.StreamAssembler`
[🔗](https://github.com/gilbertwong96/llm_call/blob/main/lib/llm_call/stream_assembler.ex#L1)

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}`.

# `decoder`

```elixir
@type decoder() :: (String.t() -&gt; {:ok, map()} | {:error, String.t()}) | nil
```

# `t`

```elixir
@opaque t()
```

# `feed`

```elixir
@spec feed(t(), LlmCall.StreamEvent.t()) :: {:ok, t(), [LlmCall.ToolCall.t()]}
```

# `finish`

```elixir
@spec finish(t()) :: {:ok, t(), [LlmCall.ToolCall.t()]}
```

# `new`

```elixir
@spec new(keyword()) :: t()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
