lumen_rag/store.rs
1use async_trait::async_trait;
2use crate::types::Passage;
3use anyhow::Result;
4
5/// A trait defining the capabilities of a vector database backend.
6#[async_trait]
7pub trait VectorStore: Send + Sync {
8 /// Ingests a list of passages into the store.
9 async fn add_passages(&self, passages: Vec<Passage>) -> Result<Vec<String>>;
10
11 /// Searches for the nearest neighbors given a query embedding.
12 async fn search(
13 &self,
14 query_embedding: &[f32],
15 limit: usize
16 ) -> Result<Vec<Passage>>;
17}