Gralkor.Recall (gralkor_ex v2.1.2)

Copy Markdown View Source

Orchestrate one recall call: search the graph, interpret the hits against the buffered conversation, wrap the result in a <gralkor-memory> block.

Pure orchestration — all dependencies (search, interpret LLM call, turns source) are passed as functions in opts. Production wiring lives in Gralkor.Client.Native.

See ex-recall in gralkor/TEST_TREES.md.

Summary

Types

group_id()

@type group_id() :: String.t()

interpret_fn()

@type interpret_fn() :: (String.t() -> {:ok, [String.t()]} | {:error, term()})

opts()

@type opts() :: [
  search_fn: search_fn(),
  interpret_fn: interpret_fn(),
  turns_fn: turns_fn(),
  max_results: pos_integer(),
  deadline_ms: pos_integer()
]

search_fn()

@type search_fn() :: (group_id(), query :: String.t(), max :: pos_integer() ->
                  {:ok, [String.t()]} | {:error, term()})

session_id()

@type session_id() :: String.t() | nil

turns_fn()

@type turns_fn() :: (String.t() -> [[Gralkor.Message.t()]])

Functions

recall(group_id, session_id, query, opts)

@spec recall(group_id(), session_id(), String.t(), opts()) ::
  {:ok, String.t()} | {:error, :recall_deadline_expired | term()}