Skip to main content

HDF5Memory

Struct HDF5Memory 

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

Implementations§

Source§

impl HDF5Memory

Perform hybrid search combining cosine vector similarity and BM25 keyword search.

Source

pub fn get_chunk(&self, index: usize) -> Option<&str>

Get the chunk text for a memory entry by index.

Source

pub fn generate_agents_md(&self) -> String

Generate an AGENTS.md string from current memory state.

Source

pub fn write_agents_md(&self) -> Result<()>

Write AGENTS.md to disk alongside the .h5 file.

Source

pub fn read_agents_md(path: &Path) -> Result<String>

Read AGENTS.md from disk (if it exists).

Source§

impl HDF5Memory

Source

pub fn create(config: MemoryConfig) -> Result<Self>

Create a new HDF5 memory file with the given configuration.

Source

pub fn open(path: &Path) -> Result<Self>

Open an existing HDF5 memory file.

Source

pub fn config(&self) -> &MemoryConfig

Get a reference to the config.

Source

pub fn knowledge(&self) -> &KnowledgeCache

Get a reference to the knowledge cache.

Source

pub fn knowledge_mut(&mut self) -> &mut KnowledgeCache

Get a mutable reference to the knowledge cache.

Source

pub fn add_entity( &mut self, name: &str, entity_type: &str, embedding_idx: i64, ) -> Result<u64>

Add an entity to the knowledge graph and flush.

Source

pub fn add_entity_alias(&mut self, alias: &str, entity_id: i64) -> Result<()>

Add an alias for a knowledge graph entity and flush.

Source

pub fn add_relation( &mut self, src: u64, tgt: u64, relation: &str, weight: f32, ) -> Result<()>

Add a relation to the knowledge graph and flush.

Source§

impl HDF5Memory

Source

pub fn set_strategy(&mut self, s: Box<dyn MemoryStrategy>)

Source

pub fn record(&mut self, exchange: Exchange) -> Result<StrategyOutput>

Source§

impl HDF5Memory

Source

pub fn tick_session(&mut self) -> Result<()>

Source

pub fn wal_pending_count(&self) -> usize

Number of pending WAL entries (0 if WAL disabled).

Source

pub fn flush_wal(&mut self) -> Result<()>

Explicit WAL merge: flush .h5, truncate WAL.

Trait Implementations§

Source§

impl AgentMemory for HDF5Memory

Source§

fn save(&mut self, entry: MemoryEntry) -> Result<usize>

Source§

fn save_batch(&mut self, entries: Vec<MemoryEntry>) -> Result<Vec<usize>>

Source§

fn delete(&mut self, id: usize) -> Result<()>

Source§

fn compact(&mut self) -> Result<usize>

Source§

fn count(&self) -> usize

Source§

fn count_active(&self) -> usize

Source§

fn snapshot(&self, dest: &Path) -> Result<PathBuf>

Source§

fn add_session( &mut self, id: &str, start: usize, end: usize, channel: &str, summary: &str, ) -> Result<()>

Source§

fn get_session_summary(&self, session_id: &str) -> Result<Option<String>>

Source§

impl Debug for HDF5Memory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.