# `PhoenixAI.Store.Adapter`
[🔗](https://github.com/franciscpd/phoenix-ai-store/blob/v0.1.0/lib/phoenix_ai/store/adapter.ex#L1)

Behaviour for storage backends.

The base behaviour defines conversation and message callbacks that every
adapter must implement. Sub-behaviours (`FactStore`, `ProfileStore`) are
optional — adapters implement them to support long-term memory.

# `add_message`

```elixir
@callback add_message(
  conversation_id :: String.t(),
  PhoenixAI.Store.Message.t(),
  opts :: keyword()
) ::
  {:ok, PhoenixAI.Store.Message.t()} | {:error, term()}
```

# `conversation_exists?`

```elixir
@callback conversation_exists?(id :: String.t(), opts :: keyword()) ::
  {:ok, boolean()} | {:error, term()}
```

# `count_conversations`

```elixir
@callback count_conversations(filters :: keyword(), opts :: keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}
```

# `delete_conversation`

```elixir
@callback delete_conversation(id :: String.t(), opts :: keyword()) ::
  :ok | {:error, :not_found | term()}
```

# `get_messages`

```elixir
@callback get_messages(conversation_id :: String.t(), opts :: keyword()) ::
  {:ok, [PhoenixAI.Store.Message.t()]} | {:error, term()}
```

# `list_conversations`

```elixir
@callback list_conversations(filters :: keyword(), opts :: keyword()) ::
  {:ok, [PhoenixAI.Store.Conversation.t()]} | {:error, term()}
```

# `load_conversation`

```elixir
@callback load_conversation(id :: String.t(), opts :: keyword()) ::
  {:ok, PhoenixAI.Store.Conversation.t()} | {:error, :not_found | term()}
```

# `save_conversation`

```elixir
@callback save_conversation(PhoenixAI.Store.Conversation.t(), opts :: keyword()) ::
  {:ok, PhoenixAI.Store.Conversation.t()} | {:error, term()}
```

---

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