pub struct ConversationSummarizer;Expand description
Builds context strings suitable for injection into an agent’s system prompt.
Implementations§
Source§impl ConversationSummarizer
impl ConversationSummarizer
Sourcepub async fn build_context(
memory: &ConversationMemory,
customer_id: &str,
max_tokens: usize,
) -> String
pub async fn build_context( memory: &ConversationMemory, customer_id: &str, max_tokens: usize, ) -> String
Build a context string for agent injection, respecting an approximate token limit.
The output looks like:
[Customer History]
Customer: cust_123
Sessions: 3 | Turns: 15 | Since: 2025-01-15
Topics: billing, DeFi, staking
Sentiment: positive
Last 5 interactions:
- user: How do I stake ETH?
- assistant: You can stake ETH via ...max_tokens is an approximate character budget (1 token ~ 4 chars).
Auto Trait Implementations§
impl Freeze for ConversationSummarizer
impl RefUnwindSafe for ConversationSummarizer
impl Send for ConversationSummarizer
impl Sync for ConversationSummarizer
impl Unpin for ConversationSummarizer
impl UnsafeUnpin for ConversationSummarizer
impl UnwindSafe for ConversationSummarizer
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