Files
imphnen-backend-service/imphnen-dimentorin/src/ai_agent/domain/repository.rs
T

26 lines
693 B
Rust
Raw Normal View History

use async_trait::async_trait;
use uuid::Uuid;
use super::rag_document::RagDocument;
use imphnen_utils::AppError;
#[async_trait]
pub trait RagRepository: Send + Sync {
/// Upsert a document chunk into the vector store.
async fn upsert_document(
&self,
point_id: u64,
doc: &RagDocument,
embedding: Vec<f32>,
) -> Result<(), AppError>;
/// Search the vector store for the closest chunks to `embedding`.
async fn search(
&self,
embedding: Vec<f32>,
limit: u64,
material_id: Option<Uuid>,
) -> Result<Vec<(RagDocument, f32)>, AppError>;
/// Remove all chunks for a material (re-index support).
async fn delete_material(&self, material_id: Uuid) -> Result<(), AppError>;
}