Skip to main content

TrajectoryTracker

Struct TrajectoryTracker 

Source
pub struct TrajectoryTracker {
    pub transitions: TransitionMap,
    /* private fields */
}

Fields§

§transitions: TransitionMap

Implementations§

Source§

impl TrajectoryTracker

Source

pub fn new(max_turns: usize) -> Self

Source

pub fn record_turn(&mut self, turn: TrajectoryNode)

Source

pub fn pending_canonicalization(&self, limit: usize) -> Vec<String>

Recent distinct topic labels that have no learned canonical mapping yet, most recent first. The async canonicalization pass uses this to decide which topics still need an LLM label, so the sync recording path stays fast and no LLM call ever happens per turn.

Source

pub fn known_topics(&self) -> Vec<String>

The set of learned canonical topic labels, for seeding LLM prompts so it reuses existing labels instead of inventing near-duplicates.

Source

pub fn learn_canonical(&mut self, raw: &str, canonical: &str)

Store a learned raw -> canonical mapping. Called by the async canonicalization pass after it gets labels from the LLM.

Source

pub async fn record_turn_with_llm<J: LlmJudge>( &mut self, turn: TrajectoryNode, llm: &CognitiveLlmService<J>, )

Record a turn with LLM-powered topic canonicalization.

Checks the learned topic cache first (no LLM call needed for known patterns). On cache miss, asks the LLM for a canonical label and stores it for future use. Falls back to the heuristic path on any LLM error.

Source

pub fn get_trajectory(&self) -> &[TrajectoryNode]

Source

pub fn get_resume_context(&self) -> Option<String>

Source

pub fn predict_next_topics(&self) -> Vec<String>

Source

pub fn reinforce_transition(&mut self, hit_topic: &str)

Called when the speculative cache gets a hit. Reinforces the transition from the previous topic to the hit topic.

Source

pub fn decay_transition(&mut self, predicted_topic: &str)

Called when the speculative cache misses. Slightly decays the transition from the previous topic to the predicted topic.

Trait Implementations§

Source§

impl Default for TrajectoryTracker

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.