pub struct RpeRouter {
pub threshold: f32,
pub max_skip_turns: u32,
/* private fields */
}Expand description
Stateful RPE router. Tracks recent embeddings and entity history.
Protected by the caller’s synchronization (typically held behind Arc<Mutex<...>>
at the SemanticMemory layer).
Fields§
§threshold: f32RPE below this value → skip extraction. Range: [0.0, 1.0].
max_skip_turns: u32Force extraction after this many consecutive skips. Default: 5.
Implementations§
Source§impl RpeRouter
impl RpeRouter
pub fn new(threshold: f32, max_skip_turns: u32) -> Self
Sourcepub fn push_embedding(&mut self, embedding: Vec<f32>)
pub fn push_embedding(&mut self, embedding: Vec<f32>)
Record a turn embedding. Called even when extraction is skipped, so context similarity remains up-to-date for the next turn.
Sourcepub fn push_entities(&mut self, names: &[String])
pub fn push_entities(&mut self, names: &[String])
Record entity names extracted (or candidate names from text) for novelty tracking.
Sourcepub fn compute(
&mut self,
turn_embedding: &[f32],
candidate_entities: &[String],
) -> RpeSignal
pub fn compute( &mut self, turn_embedding: &[f32], candidate_entities: &[String], ) -> RpeSignal
Compute the RPE signal for the current turn.
turn_embedding — embedding of the current message.
candidate_entities — entity names extracted from the current message text (may be empty).
Returns the RPE signal. When recent_embeddings is empty (cold start), returns
rpe_score = 1.0 and should_extract = true.
Auto Trait Implementations§
impl Freeze for RpeRouter
impl RefUnwindSafe for RpeRouter
impl Send for RpeRouter
impl Sync for RpeRouter
impl Unpin for RpeRouter
impl UnsafeUnpin for RpeRouter
impl UnwindSafe for RpeRouter
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
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request