Functional core for managing in-progress episodes.
An episode tracks a sequence of observation-action steps organized into trajectories. Trajectory boundaries are detected when subgoal embedding similarity drops below a threshold.
Summary
Functions
Appends an observation-action step, inferring subgoal, reward, and state via LLM.
Builds a trajectory struct from a list of steps sharing the same trajectory_id.
Closes the episode, grouping steps into trajectory segments.
Creates a new open episode targeting the given goal.
Scores the reward for the last step using a sentinel next-observation. Call before close.
Types
Functions
@spec append(t(), String.t(), String.t(), keyword()) :: {:ok, t(), Mnemosyne.Notifier.Trace.Episode.t()} | {:error, Mnemosyne.Errors.error()}
Appends an observation-action step, inferring subgoal, reward, and state via LLM.
@spec build_trajectory_from_steps([step()]) :: trajectory()
Builds a trajectory struct from a list of steps sharing the same trajectory_id.
@spec close(t()) :: {:ok, t()} | {:error, Mnemosyne.Errors.Invalid.EpisodeError.t()}
Closes the episode, grouping steps into trajectory segments.
Creates a new open episode targeting the given goal.
@spec score_pending_reward( t(), keyword() ) :: {:ok, t()} | {:error, Mnemosyne.Errors.Invalid.EpisodeError.t()}
Scores the reward for the last step using a sentinel next-observation. Call before close.