pub struct ConversationSummarizer { /* private fields */ }Expand description
Conversation summarizer that generates summaries using an LLM
Implementations§
Source§impl ConversationSummarizer
impl ConversationSummarizer
Sourcepub fn new(provider: Box<dyn Provider>, config: SummarizationConfig) -> Self
pub fn new(provider: Box<dyn Provider>, config: SummarizationConfig) -> Self
Create a new conversation summarizer
Sourcepub async fn summarize(
&self,
session_id: &str,
messages: Vec<Message>,
) -> Result<ConversationSummary, SummarizationError>
pub async fn summarize( &self, session_id: &str, messages: Vec<Message>, ) -> Result<ConversationSummary, SummarizationError>
Summarize a conversation from messages
Sourcepub fn config(&self) -> &SummarizationConfig
pub fn config(&self) -> &SummarizationConfig
Get the configuration
Sourcepub async fn is_available(&self) -> bool
pub async fn is_available(&self) -> bool
Check if the summarizer is available
Sourcepub fn estimate_message_tokens(&self, messages: &[Message]) -> u32
pub fn estimate_message_tokens(&self, messages: &[Message]) -> u32
Estimate the token count for a set of messages
Sourcepub fn validate_messages(
&self,
messages: &[Message],
) -> Result<(), SummarizationError>
pub fn validate_messages( &self, messages: &[Message], ) -> Result<(), SummarizationError>
Validate that the messages can be summarized
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more