pub enum ChatCompletionRequestMessage {
System(ChatCompletionSystemMessage),
User(ChatCompletionUserMessage),
Assistant(ChatCompletionAssistantMessage),
Tool(ChatCompletionToolMessage),
}Expand description
Message for comprising the conversation.
Variants§
System(ChatCompletionSystemMessage)
User(ChatCompletionUserMessage)
Assistant(ChatCompletionAssistantMessage)
Tool(ChatCompletionToolMessage)
Implementations§
source§impl ChatCompletionRequestMessage
impl ChatCompletionRequestMessage
sourcepub fn new_system_message(
content: impl Into<String>,
name: Option<String>
) -> Self
pub fn new_system_message( content: impl Into<String>, name: Option<String> ) -> Self
Creates a new system message.
§Arguments
-
content- The contents of the system message. -
name- An optional name for the participant. Provides the model information to differentiate between participants of the same role.
sourcepub fn new_user_message(
content: ChatCompletionUserMessageContent,
name: Option<String>
) -> Self
pub fn new_user_message( content: ChatCompletionUserMessageContent, name: Option<String> ) -> Self
Creates a new user message.
§Arguments
-
content- The contents of the user message. -
name- An optional name for the participant. Provides the model information to differentiate between participants of the same role.
sourcepub fn new_assistant_message(
content: Option<String>,
name: Option<String>,
tool_calls: Option<Vec<ToolCall>>
) -> Self
pub fn new_assistant_message( content: Option<String>, name: Option<String>, tool_calls: Option<Vec<ToolCall>> ) -> Self
Creates a new assistant message.
§Arguments
-
content- The contents of the assistant message. Required unlesstool_callsis specified. -
name- An optional name for the participant. Provides the model information to differentiate between participants of the same role. -
tool_calls- The tool calls generated by the model.
sourcepub fn new_tool_message(
content: impl Into<String>,
tool_call_id: impl Into<String>
) -> Self
pub fn new_tool_message( content: impl Into<String>, tool_call_id: impl Into<String> ) -> Self
Creates a new tool message.
sourcepub fn role(&self) -> ChatCompletionRole
pub fn role(&self) -> ChatCompletionRole
The role of the messages author.
Trait Implementations§
source§impl Clone for ChatCompletionRequestMessage
impl Clone for ChatCompletionRequestMessage
source§fn clone(&self) -> ChatCompletionRequestMessage
fn clone(&self) -> ChatCompletionRequestMessage
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ChatCompletionRequestMessage
impl Debug for ChatCompletionRequestMessage
source§impl<'de> Deserialize<'de> for ChatCompletionRequestMessage
impl<'de> Deserialize<'de> for ChatCompletionRequestMessage
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>,
source§impl PartialEq for ChatCompletionRequestMessage
impl PartialEq for ChatCompletionRequestMessage
source§fn eq(&self, other: &ChatCompletionRequestMessage) -> bool
fn eq(&self, other: &ChatCompletionRequestMessage) -> bool
self and other values to be equal, and is used
by ==.impl Eq for ChatCompletionRequestMessage
impl StructuralPartialEq for ChatCompletionRequestMessage
Auto Trait Implementations§
impl Freeze for ChatCompletionRequestMessage
impl RefUnwindSafe for ChatCompletionRequestMessage
impl Send for ChatCompletionRequestMessage
impl Sync for ChatCompletionRequestMessage
impl Unpin for ChatCompletionRequestMessage
impl UnwindSafe for ChatCompletionRequestMessage
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.