pub struct LLMMessage {
pub role: MessageRole,
pub content: MessageContent,
pub metadata: HashMap<String, Value>,
pub timestamp: DateTime<Utc>,
}
Expand description
A message in an LLM conversation
Fields§
§role: MessageRole
Message role
content: MessageContent
Message content
metadata: HashMap<String, Value>
Optional message metadata
timestamp: DateTime<Utc>
Timestamp
Implementations§
Source§impl LLMMessage
impl LLMMessage
Sourcepub fn with_metadata(self, key: String, value: Value) -> Self
pub fn with_metadata(self, key: String, value: Value) -> Self
Add metadata to the message
Sourcepub fn get_metadata(&self, key: &str) -> Option<&Value>
pub fn get_metadata(&self, key: &str) -> Option<&Value>
Get metadata value
Trait Implementations§
Source§impl Clone for LLMMessage
impl Clone for LLMMessage
Source§fn clone(&self) -> LLMMessage
fn clone(&self) -> LLMMessage
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 LLMMessage
impl Debug for LLMMessage
Source§impl<'de> Deserialize<'de> for LLMMessage
impl<'de> Deserialize<'de> for LLMMessage
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 LLMMessage
impl RefUnwindSafe for LLMMessage
impl Send for LLMMessage
impl Sync for LLMMessage
impl Unpin for LLMMessage
impl UnwindSafe for LLMMessage
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