pub trait VectorStoreIndex: Send + Sync {
// Required methods
fn top_n<T: for<'a> Deserialize<'a> + Send>(
&self,
req: VectorSearchRequest,
) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + Send;
fn top_n_ids(
&self,
req: VectorSearchRequest,
) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + Send;
}
Expand description
Trait for vector store indexes
Required Methods§
Sourcefn top_n<T: for<'a> Deserialize<'a> + Send>(
&self,
req: VectorSearchRequest,
) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + Send
fn top_n<T: for<'a> Deserialize<'a> + Send>( &self, req: VectorSearchRequest, ) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + Send
Get the top n documents based on the distance to the given query. The result is a list of tuples of the form (score, id, document)
Sourcefn top_n_ids(
&self,
req: VectorSearchRequest,
) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + Send
fn top_n_ids( &self, req: VectorSearchRequest, ) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + Send
Same as top_n
but returns the document ids only.
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.