pub struct InMemoryVectorStore { /* private fields */ }Expand description
In-memory vector store for testing purposes.
Data is not persisted and will be lost when the process exits. Uses cosine similarity for vector comparisons.
Implementations§
Source§impl InMemoryVectorStore
impl InMemoryVectorStore
Sourcepub fn new() -> InMemoryVectorStore
pub fn new() -> InMemoryVectorStore
Create a new in-memory vector store.
Trait Implementations§
Source§impl Default for InMemoryVectorStore
impl Default for InMemoryVectorStore
Source§fn default() -> InMemoryVectorStore
fn default() -> InMemoryVectorStore
Returns the “default value” for a type. Read more
Source§impl VectorStore for InMemoryVectorStore
impl VectorStore for InMemoryVectorStore
Source§fn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
Get the name of this vector store provider.
Source§fn create_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
dimensions: usize,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn create_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
dimensions: usize,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Create a new collection with the specified vector dimensions. Read more
Source§fn delete_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn delete_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Delete a collection and all its data. Read more
Source§fn list_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionInfo>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn list_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<CollectionInfo>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
List all collections in the vector store.
Source§fn collection_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn collection_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Check if a collection exists.
Source§fn collection_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CollectionStats, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn collection_stats<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<CollectionStats, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Get statistics about a collection.
Source§fn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
documents: &'life2 [Document],
) -> Pin<Box<dyn Future<Output = Result<usize, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
documents: &'life2 [Document],
) -> Pin<Box<dyn Future<Output = Result<usize, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
Upsert documents with their embeddings into a collection. Read more
Source§fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
embedding: &'life2 [f32],
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
embedding: &'life2 [f32],
limit: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
Search for similar vectors in a collection. Read more
Source§fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<usize, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<usize, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
Delete documents by their IDs. Read more
Source§fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
Get a document by ID. Read more
Source§fn search_with_filters<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
embedding: &'life2 [f32],
limit: usize,
threshold: f32,
_filters: &'life3 [(String, String)],
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn search_with_filters<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
collection: &'life1 str,
embedding: &'life2 [f32],
limit: usize,
threshold: f32,
_filters: &'life3 [(String, String)],
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, AppError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Search with metadata filters. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for InMemoryVectorStore
impl !UnwindSafe for InMemoryVectorStore
impl Freeze for InMemoryVectorStore
impl Send for InMemoryVectorStore
impl Sync for InMemoryVectorStore
impl Unpin for InMemoryVectorStore
impl UnsafeUnpin for InMemoryVectorStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more