pub struct ConversationSession {
pub id: String,
pub metadata: SessionMetadata,
pub messages: Vec<LLMMessage>,
pub context_strategy: ContextStrategy,
pub created_at: DateTime<Utc>,
pub last_activity: DateTime<Utc>,
pub status: SessionStatus,
}
Expand description
A conversation session with history and metadata
Fields§
§id: String
Unique session identifier
metadata: SessionMetadata
Session metadata
messages: Vec<LLMMessage>
Conversation messages
context_strategy: ContextStrategy
Context management strategy
created_at: DateTime<Utc>
Session creation time
last_activity: DateTime<Utc>
Last activity time
status: SessionStatus
Session status
Implementations§
Source§impl ConversationSession
impl ConversationSession
Sourcepub fn new(metadata: SessionMetadata, context_strategy: ContextStrategy) -> Self
pub fn new(metadata: SessionMetadata, context_strategy: ContextStrategy) -> Self
Create a new conversation session
Sourcepub fn add_message(&mut self, message: LLMMessage)
pub fn add_message(&mut self, message: LLMMessage)
Add a message to the session
Sourcepub fn get_active_messages(&self) -> Vec<LLMMessage>
pub fn get_active_messages(&self) -> Vec<LLMMessage>
Get active messages based on context strategy
Sourcepub fn is_expired(&self, timeout_seconds: u64) -> bool
pub fn is_expired(&self, timeout_seconds: u64) -> bool
Check if session has expired
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get message count
Trait Implementations§
Source§impl Clone for ConversationSession
impl Clone for ConversationSession
Source§fn clone(&self) -> ConversationSession
fn clone(&self) -> ConversationSession
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 Debug for ConversationSession
impl Debug for ConversationSession
Source§impl<'de> Deserialize<'de> for ConversationSession
impl<'de> Deserialize<'de> for ConversationSession
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConversationSession
impl RefUnwindSafe for ConversationSession
impl Send for ConversationSession
impl Sync for ConversationSession
impl Unpin for ConversationSession
impl UnwindSafe for ConversationSession
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