pub struct Session<'db> { /* private fields */ }Expand description
A scoped conversation session over a Mnemo database.
Created by Mnemo::session. Holds the database mutably until it is
closed (or dropped), so all writes for the conversation flow through it.
Implementations§
Source§impl<'db> Session<'db>
impl<'db> Session<'db>
Sourcepub fn turn_count(&self) -> usize
pub fn turn_count(&self) -> usize
How many turns have been recorded.
Sourcepub fn add_turn(&mut self, turn: Turn) -> Result<Ulid>
pub fn add_turn(&mut self, turn: Turn) -> Result<Ulid>
Record a conversation turn as a Working memory tagged with this
session and agent. The turn’s role is kept in the memory’s metadata.
Writes are staged; they reach disk on Session::close (or any later
flush of the database).
Sourcepub fn recall(&mut self, request: RecallRequest) -> Result<Vec<RecallResult>>
pub fn recall(&mut self, request: RecallRequest) -> Result<Vec<RecallResult>>
Retrieve memories for context injection, scoped to this session’s
agent. The agent filter on request is overridden — a session always
recalls within its own agent’s view (its private memories plus shared
ones). All other request fields (type filter, weights, top-k) apply.
Auto Trait Implementations§
impl<'db> !UnwindSafe for Session<'db>
impl<'db> Freeze for Session<'db>
impl<'db> RefUnwindSafe for Session<'db>
impl<'db> Send for Session<'db>
impl<'db> Sync for Session<'db>
impl<'db> Unpin for Session<'db>
impl<'db> UnsafeUnpin for Session<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more