Skip to main content

Module pruner

Module pruner 

Source
Expand description

Progressive Pruner Module

This module provides progressive pruning functionality for Tool outputs to manage context size while preserving important information.

§Pruning Strategies

  • Soft Trim: Preserves head and tail of content, replacing middle with “…”
  • Hard Clear: Completely replaces content with a placeholder

§Example

use aster::context::pruner::ProgressivePruner;
use aster::context::PruningConfig;

let config = PruningConfig::default();
let content = "Very long tool output...";

// Soft trim: keep head and tail
let trimmed = ProgressivePruner::soft_trim(content, 500, 300);

// Hard clear: replace with placeholder
let cleared = ProgressivePruner::hard_clear("[content cleared]");

Structs§

ProgressivePruner
Progressive pruner for Tool output management.