PhoenixAI.Store.Conversation (PhoenixAI.Store v0.1.0)

Copy Markdown View Source

A conversation owned by PhoenixAI.Store, extending PhoenixAI.Conversation with persistence-specific fields such as user_id, title, tags, model, timestamps, and soft-delete support.

Summary

Functions

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

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

Types

t()

@type t() :: %PhoenixAI.Store.Conversation{
  deleted_at: DateTime.t() | nil,
  id: String.t() | nil,
  inserted_at: DateTime.t() | nil,
  messages: [PhoenixAI.Store.Message.t()],
  metadata: map(),
  model: String.t() | nil,
  tags: [String.t()],
  title: String.t() | nil,
  updated_at: DateTime.t() | nil,
  user_id: String.t() | nil
}

Functions

from_phoenix_ai(conv, opts \\ [])

@spec from_phoenix_ai(
  PhoenixAI.Conversation.t(),
  keyword()
) :: t()

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

Accepts an optional keyword list to populate store-specific fields:

  • :user_id - the owning user's ID
  • :title - conversation title
  • :tags - list of string tags (defaults to [])
  • :model - the AI model identifier

Messages are converted via PhoenixAI.Store.Message.from_phoenix_ai/1.

to_phoenix_ai(conv)

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

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

Messages are converted via PhoenixAI.Store.Message.to_phoenix_ai/1. Store-specific fields (user_id, title, tags, model, timestamps) are dropped.