LlmCall.ToolCall (llm_call v0.4.0)

Copy Markdown View Source

A call the model asked for.

raw_arguments is the lossless wire projection. When it is present, arguments is its decoded value; when decoding fails, arguments is nil and arguments_error explains why. id is nil for providers that identify a call by name only.

Summary

Types

Why arguments is nil.

t()

Types

arguments()

@type arguments() :: map() | nil

arguments_error()

@type arguments_error() ::
  nil
  | {:invalid_json, String.t()}
  | {:too_large, pos_integer()}
  | :no_json_decoder

Why arguments is nil.

raw_arguments always carries the payload itself, so this field only says what went wrong: {:invalid_json, reason} when the payload is not decodable JSON (or not an object), :no_json_decoder when LlmCall.StreamAssembler was built without a json_decoder:, and {:too_large, bytes} when the assembled fragment passed the assembler's max_argument_bytes cap — in that case raw_arguments holds only the prefix that fit.

t()

@type t() :: %LlmCall.ToolCall{
  arguments: arguments(),
  arguments_error: arguments_error(),
  id: String.t() | nil,
  index: non_neg_integer() | nil,
  name: String.t() | nil,
  raw_arguments: String.t() | nil
}