Skip to main content

VectorStoreIndex

Trait VectorStoreIndex 

Source
pub trait VectorStoreIndex: Send + Sync {
    // Required methods
    fn top_n<T: for<'a> Deserialize<'a> + Send>(
        &self,
        query: &str,
        n: usize,
    ) -> impl Future<Output = Result<Vec<(f64, String, T)>, VectorStoreError>> + Send;
    fn top_n_ids(
        &self,
        query: &str,
        n: usize,
    ) -> impl Future<Output = Result<Vec<(f64, String)>, VectorStoreError>> + Send;
}
Expand description

Trait for vector store indexes

Required Methods§

Source

fn top_n<T: for<'a> Deserialize<'a> + Send>( &self, query: &str, n: usize, ) -> 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)

Source

fn top_n_ids( &self, query: &str, n: usize, ) -> 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".

Implementors§