pub struct VectorStore { /* private fields */ }Expand description
Vector store for semantic search
Implementations§
Source§impl VectorStore
impl VectorStore
Sourcepub async fn ensure_collection(
&self,
name: &str,
dimension: usize,
) -> Result<()>
pub async fn ensure_collection( &self, name: &str, dimension: usize, ) -> Result<()>
Ensure collection exists
Sourcepub async fn insert<T: Serialize>(
&self,
collection: &str,
id: &str,
embedding: Vec<f32>,
metadata: Option<T>,
) -> Result<()>
pub async fn insert<T: Serialize>( &self, collection: &str, id: &str, embedding: Vec<f32>, metadata: Option<T>, ) -> Result<()>
Insert vector with metadata
Sourcepub async fn batch_insert<T: Serialize>(
&self,
collection: &str,
documents: Vec<(String, Vec<f32>, Option<T>)>,
) -> Result<usize>
pub async fn batch_insert<T: Serialize>( &self, collection: &str, documents: Vec<(String, Vec<f32>, Option<T>)>, ) -> Result<usize>
Batch insert vectors
Sourcepub async fn search(
&self,
collection: &str,
query_embedding: Vec<f32>,
top_k: usize,
) -> Result<Vec<(String, f32)>>
pub async fn search( &self, collection: &str, query_embedding: Vec<f32>, top_k: usize, ) -> Result<Vec<(String, f32)>>
Search for similar vectors
Auto Trait Implementations§
impl Freeze for VectorStore
impl !RefUnwindSafe for VectorStore
impl Send for VectorStore
impl Sync for VectorStore
impl Unpin for VectorStore
impl !UnwindSafe for VectorStore
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