pub struct LayeredMemory<S: EntryStore, I: IndexSearcher> { /* private fields */ }Expand description
Default layered memory backed by an entry store and index searcher.
Implementations§
Source§impl<S: EntryStore, I: IndexSearcher> LayeredMemory<S, I>
impl<S: EntryStore, I: IndexSearcher> LayeredMemory<S, I>
Trait Implementations§
Source§impl<S: EntryStore, I: IndexSearcher> ConversationMemory for LayeredMemory<S, I>
impl<S: EntryStore, I: IndexSearcher> ConversationMemory for LayeredMemory<S, I>
Source§fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
message: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Append a message to the session. Read more
Source§fn recent<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
n: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recent<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
n: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the most recent
n messages, newest last. Read moreSource§fn evict<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
keep: usize,
) -> Pin<Box<dyn Future<Output = Result<usize, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn evict<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
keep: usize,
) -> Pin<Box<dyn Future<Output = Result<usize, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Evict the oldest messages, keeping only the
keep most recent. Read moreSource§impl<S: EntryStore, I: IndexSearcher> FactMemory for LayeredMemory<S, I>
impl<S: EntryStore, I: IndexSearcher> FactMemory for LayeredMemory<S, I>
Source§fn remember<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
fact: &'life1 str,
tags: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<String, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remember<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
fact: &'life1 str,
tags: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<String, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a fact with optional tags and return a unique identifier. Read more
Source§fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, f32, Vec<String>)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, f32, Vec<String>)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Recall facts matching the query. Read more
Source§impl<S: EntryStore, I: IndexSearcher> ProjectMemory for LayeredMemory<S, I>
impl<S: EntryStore, I: IndexSearcher> ProjectMemory for LayeredMemory<S, I>
Source§fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
key: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn put<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
key: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store a key-value pair in the project namespace.
Source§fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Retrieve a value by key. Read more
Source§fn keys<'life0, 'life1, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn keys<'life0, 'life1, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all keys in the project namespace.
Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, f32)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
project_id: &'life1 str,
query: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, f32)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search for entries matching the query string. Read more
Source§impl<S: EntryStore, I: IndexSearcher> SummaryMemory for LayeredMemory<S, I>
impl<S: EntryStore, I: IndexSearcher> SummaryMemory for LayeredMemory<S, I>
Source§fn get_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, String)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_latest<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, String)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve the most recent summary for a scope. Read more
Source§fn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 str,
summary: &'life2 str,
source: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn store<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
scope: &'life1 str,
summary: &'life2 str,
source: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store a new summary for a scope. Read more
Source§fn history<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, u64)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn history<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String, u64)>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the summary history for a scope, newest first. Read more
Source§impl<S: EntryStore, I: IndexSearcher> UserProfileMemory for LayeredMemory<S, I>
impl<S: EntryStore, I: IndexSearcher> UserProfileMemory for LayeredMemory<S, I>
Source§fn get_preferences<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_preferences<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve all preferences for a user as a flat key-value map.
Source§fn set_preference<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
key: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn set_preference<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
key: &'life2 str,
value: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Set or update a single preference key. Read more
Source§fn remove_preference<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_preference<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a single preference key. Read more
Auto Trait Implementations§
impl<S, I> Freeze for LayeredMemory<S, I>
impl<S, I> RefUnwindSafe for LayeredMemory<S, I>where
S: RefUnwindSafe,
I: RefUnwindSafe,
impl<S, I> Send for LayeredMemory<S, I>
impl<S, I> Sync for LayeredMemory<S, I>
impl<S, I> Unpin for LayeredMemory<S, I>
impl<S, I> UnsafeUnpin for LayeredMemory<S, I>
impl<S, I> UnwindSafe for LayeredMemory<S, I>where
S: RefUnwindSafe,
I: RefUnwindSafe,
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