pub struct ChatMemorySession { /* private fields */ }Expand description
High-level session helper for LLM chat comparison patterns.
Groups conversation turns under a single Dakera session so that:
- Every stored message is associated with
session_idfor scoped retrieval. recallqueries the agent’s full memory — not just this session — so prior conversations inform the current exchange.
Create via ChatMemorySession::create; close via ChatMemorySession::close.
Implementations§
Source§impl ChatMemorySession
impl ChatMemorySession
Sourcepub async fn create(
client: Arc<DakeraClient>,
agent_id: impl Into<String>,
) -> Result<ChatMemorySession>
pub async fn create( client: Arc<DakeraClient>, agent_id: impl Into<String>, ) -> Result<ChatMemorySession>
Create a new Dakera session and return a ChatMemorySession.
§Arguments
client– SharedDakeraClientinstance.agent_id– Identifier for the agent whose memory to use.
Sourcepub async fn create_with_metadata(
client: Arc<DakeraClient>,
agent_id: impl Into<String>,
metadata: Value,
) -> Result<ChatMemorySession>
pub async fn create_with_metadata( client: Arc<DakeraClient>, agent_id: impl Into<String>, metadata: Value, ) -> Result<ChatMemorySession>
Create a session with attached metadata.
Sourcepub async fn store(
&self,
role: &str,
content: &str,
) -> Result<StoreMemoryResponse>
pub async fn store( &self, role: &str, content: &str, ) -> Result<StoreMemoryResponse>
Store a conversation turn in the session with default importance (0.6).
The role (e.g. "user" or "assistant") is appended to the memory’s
tags automatically.
Sourcepub async fn store_with_opts(
&self,
role: &str,
content: &str,
importance: f32,
extra_tags: &[&str],
) -> Result<StoreMemoryResponse>
pub async fn store_with_opts( &self, role: &str, content: &str, importance: f32, extra_tags: &[&str], ) -> Result<StoreMemoryResponse>
Store a conversation turn with custom importance and additional tags.
Sourcepub async fn recall(&self, query: &str) -> Result<Vec<RecalledMemory>>
pub async fn recall(&self, query: &str) -> Result<Vec<RecalledMemory>>
Recall up to 5 memories relevant to query for this agent.
Searches the agent’s full memory, not just the current session, so context from prior conversations is surfaced when relevant.
Sourcepub async fn recall_top_k(
&self,
query: &str,
top_k: usize,
) -> Result<Vec<RecalledMemory>>
pub async fn recall_top_k( &self, query: &str, top_k: usize, ) -> Result<Vec<RecalledMemory>>
Recall up to top_k memories relevant to query.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
The underlying Dakera session ID.