pub struct CompositeContextStore { /* private fields */ }Expand description
The both backend: a local (aria memo) store plus a cloud store.
memorizewrites to both (local first, so an offline write still lands); a single-side failure is logged and tolerated — only a total failure returns an error.recallqueries both, merges, dedupes and re-ranks with the sharedrankscoring so ordering matches a single-backend run.get_by_keyprefers the cloud copy and falls back to local.
Implementations§
Source§impl CompositeContextStore
impl CompositeContextStore
pub fn new( local: Arc<dyn ContextStore>, cloud: Arc<dyn ContextStore>, ) -> Arc<Self> ⓘ
pub fn local(&self) -> &Arc<dyn ContextStore> ⓘ
pub fn cloud(&self) -> &Arc<dyn ContextStore> ⓘ
Trait Implementations§
Source§impl ContextStore for CompositeContextStore
impl ContextStore for CompositeContextStore
Source§fn memorize<'life0, 'async_trait>(
&'life0 self,
frag: ContextFragment,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn memorize<'life0, 'async_trait>(
&'life0 self,
frag: ContextFragment,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persist a fragment.
Source§fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 RecallQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextFragment>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recall<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 RecallQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextFragment>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve the most relevant fragments for a query.
Source§fn compact<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ContextFragment, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compact<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ContextFragment, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Merge a session’s fragments into a single compact fragment.
Source§fn get_by_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ContextFragment>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_by_key<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ContextFragment>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Lookup an explicit long-term memory by key (used by SDK
recall).Source§fn list_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextFragment>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_session<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 str,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextFragment>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Every fragment of a session, oldest first (used by
compact and by the
session memory listing).Auto Trait Implementations§
impl !RefUnwindSafe for CompositeContextStore
impl !UnwindSafe for CompositeContextStore
impl Freeze for CompositeContextStore
impl Send for CompositeContextStore
impl Sync for CompositeContextStore
impl Unpin for CompositeContextStore
impl UnsafeUnpin for CompositeContextStore
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