AI.Agent.Memory.AssociativeLearning (fnord v0.8.82)
View SourceAgent that scores memories for a conversation.
Given a conversation and a list of AI.Memory structs, it asks the LLM to
assign each memory a relevance score from 1–10 and returns a map of
memory_id => score keyed by each memory's id.
Response format:
{:ok, conversation_id, %{"memory_id_1" => score_1, ...}}On transient decode/validation failures, the agent will retry up to
@retry_limit times before returning an error.
Summary
Types
@type conversation_id() :: String.t()
@type memory_score_map() :: %{optional(String.t()) => pos_integer()}
Functions
@spec get_response(map()) :: {:ok, memory_score_map()} | {:error, term()}
Entry point required by the AI.Agent behaviour.
Expected args map:
%{
agent: %AI.Agent{},
conversation: %Store.Project.Conversation{} | %{id: id, messages: messages},
memories: [%AI.Memory{}, ...]
}Returns {:ok, scores} on success, where scores is a map of memory IDs (as
strings) to integer scores in the range 1–10.