Normandy.Components.AgentMemory (normandy v0.2.0)

View Source

Manages conversation memory for agents with support for turn-based tracking and optional message limits.

Summary

Types

t()

@type t() :: %{
  max_messages: pos_integer() | nil,
  history: [Normandy.Components.Message.t()],
  current_turn_id: String.t() | nil
}

Functions

add_message(memory, role, content)

@spec add_message(t(), String.t(), struct()) :: t()

count_messages(memory)

@spec count_messages(t()) :: non_neg_integer()

delete_turn(memory, turn_id)

@spec delete_turn(t(), String.t()) :: t()

dump(memory)

@spec dump(t()) :: String.t()

get_current_turn_id(memory)

@spec get_current_turn_id(t()) :: String.t() | nil

history(map)

@spec history(t()) :: [%{role: String.t(), content: String.t()}]

initialize_turn(memory)

@spec initialize_turn(t()) :: t()

load(dump)

@spec load(String.t()) :: t()

new_memory(max_messages \\ nil)

@spec new_memory(pos_integer() | nil) :: t()