pub struct CausalMemory { /* private fields */ }Expand description
Causal hypergraph memory for agent reasoning
Implementations§
Source§impl CausalMemory
impl CausalMemory
Sourcepub fn new(distance_metric: DistanceMetric) -> Self
pub fn new(distance_metric: DistanceMetric) -> Self
Create a new causal memory with default utility weights
Sourcepub fn with_weights(self, alpha: f32, beta: f32, gamma: f32) -> Self
pub fn with_weights(self, alpha: f32, beta: f32, gamma: f32) -> Self
Set custom utility function weights
Sourcepub fn add_causal_edge(
&mut self,
cause: VectorId,
effect: VectorId,
context: Vec<VectorId>,
description: String,
embedding: Vec<f32>,
latency_ms: f32,
) -> Result<()>
pub fn add_causal_edge( &mut self, cause: VectorId, effect: VectorId, context: Vec<VectorId>, description: String, embedding: Vec<f32>, latency_ms: f32, ) -> Result<()>
Add a causal relationship
Sourcepub fn query_with_utility(
&self,
query_embedding: &[f32],
action_id: VectorId,
k: usize,
) -> Vec<(String, f32)>
pub fn query_with_utility( &self, query_embedding: &[f32], action_id: VectorId, k: usize, ) -> Vec<(String, f32)>
Query with utility function: U = α·similarity + β·causal_uplift - γ·latency
Sourcepub fn index(&self) -> &HypergraphIndex
pub fn index(&self) -> &HypergraphIndex
Get hypergraph index
Auto Trait Implementations§
impl Freeze for CausalMemory
impl RefUnwindSafe for CausalMemory
impl Send for CausalMemory
impl Sync for CausalMemory
impl Unpin for CausalMemory
impl UnwindSafe for CausalMemory
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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