pub struct WeaviateVectorStore { /* private fields */ }Expand description
Weaviate-backed vector store.
Implements VectorStore using the Weaviate v1 REST API:
- Batch add:
POST /v1/batch/objects - Similarity search:
POST /v1/graphqlwithnearVector - Delete:
DELETE /v1/objects/{class}/{id}
Call WeaviateVectorStore::initialize once to create the class schema
before adding documents.
Implementations§
Source§impl WeaviateVectorStore
impl WeaviateVectorStore
Sourcepub fn new(config: WeaviateConfig) -> Self
pub fn new(config: WeaviateConfig) -> Self
Create a new store with the given configuration.
Sourcepub fn with_client(config: WeaviateConfig, client: Client) -> Self
pub fn with_client(config: WeaviateConfig, client: Client) -> Self
Create with a custom reqwest client.
Sourcepub fn config(&self) -> &WeaviateConfig
pub fn config(&self) -> &WeaviateConfig
Return a reference to the configuration.
Sourcepub async fn initialize(&self) -> Result<(), SynapticError>
pub async fn initialize(&self) -> Result<(), SynapticError>
Create the Weaviate class schema for this store (idempotent).
Creates a class with content (text), metadata (text), and
docId (text) properties. Uses the cosine distance metric via
"vectorizer": "none" (caller supplies vectors).
Trait Implementations§
Source§impl VectorStore for WeaviateVectorStore
impl VectorStore for WeaviateVectorStore
Source§fn add_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: &'life1 dyn Embeddings,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
documents: Vec<Document>,
embeddings: &'life1 dyn Embeddings,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add documents to the store, computing their embeddings.
Source§fn similarity_search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
embeddings: &'life2 dyn Embeddings,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn similarity_search<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
embeddings: &'life2 dyn Embeddings,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search for similar documents by query string.
Source§fn similarity_search_with_score<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
embeddings: &'life2 dyn Embeddings,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Document, f32)>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn similarity_search_with_score<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
k: usize,
embeddings: &'life2 dyn Embeddings,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Document, f32)>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Search with similarity scores (higher = more similar).
Source§fn similarity_search_by_vector<'life0, 'life1, 'async_trait>(
&'life0 self,
embedding: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn similarity_search_by_vector<'life0, 'life1, 'async_trait>(
&'life0 self,
embedding: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, SynapticError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search by pre-computed embedding vector instead of text query.
Auto Trait Implementations§
impl Freeze for WeaviateVectorStore
impl !RefUnwindSafe for WeaviateVectorStore
impl Send for WeaviateVectorStore
impl Sync for WeaviateVectorStore
impl Unpin for WeaviateVectorStore
impl UnsafeUnpin for WeaviateVectorStore
impl !UnwindSafe for WeaviateVectorStore
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