LlmCall.Content (llm_call v0.1.0)

Copy Markdown View Source

Canonical content parts.

A content part is one item of a message or response body. Tool calls and tool results are parts, not a separate message role, because providers disagree on how they are carried.

Summary

Types

part()

@type part() ::
  %LlmCall.Content.Text{text: String.t()}
  | %LlmCall.Content.Image{media_type: String.t() | nil, source: source()}
  | %LlmCall.Content.File{
      filename: String.t() | nil,
      media_type: String.t() | nil,
      source: source()
    }
  | %LlmCall.Content.Video{media_type: String.t() | nil, source: source()}
  | %LlmCall.ToolCall{
      arguments: term(),
      arguments_error: term(),
      id: term(),
      index: term(),
      name: term(),
      raw_arguments: term()
    }
  | %LlmCall.ToolResult{
      call_id: term(),
      content: term(),
      is_error: term(),
      name: term()
    }
  | %LlmCall.Content.Thinking{signature: String.t() | nil, text: String.t()}
  | %LlmCall.Content.Raw{data: map(), type: String.t() | nil}

source()

@type source() ::
  String.t()
  | {:url, String.t()}
  | {:base64, String.t()}
  | {:file_id, String.t()}