ALLM.StepResult (allm v0.3.0)

Copy Markdown View Source

The result of a single chat step. See spec §5.8.

Layer A — pure serializable data. Carries the updated :thread, the :response from the adapter, any :tool_results appended during this step, and a :done? flag indicating whether the chat loop should halt after this step.

The :done? field uses a ?-suffixed atom key per spec §5.8; this is legal Elixir and round-trips through both :erlang.term_to_binary/1 and (in sub-phase 1.5) tagged JSON encoding.

Summary

Functions

Build a %StepResult{} from keyword opts.

Types

t()

@type t() :: %ALLM.StepResult{
  done?: boolean(),
  metadata: map(),
  response: ALLM.Response.t(),
  thread: ALLM.Thread.t(),
  tool_results: [ALLM.Message.t()]
}

Functions

new(opts)

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

Build a %StepResult{} from keyword opts.

Every field is optional but :thread and :response are usually set in real output. Unknown keys raise ArgumentError via struct!/2.

Examples

iex> sr = ALLM.StepResult.new(done?: true)
iex> sr.done?
true
iex> sr.tool_results
[]