kowalski_core/memory/
mod.rs1pub mod consolidation;
2pub mod episodic;
3pub mod helpers;
4pub mod semantic;
5#[cfg(feature = "postgres")]
6pub mod semantic_pg;
7#[cfg(test)]
8mod tests;
9pub mod working;
10
11#[cfg(feature = "postgres")]
12pub use semantic_pg::PostgresSemanticStore;
13
14use async_trait::async_trait;
15use serde::{Deserialize, Serialize};
16
17use crate::error::KowalskiError;
18
19#[derive(Serialize, Deserialize, Clone, Debug)]
21pub struct MemoryUnit {
22 pub id: String, pub timestamp: u64,
24 pub content: String,
25 pub embedding: Option<Vec<f32>>,
26}
27
28#[async_trait]
31pub trait MemoryProvider {
32 async fn add(&mut self, memory: MemoryUnit) -> Result<(), KowalskiError>;
34
35 async fn retrieve(
37 &self,
38 query: &str,
39 retrieval_limit: usize,
40 ) -> Result<Vec<MemoryUnit>, KowalskiError>;
41
42 async fn search(&self, query: MemoryQuery) -> Result<Vec<MemoryUnit>, KowalskiError>;
44}
45
46#[derive(Debug, Clone)]
48pub struct MemoryQuery {
49 pub text_query: String,
50 pub vector_query: Option<Vec<f32>>,
51 pub top_k: usize,
52}