pub struct GraphMemory { /* private fields */ }Expand description
High-level graph memory API - the main entry point for AINL memory.
Wraps a GraphStore implementation with a simplified 5-method API.
Implementations§
Source§impl GraphMemory
impl GraphMemory
Sourcepub fn new(db_path: &Path) -> Result<Self, String>
pub fn new(db_path: &Path) -> Result<Self, String>
Create a new graph memory at the given database path.
This will create the database file if it doesn’t exist, and ensure the AINL graph schema is initialized.
Sourcepub fn from_connection(conn: Connection) -> Result<Self, String>
pub fn from_connection(conn: Connection) -> Result<Self, String>
Create from an existing SQLite connection (for integration with existing memory pools)
Sourcepub fn write_episode(
&self,
tool_calls: Vec<String>,
delegation_to: Option<String>,
trace_event: Option<Value>,
) -> Result<Uuid, String>
pub fn write_episode( &self, tool_calls: Vec<String>, delegation_to: Option<String>, trace_event: Option<Value>, ) -> Result<Uuid, String>
Sourcepub fn write_fact(
&self,
fact: String,
confidence: f32,
source_turn_id: Uuid,
) -> Result<Uuid, String>
pub fn write_fact( &self, fact: String, confidence: f32, source_turn_id: Uuid, ) -> Result<Uuid, String>
Sourcepub fn store_pattern(
&self,
pattern_name: String,
compiled_graph: Vec<u8>,
) -> Result<Uuid, String>
pub fn store_pattern( &self, pattern_name: String, compiled_graph: Vec<u8>, ) -> Result<Uuid, String>
Sourcepub fn recall_recent(
&self,
seconds_ago: i64,
) -> Result<Vec<AinlMemoryNode>, String>
pub fn recall_recent( &self, seconds_ago: i64, ) -> Result<Vec<AinlMemoryNode>, String>
Sourcepub fn store(&self) -> &dyn GraphStore
pub fn store(&self) -> &dyn GraphStore
Get direct access to the underlying store for advanced queries
Auto Trait Implementations§
impl !Freeze for GraphMemory
impl !RefUnwindSafe for GraphMemory
impl Send for GraphMemory
impl !Sync for GraphMemory
impl Unpin for GraphMemory
impl UnsafeUnpin for GraphMemory
impl !UnwindSafe for GraphMemory
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