PhoenixAI.Store.Message (PhoenixAI.Store v0.1.0)

Copy Markdown View Source

A message within a conversation, wrapping PhoenixAI.Message with persistence-specific fields such as id, conversation_id, token_count, and inserted_at.

Summary

Functions

Converts a %PhoenixAI.Message{} to a %PhoenixAI.Store.Message{}.

Converts a %PhoenixAI.Store.Message{} to a %PhoenixAI.Message{}.

Types

t()

@type t() :: %PhoenixAI.Store.Message{
  content: String.t() | nil,
  conversation_id: String.t() | nil,
  id: String.t() | nil,
  inserted_at: DateTime.t() | nil,
  metadata: map(),
  pinned: boolean(),
  role: :system | :user | :assistant | :tool | nil,
  token_count: non_neg_integer() | nil,
  tool_call_id: String.t() | nil,
  tool_calls: [map()] | nil
}

Functions

from_phoenix_ai(msg)

@spec from_phoenix_ai(PhoenixAI.Message.t()) :: t()

Converts a %PhoenixAI.Message{} to a %PhoenixAI.Store.Message{}.

Store-specific fields (id, conversation_id, token_count, inserted_at) are left as nil and should be populated by the adapter on persistence.

to_phoenix_ai(msg)

@spec to_phoenix_ai(t()) :: PhoenixAI.Message.t()

Converts a %PhoenixAI.Store.Message{} to a %PhoenixAI.Message{}.

Only maps fields that exist on the core struct: role, content, tool_call_id, tool_calls, and metadata.