Skip to main content

Summarizer

Trait Summarizer 

Source
pub trait Summarizer {
    // Required method
    fn summarize(
        &self,
        full_output: &str,
        metadata: Option<&Value>,
    ) -> Result<String>;

    // Provided method
    fn estimate_savings(
        &self,
        full_output: &str,
        summary: &str,
    ) -> (usize, usize, f32) { ... }
}
Expand description

Trait for tool result summarization strategies

Each tool type implements its own summarization logic to convert full output into concise LLM context

Required Methods§

Source

fn summarize( &self, full_output: &str, metadata: Option<&Value>, ) -> Result<String>

Summarize full output into concise LLM content

§Arguments
  • full_output - The complete tool output (for UI)
  • metadata - Optional metadata about the operation
§Returns

Concise summary optimized for LLM context (target: <100 tokens)

Provided Methods§

Source

fn estimate_savings( &self, full_output: &str, summary: &str, ) -> (usize, usize, f32)

Estimate token savings from summarization

Returns (llm_tokens, ui_tokens, savings_percent)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§