pub struct InMemoryVectorStore { /* private fields */ }Expand description
内存向量存储
Implementations§
Source§impl InMemoryVectorStore
impl InMemoryVectorStore
Sourcepub fn new() -> 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 add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: Vec<Vec<f32>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn add_documents<'life0, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: Vec<Vec<f32>>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
Adds documents. Read more
Source§fn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn similarity_search<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Searches similar documents. Read more
Source§fn similarity_search_with_min_score<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
k: usize,
min_score: Option<f32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn similarity_search_with_min_score<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
k: usize,
min_score: Option<f32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
带最低分数阈值的相似度检索。 Read more
Source§fn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Gets document by ID.
Source§fn get_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn get_embedding<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<f32>>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Gets document embedding by ID.
Source§fn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
InMemoryVectorStore: 'async_trait,
Deletes document.
Source§fn count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
Returns document count.
Source§fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
InMemoryVectorStore: 'async_trait,
Clears store.
Source§fn embed_query(&self) -> Option<&dyn Embeddings>
fn embed_query(&self) -> Option<&dyn Embeddings>
返回该向量存储自带的文本嵌入器(若有)。 Read more
Source§fn similarity_search_text<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn similarity_search_text<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>, VectorStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
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