pub struct SimpleConversationManager { /* private fields */ }Expand description
Simple count-based conversation manager
Keeps the last N messages in the context. May fail if N messages exceed the context window or if individual messages are very large.
Use this when you want predictable message counts rather than token-based management.
§Example
use mixtape_core::conversation::SimpleConversationManager;
// Keep last 50 messages
let manager = SimpleConversationManager::new(50);Implementations§
Trait Implementations§
Source§impl Clone for SimpleConversationManager
impl Clone for SimpleConversationManager
Source§fn clone(&self) -> SimpleConversationManager
fn clone(&self) -> SimpleConversationManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ConversationManager for SimpleConversationManager
impl ConversationManager for SimpleConversationManager
Source§fn add_message(&mut self, message: Message)
fn add_message(&mut self, message: Message)
Add a message to the conversation history
Source§fn messages_for_context(
&self,
_limits: ContextLimits,
_estimate_tokens: TokenEstimator<'_>,
) -> Vec<Message>
fn messages_for_context( &self, _limits: ContextLimits, _estimate_tokens: TokenEstimator<'_>, ) -> Vec<Message>
Get messages to send to the model (may be a subset of all messages) Read more
Source§fn all_messages(&self) -> &[Message]
fn all_messages(&self) -> &[Message]
Get all messages in the conversation (full history)
Source§fn hydrate(&mut self, messages: Vec<Message>)
fn hydrate(&mut self, messages: Vec<Message>)
Restore conversation state from persisted messages
Source§fn context_usage(
&self,
limits: ContextLimits,
estimate_tokens: TokenEstimator<'_>,
) -> ContextUsage
fn context_usage( &self, limits: ContextLimits, estimate_tokens: TokenEstimator<'_>, ) -> ContextUsage
Get context usage statistics
Auto Trait Implementations§
impl Freeze for SimpleConversationManager
impl RefUnwindSafe for SimpleConversationManager
impl Send for SimpleConversationManager
impl Sync for SimpleConversationManager
impl Unpin for SimpleConversationManager
impl UnwindSafe for SimpleConversationManager
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