Omni.Message (Omni v1.2.1)

Copy Markdown View Source

A message in a conversation.

Messages have a :user or :assistant role and carry a list of content blocks. There is no :tool role — tool results are Content.ToolResult blocks inside user messages.

A UTC timestamp is assigned at construction unless explicitly set.

Summary

Types

Any content block that can appear in a message.

t()

A conversation message.

Functions

Creates a new message from a string, keyword list, or map.

Types

content()

Any content block that can appear in a message.

t()

@type t() :: %Omni.Message{
  content: [content()],
  private: map(),
  role: :user | :assistant,
  timestamp: DateTime.t()
}

A conversation message.

Functions

new(message)

@spec new(Enumerable.t() | String.t() | t()) :: t()

Creates a new message from a string, keyword list, or map.

A string is treated as a user message with that text as content. String content is wrapped in a Text block. A timestamp is auto-assigned via DateTime.utc_now/0 unless explicitly set.