nav.groups.storage

EmbeddingStore

Vector persistence and nearest-neighbour search over embeddings.

EmbeddingStore

Vector persistence and nearest-neighbour search.

EmbeddingStore stores embedding vectors and retrieves the most similar vectors for a query. It is the backend used by RagContextAdapter.

The full file is src/store/mod.rs.

API

#[async_trait]
pub trait EmbeddingStore: Send + Sync {
    async fn upsert(&self, record: EmbeddingRecord) -> StoreResult<EmbeddingRecord>;
    async fn search(&self, query: &[f32], limit: usize) -> StoreResult<Vec<ScoredEmbedding>>;
    async fn delete(&self, id: &Uuid) -> StoreResult<()>;
    async fn delete_by_session(&self, session_id: &Uuid) -> StoreResult<u64>;
}

pub struct EmbeddingRecord {
    pub id: Uuid,
    pub session_id: Uuid,
    pub content: String,
    pub embedding: Vec<f32>,
    pub metadata: Value,
}

pub struct ScoredEmbedding {
    pub record: EmbeddingRecord,
    pub score: f32,
}

Backends

  • MemoryMemoryEmbeddingStore, brute-force cosine similarity. Default.
  • Qdrant — feature qdrant. Approximate nearest-neighbour via HNSW.

See also

Related components

Edit this page on GitHub →