pub struct PatternDetector { /* private fields */ }Expand description
Detects repeated tool call patterns in the agent’s execution history.
Implementations§
Source§impl PatternDetector
impl PatternDetector
Sourcepub fn new(config: AutogenConfig) -> Self
pub fn new(config: AutogenConfig) -> Self
Create a new pattern detector.
Sourcepub fn record_tool_call(&mut self, tool_name: &str)
pub fn record_tool_call(&mut self, tool_name: &str)
Record a tool call.
Sourcepub fn detect_candidates(&mut self) -> Vec<ToolCallPattern>
pub fn detect_candidates(&mut self) -> Vec<ToolCallPattern>
Check for patterns that have reached the threshold.
Returns newly detected patterns (patterns that just crossed the threshold and have not been reported before).
Sourcepub fn pattern_count(&self, pattern: &ToolCallPattern) -> usize
pub fn pattern_count(&self, pattern: &ToolCallPattern) -> usize
Get the count for a specific pattern.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether the detector is enabled.
Auto Trait Implementations§
impl Freeze for PatternDetector
impl RefUnwindSafe for PatternDetector
impl Send for PatternDetector
impl Sync for PatternDetector
impl Unpin for PatternDetector
impl UnsafeUnpin for PatternDetector
impl UnwindSafe for PatternDetector
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
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>
Converts
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>
Converts
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 more