pub struct Conversation {
pub id: ConversationId,
pub title: String,
pub messages: Vec<ChatMessage>,
pub global_context: Vec<ContextItem>,
pub role: RoleName,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub metadata: AHashMap<String, String>,
}Expand description
A conversation containing multiple messages and context
Fields§
§id: ConversationIdUnique identifier for this conversation
title: StringHuman-readable title for the conversation
messages: Vec<ChatMessage>Messages in this conversation
global_context: Vec<ContextItem>Global context items for the entire conversation
role: RoleNameRole used for this conversation
created_at: DateTime<Utc>When this conversation was created
updated_at: DateTime<Utc>When this conversation was last updated
metadata: AHashMap<String, String>Metadata about the conversation
Implementations§
Source§impl Conversation
impl Conversation
Sourcepub fn add_message(&mut self, message: ChatMessage)
pub fn add_message(&mut self, message: ChatMessage)
Add a message to the conversation
Sourcepub fn add_global_context(&mut self, context: ContextItem)
pub fn add_global_context(&mut self, context: ContextItem)
Add global context to the conversation
Sourcepub fn estimated_context_length(&self) -> usize
pub fn estimated_context_length(&self) -> usize
Get the total context length (approximation)
Trait Implementations§
Source§impl Clone for Conversation
impl Clone for Conversation
Source§fn clone(&self) -> Conversation
fn clone(&self) -> Conversation
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 Conversation
impl Debug for Conversation
Source§impl<'de> Deserialize<'de> for Conversation
impl<'de> Deserialize<'de> for Conversation
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
Source§impl From<&Conversation> for ConversationSummary
impl From<&Conversation> for ConversationSummary
Source§fn from(conversation: &Conversation) -> Self
fn from(conversation: &Conversation) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Conversation
impl RefUnwindSafe for Conversation
impl Send for Conversation
impl Sync for Conversation
impl Unpin for Conversation
impl UnwindSafe for Conversation
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