Skip to main content

reduce_history

Function reduce_history 

Source
pub async fn reduce_history(
    messages: Vec<Message>,
    declared: &ContextStrategy,
    model: &str,
    context_limit: usize,
    driver: Option<&dyn LlmDriver>,
) -> Result<(Vec<Message>, ReduceReport), ReduceHistoryError>
Expand description

Reduce a run’s history once: lossless validation, structural stage, token budget, then protected-group verification, with the system message pinned.

messages is the full list including the system message at index 0 when one is present. The returned list is what the provider receives.