pub struct ConversationContextCache { /* private fields */ }Expand description
Conversation context cache
Implementations§
Source§impl ConversationContextCache
impl ConversationContextCache
Sourcepub fn get_context(&self, conv_id: &str, max_turns: usize) -> Option<Vec<Turn>>
pub fn get_context(&self, conv_id: &str, max_turns: usize) -> Option<Vec<Turn>>
Get context for a conversation
Sourcepub fn append_turn(&self, conv_id: &str, turn: Turn)
pub fn append_turn(&self, conv_id: &str, turn: Turn)
Append a turn to a conversation
Sourcepub fn clear_conversation(&self, conv_id: &str)
pub fn clear_conversation(&self, conv_id: &str)
Clear a conversation
Sourcepub fn conversation_count(&self) -> usize
pub fn conversation_count(&self) -> usize
Get conversation count
Sourcepub fn total_tokens(&self) -> usize
pub fn total_tokens(&self) -> usize
Get total tokens cached
Sourcepub fn stats(&self) -> ConversationCacheStats
pub fn stats(&self) -> ConversationCacheStats
Get stats
Auto Trait Implementations§
impl !Freeze for ConversationContextCache
impl !RefUnwindSafe for ConversationContextCache
impl Send for ConversationContextCache
impl Sync for ConversationContextCache
impl Unpin for ConversationContextCache
impl UnsafeUnpin for ConversationContextCache
impl UnwindSafe for ConversationContextCache
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