ALLM.StepResult (allm v0.3.1)

Copy Markdown View Source

The result of a single chat step — Layer A 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 — legal Elixir, and round-trips cleanly through :erlang.term_to_binary/1 and tagged JSON encoding via ALLM.Serializer.

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
[]