Puck.Eval.Step (Puck v0.2.11)

Copy Markdown View Source

Represents a single LLM call within a trajectory.

Each step captures the input, output, token usage, timing, and metadata from a Puck.call/4 invocation.

Fields

  • :input - The content sent to the LLM
  • :output - The parsed struct (if output_schema was used) or raw content
  • :tokens - Token usage map with :input, :output, and :total keys
  • :duration_ms - Time taken for this call in milliseconds
  • :metadata - Additional metadata from Puck.Response.metadata

Example

%Step{
  input: "Find John's email",
  output: %LookupContact{name: "John"},
  tokens: %{input: 150, output: 30, total: 180},
  duration_ms: 450,
  metadata: %{model: "claude-sonnet-4-5-20250514"}
}

Summary

Functions

Creates a new Step struct.

Types

t()

@type t() :: %Puck.Eval.Step{
  duration_ms: non_neg_integer(),
  input: term(),
  metadata: map(),
  output: term(),
  tokens: %{
    input: non_neg_integer(),
    output: non_neg_integer(),
    total: non_neg_integer()
  }
}

Functions

new(opts)

Creates a new Step struct.

Options

  • :input - The content sent to the LLM (required)
  • :output - The response content (required)
  • :tokens - Token usage map (default: %{input: 0, output: 0, total: 0})
  • :duration_ms - Call duration in milliseconds (default: 0)
  • :metadata - Additional metadata (default: %{})