ALLM.ToolCall (allm v0.3.0)

Copy Markdown View Source

A provider-emitted tool call. See spec §5.3.

Layer A — pure serializable data. Carries the provider-assigned :id the model uses to match the eventual tool-role message back to this call, the :name of the tool to invoke, and the parsed :arguments map. The original provider JSON is preserved on :raw_arguments so adapters that need the exact wire string (streaming reassembly, audit logs) can recover it.

Summary

Functions

Build a %ToolCall{} from keyword opts.

Types

t()

@type t() :: %ALLM.ToolCall{
  arguments: map(),
  id: String.t(),
  metadata: map(),
  name: String.t(),
  raw_arguments: String.t() | nil
}

Functions

new(opts)

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

Build a %ToolCall{} from keyword opts.

:id, :name, and :arguments are required; omitting any raises ArgumentError via struct!/2. Optional fields: :raw_arguments, :metadata.

Examples

iex> ALLM.ToolCall.new(id: "call_1", name: "weather", arguments: %{"city" => "SFO"})
%ALLM.ToolCall{id: "call_1", name: "weather", arguments: %{"city" => "SFO"}, raw_arguments: nil, metadata: %{}}