# `Jido.Chat.StreamChunk`
[🔗](https://github.com/agentjido/jido_chat/blob/v1.0.0/lib/jido/chat/stream_chunk.ex#L1)

Typed stream input chunk used by outbound stream payloads.

# `input`

```elixir
@type input() :: t() | String.t() | map()
```

# `t`

```elixir
@type t() :: %Jido.Chat.StreamChunk{
  kind:
    :text | :markdown | :status | :plan | :data | :step_start | :step_finish,
  metadata: map(),
  payload: nil | nil | any(),
  text: nil | nil | binary()
}
```

# `fallback_text`

```elixir
@spec fallback_text(t() | String.t()) :: String.t()
```

Returns the best text fallback for the chunk.

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Builds a stream chunk from serialized map data.

# `new`

Creates a stream chunk from normalized map input.

# `normalize`

```elixir
@spec normalize(input()) :: t() | String.t()
```

Normalizes supported stream chunk inputs.

# `normalize_many`

```elixir
@spec normalize_many([input()]) :: [t() | String.t()]
```

Normalizes a list of stream chunk inputs.

# `schema`

Returns the Zoi schema for StreamChunk.

# `text`

```elixir
@spec text(String.t(), keyword() | map()) :: t()
```

Builds a text chunk.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Serializes a stream chunk into a plain map with type marker.

---

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