Light Dark

Functions

AgentMemory alias

Alias of ::ai::memory/AgentMemory

ChatOptions alias

Alias of ::ai::chat/ChatOptions

Role alias

Alias of ::ai::message/Role

Thread alias

Alias of ::ai::memory/Thread

ask

fn (mem: ::ai::memory/AgentMemory, question: Str, chat-opts: ::ai::chat/ChatOptions, opts: Map?): Map

Search memory for relevant context, then generate an AI answer. Returns {answer, sources}.

ask-with-thread

fn (mem: ::ai::memory/AgentMemory, t: ::ai::memory/Thread, question: Str, chat-opts: ::ai::chat/ChatOptions, opts: Map?): Map

Like ask, but includes thread history for multi-turn context. Appends question and answer to the thread automatically.

build-context

fn (mem: ::ai::memory/AgentMemory, query: Str, opts: Map?): Str

Search session memory and KB, format as a context string for AI prompts. Options: limit (default 10), min-score (default 0.5).

build-rag-prompt

fn (history-text: Str, context: Str, question: Str): Str

Compose a RAG prompt from optional history, optional context, and a question.

format-kb-results

fn (results: Vec): Vec

Format a Vec of KB search results as [KB] content lines.

format-session-results

fn (results: Vec): Vec

Format a Vec of store search results (with v.sender-name, v.content) as [name]: content lines.

format-thread-lines

fn (history: Vec): Str

Format a Vec of ChatMessages as role: content lines.

ns alias

Alias of ::ai::rag/

Retrieve-Augment-Generate: compose memory search with AI generation. Accepts chat-fn parameter for provider-free AI calls.

summarize

fn (mem: ::ai::memory/AgentMemory, chat-opts: ::ai::chat/ChatOptions, opts: Map?): Str

Summarize recent messages from session memory using AI. Options: hours, limit, instruction.