pub struct LoopDetectionSimCase {
pub n_steps: usize,
pub looping_tool: String,
pub loop_starts_at: usize,
pub window_size: usize,
pub expect_detection: bool,
/* private fields */
}Expand description
Simulates a sequence of tool calls and checks that the loop detection algorithm fires at the expected iteration.
Models the exact VecDeque-based sliding-window logic used in
TaskAgent::execute(): when the last window_size tool calls all share the
same name, a loop is detected.
Fields§
§n_steps: usizeTotal number of simulated tool-call steps.
looping_tool: StringName of the tool that will be repeated to trigger the loop.
loop_starts_at: usizeAt which step the looping tool starts repeating (1-based).
window_size: usizeWindow size used by the loop detector. Default: 5.
expect_detection: boolWhether the test expects detection to fire (true = a loop IS expected).
Implementations§
Source§impl LoopDetectionSimCase
impl LoopDetectionSimCase
Sourcepub fn should_detect(
n_steps: usize,
looping_tool: impl Into<String>,
loop_starts_at: usize,
window_size: usize,
) -> Self
pub fn should_detect( n_steps: usize, looping_tool: impl Into<String>, loop_starts_at: usize, window_size: usize, ) -> Self
Create a scenario that expects the loop detector to fire.
The looping tool repeats from loop_starts_at to the end of the
n_steps sequence.
Sourcepub fn should_not_detect(n_steps: usize, window_size: usize) -> Self
pub fn should_not_detect(n_steps: usize, window_size: usize) -> Self
Create a scenario that expects the loop detector NOT to fire (diverse enough tool sequence).
Trait Implementations§
Source§impl Clone for LoopDetectionSimCase
impl Clone for LoopDetectionSimCase
Source§fn clone(&self) -> LoopDetectionSimCase
fn clone(&self) -> LoopDetectionSimCase
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more