klieo-memory-qdrant 0.41.2

Qdrant-backed implementation of klieo-core's LongTermMemory.
Documentation
//! `MemoryQdrant` — convenience factory wrapping the `LongTermMemory`
//! handle in an `Arc<dyn …>` ready for `AgentContext`.

use crate::client::{QdrantConfig, QdrantHandle};
use crate::embedder::Embedder;
use crate::long_term::QdrantLongTerm;
use klieo_core::error::MemoryError;
use klieo_core::memory::LongTermMemory;
use std::sync::Arc;

/// Factory bundle returned by [`MemoryQdrant::new`].
pub struct MemoryQdrant {
    /// `LongTermMemory` implementation backed by Qdrant.
    pub long_term: Arc<dyn LongTermMemory>,
}

impl MemoryQdrant {
    /// Connect to Qdrant and return a ready-to-use handle.
    ///
    /// The collection is *not* created upfront; it is bootstrapped
    /// lazily on the first `remember()` call. This avoids races when
    /// multiple processes concurrently start before any fact is
    /// written.
    pub async fn new(cfg: QdrantConfig, embedder: Arc<dyn Embedder>) -> Result<Self, MemoryError> {
        let handle = QdrantHandle::connect(&cfg)?;
        let long_term: Arc<dyn LongTermMemory> = Arc::new(QdrantLongTerm::new(handle, embedder));
        Ok(Self { long_term })
    }
}