VectorDbClient

Trait VectorDbClient 

Source
pub trait VectorDbClient: Send + Sync {
    // Required methods
    fn ensure_collection(
        &self,
        name: &str,
        vector_size: u64,
    ) -> impl Future<Output = Result<(), VectorDbError>> + Send;
    fn upsert_points(
        &self,
        collection: &str,
        points: Vec<VectorPoint>,
        consistency: WriteConsistency,
    ) -> impl Future<Output = Result<(), VectorDbError>> + Send;
    fn search(
        &self,
        collection: &str,
        query: Vec<f32>,
        limit: u64,
        tenant_filter: Option<u64>,
    ) -> impl Future<Output = Result<Vec<SearchResult>, VectorDbError>> + Send;
    fn delete_points(
        &self,
        collection: &str,
        ids: Vec<u64>,
    ) -> impl Future<Output = Result<(), VectorDbError>> + Send;
}
Expand description

Minimal async interface used by higher-level code.

Required Methods§

Source

fn ensure_collection( &self, name: &str, vector_size: u64, ) -> impl Future<Output = Result<(), VectorDbError>> + Send

Ensures a collection exists.

Source

fn upsert_points( &self, collection: &str, points: Vec<VectorPoint>, consistency: WriteConsistency, ) -> impl Future<Output = Result<(), VectorDbError>> + Send

Upserts points.

Source

fn search( &self, collection: &str, query: Vec<f32>, limit: u64, tenant_filter: Option<u64>, ) -> impl Future<Output = Result<Vec<SearchResult>, VectorDbError>> + Send

Searches for similar points.

Source

fn delete_points( &self, collection: &str, ids: Vec<u64>, ) -> impl Future<Output = Result<(), VectorDbError>> + Send

Deletes points.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl VectorDbClient for MockVectorDbClient

Available on crate features mock only.

Computes cosine similarity between two f32 vectors.

Source§

impl VectorDbClient for QdrantClient