pub struct LocalSummarizer { /* private fields */ }Expand description
Summarizer for context compression
Implementations§
Source§impl LocalSummarizer
impl LocalSummarizer
Sourcepub fn new(provider: Arc<dyn Provider>, model_id: impl Into<String>) -> Self
pub fn new(provider: Arc<dyn Provider>, model_id: impl Into<String>) -> Self
Create a new summarizer
Sourcepub fn with_max_summary_tokens(self, tokens: u32) -> Self
pub fn with_max_summary_tokens(self, tokens: u32) -> Self
Set maximum summary tokens
Sourcepub fn with_max_facts(self, facts: usize) -> Self
pub fn with_max_facts(self, facts: usize) -> Self
Set maximum facts to extract
Sourcepub async fn summarize_message(
&self,
content: &str,
role: &str,
) -> Option<SummarizationResult>
pub async fn summarize_message( &self, content: &str, role: &str, ) -> Option<SummarizationResult>
Summarize a message for warm tier storage
Generates a 50-100 word summary suitable for the warm memory tier.
Sourcepub async fn extract_facts(&self, summary: &str) -> Option<Vec<ExtractedFact>>
pub async fn extract_facts(&self, summary: &str) -> Option<Vec<ExtractedFact>>
Extract key facts from a summary for cold tier storage
Parses structured facts from content for ultra-compressed archival.
Sourcepub async fn compact_conversation(
&self,
messages: &[(String, String)],
keep_recent: usize,
) -> Option<String>
pub async fn compact_conversation( &self, messages: &[(String, String)], keep_recent: usize, ) -> Option<String>
Compact a conversation for emergency context reduction
Used when token count exceeds threshold (e.g., 80k tokens).
Sourcepub fn summarize_heuristic(&self, content: &str) -> SummarizationResult
pub fn summarize_heuristic(&self, content: &str) -> SummarizationResult
Heuristic summarization (no LLM)
Sourcepub fn extract_entities(&self, content: &str) -> Vec<String>
pub fn extract_entities(&self, content: &str) -> Vec<String>
Extract entities from content for summary metadata
Auto Trait Implementations§
impl Freeze for LocalSummarizer
impl !RefUnwindSafe for LocalSummarizer
impl Send for LocalSummarizer
impl Sync for LocalSummarizer
impl Unpin for LocalSummarizer
impl UnsafeUnpin for LocalSummarizer
impl !UnwindSafe for LocalSummarizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more