Skip to main content

FileKnowledgeBase

Struct FileKnowledgeBase 

Source
pub struct FileKnowledgeBase { /* private fields */ }
Expand description

JSONL-backed KnowledgeBase (one ExperimentRecord per line).

Default location: .soma/experiments.jsonl.

Implementations§

Source§

impl FileKnowledgeBase

Source

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

Open (or create) the knowledge base at path, loading every parseable line. A corrupt trailing line — the signature of a crash mid-append — is skipped with a warning; a corrupt line in the middle of the file is an error.

Source

pub fn path(&self) -> &Path

Path of the backing JSONL file.

Trait Implementations§

Source§

impl KnowledgeBase for FileKnowledgeBase

Source§

fn record(&mut self, experiment: ExperimentRecord) -> Result<()>

Store a new experiment record.
Source§

fn all(&self) -> Result<Vec<ExperimentRecord>>

Every record this base holds, in insertion order.
Source§

fn get(&self, id: &str) -> Result<Option<ExperimentRecord>>

Get an experiment by ID.
Source§

fn len(&self) -> usize

Total number of experiments.
Source§

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

Pick up records another process appended since this handle was opened. Returns how many were newly loaded. Read more
Source§

fn is_empty(&self) -> bool

Whether the base holds no records at all.
Source§

fn search( &self, query: &str, max_results: usize, ) -> Result<Vec<ExperimentRecord>>

Substring search over name, hypothesis, notes, tags and pipeline. Read more
Source§

fn retrieve(&self, query: &RetrievalQuery) -> Result<Vec<ScoredRecord>>

Rank records against a query by relevance, structure, recency and importance. See crate::retrieval for the formula.
Source§

fn lineage(&self, id: &str) -> Result<Option<Lineage>>

An experiment with its ancestors and descendants.
Source§

fn experiments_in_line(&self, line: &str) -> Result<Vec<ExperimentRecord>>

List experiments in a research line, ordered chronologically.
Source§

fn research_lines(&self) -> Result<Vec<ResearchLine>>

Get all research lines with trend analysis.
Source§

fn promising_lines(&self, metric: &str) -> Result<Vec<ResearchLine>>

Find promising research lines (improving trend, high metric values).
Source§

fn trajectory(&self, line: &str, metric: &str) -> Result<Vec<(String, f64)>>

Get the metric trajectory for a research line.
Source§

fn change_points( &self, line: &str, metric: &str, threshold: f64, ) -> Result<Vec<ChangePoint>>

Detect change points where metrics shifted significantly.
Source§

fn children(&self, experiment_id: &str) -> Result<Vec<ExperimentRecord>>

Direct children of an experiment.

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
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

The receiver as &dyn Any, ready for downcast_ref.
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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more