Sycophant.Reasoning (sycophant v0.4.2)

Copy Markdown

Reasoning output from an LLM response.

When a model supports extended thinking (e.g. with the :reasoning_effort parameter), the chain-of-thought is available in response.reasoning.content as a list of Content.Thinking structs. Each thinking block may carry :text (raw chain-of-thought), :summary (condensed summary), or both, depending on the provider.

The :encrypted_content field carries an opaque blob for multi-turn reasoning continuity (Anthropic redacted_thinking, OpenAI encrypted_content).

Each entry in :content maps directly to a Content.Thinking part, and :encrypted_content maps to a Content.RedactedThinking part when building assistant messages for multi-turn conversations.

Examples

iex> alias Sycophant.Message.Content.Thinking
iex> %Sycophant.Reasoning{content: [%Thinking{text: "Let me think..."}]}
#Sycophant.Reasoning<%{content: [%{text: "Let me think..."}]}>

Summary

Functions

Deserializes reasoning output from a plain map.

Types

t()

@type t() :: %Sycophant.Reasoning{
  content: [Sycophant.Message.Content.Thinking.t()],
  encrypted_content: String.t() | nil,
  id: String.t() | nil
}

Functions

from_map(data)

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

Deserializes reasoning output from a plain map.