pub struct SqliteMemory<E: Embedder> { /* private fields */ }Expand description
SQLite-backed memory store with optional embedding support.
Wraps a rusqlite::Connection in a Mutex for thread safety.
Generic over E: Embedder for optional vector search.
Implementations§
Source§impl<E: Embedder> SqliteMemory<E>
impl<E: Embedder> SqliteMemory<E>
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open or create a SQLite database at the given path.
Sourcepub fn with_embedder(self, embedder: E) -> Self
pub fn with_embedder(self, embedder: E) -> Self
Attach an embedder for vector search.
Sourcepub fn store_with_metadata(
&self,
key: &str,
value: &str,
metadata: Option<&Value>,
embedding: Option<&[f32]>,
) -> Result<()>
pub fn store_with_metadata( &self, key: &str, value: &str, metadata: Option<&Value>, embedding: Option<&[f32]>, ) -> Result<()>
Store a key-value pair with optional metadata and embedding.
Sourcepub fn get_entry(&self, key: &str) -> Option<MemoryEntry>
pub fn get_entry(&self, key: &str) -> Option<MemoryEntry>
Get a full MemoryEntry for a key.
Trait Implementations§
Source§impl<E: Embedder> Memory for SqliteMemory<E>
impl<E: Embedder> Memory for SqliteMemory<E>
Source§fn set(
&self,
key: impl Into<String>,
value: impl Into<String>,
) -> Option<String>
fn set( &self, key: impl Into<String>, value: impl Into<String>, ) -> Option<String>
Set (upsert) a key-value pair. Returns the previous value if the key existed.
Source§fn remove(&self, key: &str) -> Option<String>
fn remove(&self, key: &str) -> Option<String>
Remove a key. Returns the removed value if it existed.
Source§fn store(
&self,
key: impl Into<String> + Send,
value: impl Into<String> + Send,
) -> impl Future<Output = Result<()>> + Send
fn store( &self, key: impl Into<String> + Send, value: impl Into<String> + Send, ) -> impl Future<Output = Result<()>> + Send
Store a key-value pair (async). Default delegates to
set.Source§fn recall(
&self,
query: &str,
options: RecallOptions,
) -> impl Future<Output = Result<Vec<MemoryEntry>>> + Send
fn recall( &self, query: &str, options: RecallOptions, ) -> impl Future<Output = Result<Vec<MemoryEntry>>> + Send
Search for relevant entries (async). Default returns empty.
Auto Trait Implementations§
impl<E> !Freeze for SqliteMemory<E>
impl<E> RefUnwindSafe for SqliteMemory<E>where
E: RefUnwindSafe,
impl<E> Send for SqliteMemory<E>
impl<E> Sync for SqliteMemory<E>
impl<E> Unpin for SqliteMemory<E>where
E: Unpin,
impl<E> UnsafeUnpin for SqliteMemory<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for SqliteMemory<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more