pub struct LLMMessage {
pub role: MessageRole,
pub content: String,
pub tool_calls: Option<Vec<ToolCall>>,
pub tool_call_id: Option<String>,
pub name: Option<String>,
}Expand description
LLM conversation message format
Fields§
§role: MessageRoleMessage role
content: StringMessage content
tool_calls: Option<Vec<ToolCall>>Tool calls (if any)
tool_call_id: Option<String>Tool call ID (for tool role)
name: Option<String>Function name (for tool role)
Implementations§
Source§impl LLMMessage
impl LLMMessage
pub fn system(content: impl Into<String>) -> Self
pub fn user(content: impl Into<String>) -> Self
pub fn assistant(content: impl Into<String>) -> Self
pub fn assistant_with_tools(tool_calls: Vec<ToolCall>) -> Self
pub fn tool( tool_call_id: String, name: String, content: impl Into<String>, ) -> Self
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 UnsafeUnpin 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