pub struct ExperimentMemory { /* private fields */ }Expand description
In-memory store of ExperimentRecords supporting cosine-similarity
nearest-neighbour search (ADR-260 §11–§12).
All searches are linear scans over stored embeddings (exact NN). This is appropriate for experiment-scale datasets (<10 k entries); swap for HNSW when larger.
Implementations§
Source§impl ExperimentMemory
impl ExperimentMemory
Sourcepub fn remember(&mut self, record: ExperimentRecord)
pub fn remember(&mut self, record: ExperimentRecord)
Sourcepub fn nearest(&self, query_embedding: &[f32], limit: usize) -> Vec<NearestHit>
pub fn nearest(&self, query_embedding: &[f32], limit: usize) -> Vec<NearestHit>
Return up to limit stored experiments sorted by descending cosine
similarity to query_embedding.
Sourcepub fn by_label(&self, label: &str) -> Vec<&ExperimentRecord>
pub fn by_label(&self, label: &str) -> Vec<&ExperimentRecord>
Return all records with the given label.
Sourcepub fn records(&self) -> &[ExperimentRecord]
pub fn records(&self) -> &[ExperimentRecord]
Iterate over all stored records.
Sourcepub fn get(&self, id: &str) -> Option<&ExperimentRecord>
pub fn get(&self, id: &str) -> Option<&ExperimentRecord>
Look up a record by its exact id.
Trait Implementations§
Source§impl Debug for ExperimentMemory
impl Debug for ExperimentMemory
Auto Trait Implementations§
impl Forget for ExperimentMemory
impl Freeze for ExperimentMemory
impl Move for ExperimentMemory
impl RefUnwindSafe for ExperimentMemory
impl Send for ExperimentMemory
impl Sync for ExperimentMemory
impl Unpin for ExperimentMemory
impl UnsafeUnpin for ExperimentMemory
impl UnwindSafe for ExperimentMemory
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