pub trait Summarizer: Send + Sync {
// Required method
fn summarize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prior_summary: &'life1 str,
transcript: &'life2 [LlmMessage],
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Produces a textual summary of a transcript chunk that’s about to be
dropped from the prompt window. Implementations can be deterministic
(the StubSummarizer) or LLM-backed (a follow-up).
Used by the control plane’s anchored iterative summarization pass:
when the replayed history exceeds crate::SUMMARY_TRIGGER, the
summarizer compresses the oldest segment and the result is persisted as
a summary event in the conversation’s event log (durable, replayable).
Subsequent connects find the latest summary event and skip events at-or-
before its covered position, so the prompt is bounded indefinitely. The
“anchored” part means new summaries merge into the persistent state —
the next summarizer call sees the prior summary as context, keeping
detail across compactions rather than re-summarizing from scratch (per
Factory’s evaluation across 36k engineering session messages).
Required Methods§
Sourcefn summarize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prior_summary: &'life1 str,
transcript: &'life2 [LlmMessage],
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn summarize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prior_summary: &'life1 str,
transcript: &'life2 [LlmMessage],
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Summarize transcript (the about-to-be-dropped chunk), in the
context of prior_summary (the persistent state from earlier
compactions, empty on first compaction). Returns the new summary
text that replaces prior_summary going forward.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".