pub struct PolicyMemoryStore<'a> { /* private fields */ }Expand description
Policy Memory Store interface for AI agent policy memory
This interface provides Q-learning state-action lookups, contextual bandit policy retrieval, and episodic memory for reasoning.
§Example
ⓘ
let policy_store = db.policy_memory();
policy_store.store_policy("state_a", vec![0.1, 0.2], PolicyAction { action: "move_left", reward: 0.8 })?;
let similar = policy_store.retrieve_similar_states(¤t_state_embedding, 5)?;Implementations§
Source§impl<'a> PolicyMemoryStore<'a>
impl<'a> PolicyMemoryStore<'a>
Sourcepub fn store_policy(
&self,
state_id: &str,
state_embedding: Vec<f32>,
action: &str,
reward: f64,
q_value: f64,
) -> Result<String>
pub fn store_policy( &self, state_id: &str, state_embedding: Vec<f32>, action: &str, reward: f64, q_value: f64, ) -> Result<String>
Store a policy entry (state-action pair)
Sourcepub fn retrieve_similar_states(
&self,
state_embedding: &[f32],
k: usize,
) -> Result<Vec<PolicyEntry>>
pub fn retrieve_similar_states( &self, state_embedding: &[f32], k: usize, ) -> Result<Vec<PolicyEntry>>
Retrieve similar states for policy lookup
Auto Trait Implementations§
impl<'a> Freeze for PolicyMemoryStore<'a>
impl<'a> !RefUnwindSafe for PolicyMemoryStore<'a>
impl<'a> Send for PolicyMemoryStore<'a>
impl<'a> Sync for PolicyMemoryStore<'a>
impl<'a> Unpin for PolicyMemoryStore<'a>
impl<'a> !UnwindSafe for PolicyMemoryStore<'a>
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