Skip to main content

LayeredMemory

Struct LayeredMemory 

Source
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>

Source

pub fn new(store: Arc<S>, searcher: Arc<I>) -> Self

Create a new LayeredMemory.

Trait Implementations§

Source§

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,

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,

Return the most recent n messages, newest last. Read more
Source§

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 more
Source§

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,

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,

Recall facts matching the query. Read more
Source§

fn forget<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a fact by its unique ID. Read more
Source§

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,

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,

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,

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,

Search for entries matching the query string. Read more
Source§

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,

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,

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,

Return the summary history for a scope, newest first. Read more
Source§

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,

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,

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,

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>

§

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>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.