pub struct InMemoryVecStore { /* private fields */ }Expand description
In-memory VecStore: stores items in a map, search by brute-force cosine similarity.
Implementations§
Trait Implementations§
Source§impl VecStore for InMemoryVecStore
impl VecStore for InMemoryVecStore
Source§fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
items: &'life1 [VecStoreItem],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
items: &'life1 [VecStoreItem],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Add items (id, vector, payload).
Source§fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
top_k: usize,
filter: Option<&'life2 HashMap<String, Value>>,
collection: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VecSearchHit>, VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
top_k: usize,
filter: Option<&'life2 HashMap<String, Value>>,
collection: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VecSearchHit>, VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Search by vector.
Source§fn get_by_ids<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [String],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VecStoreItem>, VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_by_ids<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [String],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<VecStoreItem>, VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get by ids.
Source§fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [String],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [String],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete by ids.
Source§fn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
items: &'life1 [VecStoreItem],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
items: &'life1 [VecStoreItem],
collection: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<(), VecStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Upsert items: insert or replace by id. Ensures full payload and avoids delete+add window.
Auto Trait Implementations§
impl Freeze for InMemoryVecStore
impl !RefUnwindSafe for InMemoryVecStore
impl Send for InMemoryVecStore
impl Sync for InMemoryVecStore
impl Unpin for InMemoryVecStore
impl UnsafeUnpin for InMemoryVecStore
impl !UnwindSafe for InMemoryVecStore
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