Skip to main content

Module session

Module session 

Source
Expand description

High-level session helper for LLM chat comparison patterns.

ChatMemorySession wraps the low-level session/memory API into the three-step pattern used by the playground LLM chat comparison feature:

  1. Create a session bound to an agent.
  2. Store conversation turns with ChatMemorySession::store.
  3. Recall relevant context before generating the next response.

§Example

use std::sync::Arc;
use dakera_client::{DakeraClient, ChatMemorySession};

let client = Arc::new(
    DakeraClient::builder("http://localhost:3000")
        .api_key("dk-mykey")
        .build()?,
);

let session = ChatMemorySession::create(Arc::clone(&client), "chat-agent").await?;
session.store("user", "My name is Alice and I like Rust.").await?;
let context = session.recall("user preferences").await?;
// Pass context to your LLM — or skip it for the baseline comparison arm.
session.close().await?;

Structs§

ChatMemorySession
High-level session helper for LLM chat comparison patterns.