pub struct LocalMemoryRetriever { /* private fields */ }Expand description
The default retriever: local, in-process, no network on the happy path.
Implementations§
Source§impl LocalMemoryRetriever
impl LocalMemoryRetriever
Sourcepub fn new(
canonical: Arc<IndexHandle>,
overlay: Arc<IndexHandle>,
config: RetrievalConfig,
) -> Self
pub fn new( canonical: Arc<IndexHandle>, overlay: Arc<IndexHandle>, config: RetrievalConfig, ) -> Self
Build a retriever over canonical and overlay indexes.
Sourcepub fn suppress_windows(&self, windows: HashSet<String>)
pub fn suppress_windows(&self, windows: HashSet<String>)
Hide canonical records in the given subject|predicate windows.
When the user states something outright mid-conversation, the durable record it contradicts must stop being retrieved now — not after reconciliation. Otherwise B answers a correction by repeating the thing it was just corrected about.
Sourcepub fn suppressed_windows(&self) -> HashSet<String>
pub fn suppressed_windows(&self) -> HashSet<String>
The windows currently hidden from canonical retrieval.
Sourcepub fn semantic(&self) -> Option<&Arc<dyn SemanticFallback>>
pub fn semantic(&self) -> Option<&Arc<dyn SemanticFallback>>
The semantic backend, if one was installed.
Exposed so the engine can call SemanticFallback::reconcile after a
commit — the vector store has to be told what reconciliation decided, or
it keeps answering from the corpus as it was before the correction.
Sourcepub fn with_semantic_fallback(self, fallback: Arc<dyn SemanticFallback>) -> Self
pub fn with_semantic_fallback(self, fallback: Arc<dyn SemanticFallback>) -> Self
Attach a semantic fallback backend.
Sourcepub fn invalidate_cache(&self)
pub fn invalidate_cache(&self)
Drop cached results — call after any index change.
Sourcepub fn cached_len(&self) -> usize
pub fn cached_len(&self) -> usize
How many cached snapshots are held.
Sourcepub async fn retrieve_scoped(
&self,
query: &str,
turn_id: TurnId,
budget: RetrievalBudget,
kinds: Vec<MemoryKind>,
about: Option<String>,
attribute: Option<String>,
) -> Result<PreparedMemorySnapshot, MemoryError>
pub async fn retrieve_scoped( &self, query: &str, turn_id: TurnId, budget: RetrievalBudget, kinds: Vec<MemoryKind>, about: Option<String>, attribute: Option<String>, ) -> Result<PreparedMemorySnapshot, MemoryError>
Answer a query directly, restricted to certain memory kinds.
The prepared-snapshot shortcut is deliberately bypassed when a scope is given: the snapshot was built speculatively and knows nothing about the restriction the model asked for, so serving it would answer a different question quickly.
Trait Implementations§
Source§impl MemoryRetriever for LocalMemoryRetriever
impl MemoryRetriever for LocalMemoryRetriever
Source§fn prepare<'life0, 'async_trait>(
&'life0 self,
request: RetrievalRequest,
) -> Pin<Box<dyn Future<Output = Result<PreparedMemorySnapshot, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare<'life0, 'async_trait>(
&'life0 self,
request: RetrievalRequest,
) -> Pin<Box<dyn Future<Output = Result<PreparedMemorySnapshot, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn retrieve_immediate<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
turn_id: TurnId,
budget: RetrievalBudget,
) -> Pin<Box<dyn Future<Output = Result<PreparedMemorySnapshot, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn retrieve_immediate<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
turn_id: TurnId,
budget: RetrievalBudget,
) -> Pin<Box<dyn Future<Output = Result<PreparedMemorySnapshot, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl !Freeze for LocalMemoryRetriever
impl !RefUnwindSafe for LocalMemoryRetriever
impl Send for LocalMemoryRetriever
impl Sync for LocalMemoryRetriever
impl Unpin for LocalMemoryRetriever
impl !UnwindSafe for LocalMemoryRetriever
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].