LLM.Message (LLM v0.1.0)

Copy Markdown View Source

Normalized message format across all providers.

Summary

Functions

Create a message from a string (user message by default), or from a keyword list / map of attributes.

Create a message with explicit role and string content.

Types

content_part()

@type content_part() ::
  {:text, String.t()}
  | {:tool_use, id :: String.t(), name :: String.t(), arguments :: map()}
  | {:tool_result, id :: String.t(), content :: term()}
  | {:thinking, String.t()}

t()

@type t() :: %LLM.Message{
  content: [content_part()] | String.t() | nil,
  name: String.t() | nil,
  role: :system | :user | :assistant | :tool
}

Functions

new(text)

Create a message from a string (user message by default), or from a keyword list / map of attributes.

new(role, content)

Create a message with explicit role and string content.