pub struct AnomalyDetector { /* private fields */ }Expand description
Tracks recent tool execution outcomes and detects anomalous patterns.
Implementations§
Source§impl AnomalyDetector
impl AnomalyDetector
pub fn new( window_size: usize, error_threshold: f64, critical_threshold: f64, ) -> Self
Sourcepub fn record_success(&mut self)
pub fn record_success(&mut self)
Record a successful tool execution.
Sourcepub fn record_error(&mut self)
pub fn record_error(&mut self)
Record a failed tool execution.
Sourcepub fn record_blocked(&mut self)
pub fn record_blocked(&mut self)
Record a blocked tool execution.
Sourcepub fn record_reasoning_quality_failure(
&mut self,
model_name: &str,
tool_name: &str,
)
pub fn record_reasoning_quality_failure( &mut self, model_name: &str, tool_name: &str, )
Record a quality failure (ToolNotFound, InvalidParameters, TypeMismatch) that
originated from a reasoning-enhanced model. Counts as an error for anomaly
detection purposes and logs a reasoning_amplification warning.
Per arXiv:2510.22977, reasoning models amplify tool hallucinations — this method makes such failures visible in the anomaly window.
Trait Implementations§
Source§impl Debug for AnomalyDetector
impl Debug for AnomalyDetector
Auto Trait Implementations§
impl Freeze for AnomalyDetector
impl RefUnwindSafe for AnomalyDetector
impl Send for AnomalyDetector
impl Sync for AnomalyDetector
impl Unpin for AnomalyDetector
impl UnsafeUnpin for AnomalyDetector
impl UnwindSafe for AnomalyDetector
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