Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore { /* private fields */ }

Implementations§

Source§

impl MemoryStore

Source

pub fn conn(&self) -> &Connection

Source

pub fn open<P: AsRef<Path>>(path: P) -> SqlResult<Self>

Source

pub fn open_in_memory() -> SqlResult<Self>

Source

pub fn remember_fact( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, ) -> SqlResult<i64>

Source

pub fn remember_fact_with_tags( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], ) -> SqlResult<i64>

Source

pub fn remember_fact_full( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>

Source

pub fn remember_fact_ns( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>

Source

pub fn upsert_fact( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<(i64, bool)>

Upsert a fact: if a fact with the same subject+relation exists in the same namespace, update its object (and embedding/tags). Otherwise insert a new fact. Returns (id, was_updated).

Source

pub fn upsert_fact_ns( &self, subject: &str, relation: &str, object: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<(i64, bool)>

Source

pub fn remember_episode( &self, text: &str, embedding: Option<&[f32]>, ) -> SqlResult<i64>

Source

pub fn remember_episode_with_tags( &self, text: &str, embedding: Option<&[f32]>, tags: &[String], ) -> SqlResult<i64>

Source

pub fn remember_episode_full( &self, text: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>

Source

pub fn remember_episode_ns( &self, text: &str, embedding: Option<&[f32]>, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>

Source

pub fn all_memories_with_text(&self) -> SqlResult<Vec<(MemoryRecord, String)>>

Source

pub fn all_memories_with_text_ns( &self, namespace: &str, ) -> SqlResult<Vec<(MemoryRecord, String)>>

Source

pub fn all_memories_with_text_filtered_by_tag( &self, tag: &str, ) -> SqlResult<Vec<(MemoryRecord, String)>>

Source

pub fn all_memories_with_text_filtered_by_tag_ns( &self, tag: &str, namespace: &str, ) -> SqlResult<Vec<(MemoryRecord, String)>>

Source

pub fn touch_memory_with_strength( &self, id: i64, strength: f64, now: DateTime<Utc>, ) -> SqlResult<()>

Source

pub fn get_memory(&self, id: i64) -> SqlResult<Option<MemoryRecord>>

Source

pub fn decay_all( &self, decay_factor: f64, half_life_hours: f64, ) -> SqlResult<usize>

Source

pub fn decay_all_ns( &self, decay_factor: f64, half_life_hours: f64, namespace: &str, ) -> SqlResult<usize>

Source

pub fn forget_by_subject(&self, subject: &str) -> SqlResult<usize>

Source

pub fn forget_by_subject_ns( &self, subject: &str, namespace: &str, ) -> SqlResult<usize>

Source

pub fn forget_by_id(&self, id: &str) -> SqlResult<usize>

Source

pub fn forget_older_than(&self, duration: Duration) -> SqlResult<usize>

Source

pub fn forget_older_than_ns( &self, duration: Duration, namespace: &str, ) -> SqlResult<usize>

Source

pub fn memories_missing_embeddings(&self) -> SqlResult<Vec<MemoryRecord>>

Source

pub fn update_embedding(&self, id: i64, embedding: &[f32]) -> SqlResult<()>

Source

pub fn all_memories(&self) -> SqlResult<Vec<MemoryRecord>>

Source

pub fn all_memories_ns(&self, namespace: &str) -> SqlResult<Vec<MemoryRecord>>

Source

pub fn import_fact( &self, subject: &str, relation: &str, object: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>

Source

pub fn import_fact_ns( &self, subject: &str, relation: &str, object: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>

Source

pub fn import_episode( &self, text: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, ) -> SqlResult<i64>

Source

pub fn import_episode_ns( &self, text: &str, strength: f64, embedding: Option<&[f32]>, created_at: &str, last_accessed_at: &str, access_count: i64, tags: &[String], source: Option<&str>, session_id: Option<&str>, channel: Option<&str>, namespace: &str, ) -> SqlResult<i64>

Source

pub fn update_tags(&self, id: i64, tags: &[String]) -> SqlResult<()>

Update tags on an existing memory.

Source

pub fn update_importance(&self, id: i64, importance: f64) -> SqlResult<()>

Update the importance score of a memory.

Source

pub fn archive_memory(&self, id: i64) -> SqlResult<()>

Set strength to zero (archive) for a memory.

Source

pub fn delete_memory(&self, id: i64) -> SqlResult<()>

Delete a memory by numeric ID.

Source

pub fn all_embeddings(&self) -> SqlResult<Vec<(i64, Vec<f32>)>>

Fetch all memory IDs with their embeddings for dedup similarity checks.

Source

pub fn all_embeddings_ns( &self, namespace: &str, ) -> SqlResult<Vec<(i64, Vec<f32>)>>

Source

pub fn reinforce_memory(&self, id: i64, boost: f64) -> SqlResult<()>

Reinforce an existing memory’s strength (clamped to 1.0) and bump access count.

Source

pub fn facts_involving(&self, entity: &str) -> SqlResult<Vec<MemoryRecord>>

Find all facts where the given entity appears as subject OR object.

Source

pub fn stats(&self) -> SqlResult<MemoryStats>

Source

pub fn stats_ns(&self, namespace: &str) -> SqlResult<MemoryStats>

Source

pub fn log_audit( &self, action: &str, memory_id: Option<i64>, actor: &str, details_json: Option<&str>, ) -> SqlResult<()>

Source

pub fn get_audit_log( &self, limit: usize, memory_id: Option<i64>, actor: Option<&str>, ) -> SqlResult<Vec<AuditEntry>>

Source

pub fn verify_integrity(&self) -> SqlResult<VerifyResult>

Source

pub fn verify_integrity_ns(&self, namespace: &str) -> SqlResult<VerifyResult>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V