ElixirLLM.Chunk (ElixirLLM v0.3.0)

Copy Markdown View Source

Represents a streaming chunk from an LLM provider.

Chunks are yielded during streaming responses and contain partial content or tool call information.

Summary

Functions

Returns true if this is the final chunk (has a finish reason).

Creates a new chunk from provider data.

Types

t()

@type t() :: %ElixirLLM.Chunk{
  content: String.t() | nil,
  finish_reason: atom() | nil,
  input_tokens: non_neg_integer() | nil,
  model: String.t() | nil,
  output_tokens: non_neg_integer() | nil,
  tool_calls: [ElixirLLM.ToolCall.t()] | nil
}

Functions

final?(chunk)

@spec final?(t()) :: boolean()

Returns true if this is the final chunk (has a finish reason).

new(attrs)

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

Creates a new chunk from provider data.