pub trait VectorIndex: Send + Sync {
// Required methods
fn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
records: &'life2 [VectorRecord],
) -> Pin<Box<dyn Future<Output = Result<(), VectorIndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
vector: &'life2 [f32],
k: usize,
filter: &'life3 VectorFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorMatch>, VectorIndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<(), VectorIndexError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Stores and ranks embedding vectors, within the namespace every call
names — the sibling of Embedder, which makes the
vectors this one keeps and searches. Hosted adapters (Vectorize) are
eventually consistent — a write may take seconds to become queryable —
while ExactVectorIndex is immediate.
Required Methods§
Sourcefn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
records: &'life2 [VectorRecord],
) -> Pin<Box<dyn Future<Output = Result<(), VectorIndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upsert<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
records: &'life2 [VectorRecord],
) -> Pin<Box<dyn Future<Output = Result<(), VectorIndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Writes every record into namespace, replacing any existing record
with the same id — values and metadata both, never a merge.
§Errors
VectorIndexError::InvalidInput on an empty or wrong-width
vector; VectorIndexError::NotConfigured when unwired;
VectorIndexError::Operation when the call fails.
Sourcefn query<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
vector: &'life2 [f32],
k: usize,
filter: &'life3 VectorFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorMatch>, VectorIndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn query<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
vector: &'life2 [f32],
k: usize,
filter: &'life3 VectorFilter,
) -> Pin<Box<dyn Future<Output = Result<Vec<VectorMatch>, VectorIndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
The at-most-k nearest neighbours of vector in namespace,
cosine similarity descending, every match satisfying filter.
§Errors
VectorIndexError::InvalidInput on an empty or wrong-width
vector; VectorIndexError::NotConfigured when unwired;
VectorIndexError::Operation when the call failed.
Sourcefn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<(), VectorIndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
namespace: &'life1 VectorNamespace,
ids: &'life2 [String],
) -> Pin<Box<dyn Future<Output = Result<(), VectorIndexError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Removes the records named by ids from namespace. A missing id is
not an error: the delete is idempotent.
§Errors
VectorIndexError::NotConfigured when unwired;
VectorIndexError::Operation when the call fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".