ExAthena.Messages (ExAthena v0.4.3)

Copy Markdown View Source

Canonical in-memory representation of a conversation.

Every provider normalises its wire format into this shape so the agent loop, tool-call parsers, and consumer code all speak the same dialect.

Summary

Functions

Build an assistant message (optionally with tool calls).

Turn a loose map/keyword into a Message. Tolerant of both string and atom keys so provider JSON and user-constructed data both work.

Build a system message.

Build a tool-result message replaying the output of a tool call.

Build a user message.

Functions

assistant(content, tool_calls \\ nil)

@spec assistant(String.t() | nil, [ExAthena.Messages.ToolCall.t()] | nil) ::
  ExAthena.Messages.Message.t()

Build an assistant message (optionally with tool calls).

from_map(m)

Turn a loose map/keyword into a Message. Tolerant of both string and atom keys so provider JSON and user-constructed data both work.

system(content)

@spec system(String.t()) :: ExAthena.Messages.Message.t()

Build a system message.

tool_result(tool_call_id, content, is_error \\ nil, ui_payload \\ nil)

Build a tool-result message replaying the output of a tool call.

user(content)

Build a user message.