# `Omni.Message`
[🔗](https://github.com/aaronrussell/omni/blob/v1.2.1/lib/omni/message.ex#L1)

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.

# `content`

```elixir
@type content() ::
  Omni.Content.Text.t()
  | Omni.Content.Thinking.t()
  | Omni.Content.Attachment.t()
  | Omni.Content.ToolUse.t()
  | Omni.Content.ToolResult.t()
```

Any content block that can appear in a message.

# `t`

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

A conversation message.

# `new`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
