LLM.Stream.Chunk (LLM v0.1.2)

Copy Markdown View Source

A text chunk from a streaming response.

Emitted when the model generates text content. Multiple chunks arrive sequentially and their :text fields can be concatenated to form the complete response.

Fields

  • :text — the generated text fragment
  • :index — position index in the response (defaults to 0)

Example

%LLM.Stream.Chunk{text: "Hello", index: 0}
%LLM.Stream.Chunk{text: " world", index: 0}
# Concatenated: "Hello world"

Summary

Types

t()

@type t() :: %LLM.Stream.Chunk{index: non_neg_integer(), text: String.t()}