pub struct MemoryCardContext<G = MemvidStore>where
G: MemoryGraph,{ /* private fields */ }Expand description
A VectorStoreIndex that returns formatted MemoryCards instead
of frame text. Generic over any MemoryGraph backend; defaults to
MemvidStore so the common call site
MemoryCardContext::new(store, _) continues to work without naming
the type parameter.
Returned scores combine deterministic query/card relevance with recency as a tie-breaker. They are intended for stable context ordering, not as embedding similarity scores.
Implementations§
Source§impl<G> MemoryCardContext<G>where
G: MemoryGraph,
impl<G> MemoryCardContext<G>where
G: MemoryGraph,
Sourcepub const DEFAULT_MAX_CARDS: usize = 8
pub const DEFAULT_MAX_CARDS: usize = 8
Default cap on cards returned per query when the caller doesn’t
override via Self::with_max_cards or
VectorSearchRequest::samples.
Sourcepub fn new(graph: G, strategy: CardSelection) -> Self
pub fn new(graph: G, strategy: CardSelection) -> Self
Build a context view over graph using strategy.
Sourcepub fn with_max_cards(self, max_cards: usize) -> Self
pub fn with_max_cards(self, max_cards: usize) -> Self
Cap on the number of cards returned per query. The effective cap
is min(max_cards, request.samples()).
Sourcepub fn strategy(&self) -> &CardSelection
pub fn strategy(&self) -> &CardSelection
Selection strategy currently in use.
Sourcepub fn select(&self, query: &str) -> Result<Vec<MemoryCard>, G::Error>
pub fn select(&self, query: &str) -> Result<Vec<MemoryCard>, G::Error>
Resolve query into the set of candidate cards according to the
configured CardSelection. Public so tests and tools can
inspect what the agent would see.
Trait Implementations§
Source§impl<G> Clone for MemoryCardContext<G>where
G: MemoryGraph + Clone,
impl<G> Clone for MemoryCardContext<G>where
G: MemoryGraph + Clone,
Source§fn clone(&self) -> MemoryCardContext<G>
fn clone(&self) -> MemoryCardContext<G>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<G> Debug for MemoryCardContext<G>where
G: MemoryGraph + Debug,
impl<G> Debug for MemoryCardContext<G>where
G: MemoryGraph + Debug,
Source§impl<G> VectorStoreIndex for MemoryCardContext<G>
impl<G> VectorStoreIndex for MemoryCardContext<G>
Source§type Filter = MemvidFilter
type Filter = MemvidFilter
Card-context selection ignores filters; using MemvidFilter
keeps the type aligned with MemvidStore so callers can stack
both views under a single filter type when composing
dynamic_context.
Source§async fn top_n<T>(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> Result<Vec<(f64, String, T)>, VectorStoreError>where
T: for<'a> Deserialize<'a> + WasmCompatSend,
async fn top_n<T>(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> Result<Vec<(f64, String, T)>, VectorStoreError>where
T: for<'a> Deserialize<'a> + WasmCompatSend,
(score, id, document) tuples.Source§async fn top_n_ids(
&self,
req: VectorSearchRequest<Self::Filter>,
) -> Result<Vec<(f64, String)>, VectorStoreError>
async fn top_n_ids( &self, req: VectorSearchRequest<Self::Filter>, ) -> Result<Vec<(f64, String)>, VectorStoreError>
(score, id) tuples.Auto Trait Implementations§
impl<G> Freeze for MemoryCardContext<G>where
G: Freeze,
impl<G> RefUnwindSafe for MemoryCardContext<G>where
G: RefUnwindSafe,
impl<G> Send for MemoryCardContext<G>where
G: Send,
impl<G> Sync for MemoryCardContext<G>where
G: Sync,
impl<G> Unpin for MemoryCardContext<G>where
G: Unpin,
impl<G> UnsafeUnpin for MemoryCardContext<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for MemoryCardContext<G>where
G: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
impl<T, F> Tool for Twhere
F: SearchFilter<Value = Value> + WasmCompatSend + WasmCompatSync + for<'de> Deserialize<'de>,
T: VectorStoreIndex<Filter = F>,
Source§const NAME: &'static str = "search_vector_store"
const NAME: &'static str = "search_vector_store"
ToolSet or other registration scope that dispatches tools by name.