use crate::fact::FactId;
use crate::scope::Scope;
use crate::store::MemoryError;
use async_trait::async_trait;
#[derive(Debug, Clone, Default)]
pub struct VectorFilter {
pub scope: Option<Scope>,
pub min_score: Option<f32>,
}
#[derive(Debug, Clone)]
pub struct VectorMatch {
pub id: FactId,
pub score: f32,
pub metadata: serde_json::Value,
}
#[async_trait]
pub trait VectorStore: Send + Sync {
async fn upsert(
&self,
id: FactId,
embedding: Vec<f32>,
metadata: serde_json::Value,
) -> Result<(), MemoryError>;
async fn search(
&self,
query: &[f32],
filter: &VectorFilter,
top_k: usize,
) -> Result<Vec<VectorMatch>, MemoryError>;
async fn delete(&self, id: FactId) -> Result<(), MemoryError>;
async fn delete_by_scope(&self, scope: &Scope) -> Result<u64, MemoryError>;
}