pub struct InMemoryVectorStore { /* private fields */ }Expand description
In-memory brute-force VectorStore for dev mode and storage-parity tests.
Vector ranking uses cosine similarity; text ranking uses a simple term-overlap score standing in for BM25. Hybrid queries fuse the two ranked lists with reciprocal-rank fusion. Not for production scale.
Implementations§
Source§impl InMemoryVectorStore
impl InMemoryVectorStore
pub fn new() -> InMemoryVectorStore
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 upsert<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn upsert<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Insert or replace records in a namespace, keyed by
VectorRecord::id.Source§fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
query: VectorQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorMatch>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
query: VectorQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorMatch>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Rank records in a namespace against the query. Returns up to
query.top_k matches, most relevant first.Source§fn delete_by_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
document_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn delete_by_document<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
document_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
InMemoryVectorStore: 'async_trait,
Remove every record belonging to a document (used on document re-sync).
Source§fn delete_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn delete_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
namespace: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Drop an entire namespace (used on index hard delete).
Auto Trait Implementations§
impl !Freeze for InMemoryVectorStore
impl RefUnwindSafe for InMemoryVectorStore
impl Send for InMemoryVectorStore
impl Sync for InMemoryVectorStore
impl Unpin for InMemoryVectorStore
impl UnsafeUnpin for InMemoryVectorStore
impl UnwindSafe 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