Packages

Lightweight Elixir client for LLM APIs

Current section

Files

Jump to
llm lib llm stream thinking.ex
Raw

lib/llm/stream/thinking.ex

defmodule LLM.Stream.Thinking do
@moduledoc """
A thinking/reasoning chunk from a streaming response.
Emitted by providers that support extended thinking (Anthropic, Gemini, OpenAI o-series).
Thinking chunks contain the model's internal reasoning process, separate from the
final response text.
## Fields
- `:text` — the reasoning text fragment
- `:signature` — optional cryptographic signature (Anthropic) for thinking block verification
## Example
%LLM.Stream.Thinking{text: "Let me consider the user's question...", signature: nil}
# Anthropic includes a signature for verification
%LLM.Stream.Thinking{
text: "The user is asking about...",
signature: "EqQBCgIYAhIM..."
}
"""
@type t :: %__MODULE__{
text: String.t(),
signature: String.t() | nil
}
defstruct [:text, :signature]
end