pub struct HnswVectorStore<E, D, M>where
E: Embeddings,
D: DocumentStore<usize, M> + Send + Sync,
M: Serialize + DeserializeOwned + Send + Sync,{ /* private fields */ }
Implementations§
Source§impl<E, D, M> HnswVectorStore<E, D, M>where
E: Embeddings,
D: DocumentStore<usize, M> + Send + Sync,
M: Send + Sync + Serialize + DeserializeOwned,
impl<E, D, M> HnswVectorStore<E, D, M>where
E: Embeddings,
D: DocumentStore<usize, M> + Send + Sync,
M: Send + Sync + Serialize + DeserializeOwned,
pub fn new( hnsw_args: HnswArgs, embeddings: Arc<E>, document_store: Arc<Mutex<D>>, ) -> Self
pub fn dump_to_file( &self, filename: String, ) -> Result<i32, HnswVectorStoreError<E::Error, D::Error>>
pub fn load_from_file( filename: String, embeddings: Arc<E>, document_store: Arc<Mutex<D>>, ) -> Result<Self, HnswVectorStoreError<E::Error, D::Error>>
Trait Implementations§
Source§impl<E, D, M> VectorStore<E, M> for HnswVectorStore<E, D, M>where
E: Embeddings + Send + Sync,
D: DocumentStore<usize, M> + Send + Sync,
M: Send + Sync + Serialize + DeserializeOwned,
impl<E, D, M> VectorStore<E, M> for HnswVectorStore<E, D, M>where
E: Embeddings + Send + Sync,
D: DocumentStore<usize, M> + Send + Sync,
M: Send + Sync + Serialize + DeserializeOwned,
type Error = HnswVectorStoreError<<E as Embeddings>::Error, <D as DocumentStore<usize, M>>::Error>
fn add_texts<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document<M>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn similarity_search<'life0, 'async_trait>(
&'life0 self,
query: String,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document<M>>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<E, D, M> Freeze for HnswVectorStore<E, D, M>
impl<E, D, M> !RefUnwindSafe for HnswVectorStore<E, D, M>
impl<E, D, M> Send for HnswVectorStore<E, D, M>
impl<E, D, M> Sync for HnswVectorStore<E, D, M>
impl<E, D, M> Unpin for HnswVectorStore<E, D, M>where
M: Unpin,
impl<E, D, M> !UnwindSafe for HnswVectorStore<E, D, M>
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