pub struct MultiModalIndex { /* private fields */ }Expand description
Multi-modal index for unified semantic search
Implementations§
Source§impl MultiModalIndex
impl MultiModalIndex
Sourcepub fn new(config: MultiModalConfig) -> Self
pub fn new(config: MultiModalConfig) -> Self
Create a new multi-modal index
Sourcepub fn register_modality(
&mut self,
modality: Modality,
dim: usize,
) -> Result<()>
pub fn register_modality( &mut self, modality: Modality, dim: usize, ) -> Result<()>
Register a modality with the index
Sourcepub fn add(&mut self, cid: Cid, embedding: MultiModalEmbedding) -> Result<()>
pub fn add(&mut self, cid: Cid, embedding: MultiModalEmbedding) -> Result<()>
Add an embedding to the index
Sourcepub fn search_modality(
&self,
query: &MultiModalEmbedding,
k: usize,
ef_search: Option<usize>,
) -> Result<Vec<(Cid, f32)>>
pub fn search_modality( &self, query: &MultiModalEmbedding, k: usize, ef_search: Option<usize>, ) -> Result<Vec<(Cid, f32)>>
Search within a specific modality
Sourcepub fn search_cross_modal(
&self,
query: &MultiModalEmbedding,
k: usize,
ef_search: Option<usize>,
) -> Result<Vec<(Cid, f32, Modality)>>
pub fn search_cross_modal( &self, query: &MultiModalEmbedding, k: usize, ef_search: Option<usize>, ) -> Result<Vec<(Cid, f32, Modality)>>
Cross-modal search: search across all modalities
Sourcepub fn stats(&self) -> HashMap<Modality, ModalityStats>
pub fn stats(&self) -> HashMap<Modality, ModalityStats>
Get statistics for each modality
Sourcepub fn len_for_modality(&self, modality: Modality) -> usize
pub fn len_for_modality(&self, modality: Modality) -> usize
Get the number of embeddings in a specific modality
Auto Trait Implementations§
impl Freeze for MultiModalIndex
impl RefUnwindSafe for MultiModalIndex
impl Send for MultiModalIndex
impl Sync for MultiModalIndex
impl Unpin for MultiModalIndex
impl UnwindSafe for MultiModalIndex
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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>
Converts
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>
Converts
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.