Skip to main content

context_window_trigger

Function context_window_trigger 

Source
pub fn context_window_trigger(window: u64, percent: u32) -> TriggerFn
Expand description

Build a trigger closure that fires when the most recent transcript item’s reported usage.tokens.input_tokens reaches window * percent / 100.

Only fires at MutationPoint::AfterTurnEnded; other points return None. percent is clamped to 1..=100.

Plug into StrategyCompactorBuilder::trigger (or use it directly as a TriggerFn).