#![cfg(all(feature = "fastembed", feature = "sqlite-vec"))]
use klieo_core::memory::{Fact, Scope};
use klieo_memory_sqlite::{FastEmbedEmbedder, MemorySqlite};
use std::sync::Arc;
#[tokio::test]
async fn fastembed_with_vec_round_trip() {
let embedder = Arc::new(FastEmbedEmbedder::new().expect("fastembed init"));
let mem = MemorySqlite::new(":memory:", embedder).await.unwrap();
mem.long_term
.remember(
Scope::Global,
Fact::new("the cat sat on the mat")
.with_metadata(serde_json::json!({"source": "test"})),
)
.await
.unwrap();
mem.long_term
.remember(Scope::Global, Fact::new("Rust async runtimes are great"))
.await
.unwrap();
mem.long_term
.remember(
Scope::Global,
Fact::new("octopuses are intelligent invertebrates"),
)
.await
.unwrap();
let hits = mem
.long_term
.recall(Scope::Global, "where is the cat sitting?", 1)
.await
.unwrap();
assert_eq!(hits.len(), 1);
assert!(
hits[0].text.contains("cat"),
"expected cat-related fact for cat-related query, got: {}",
hits[0].text
);
}