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_calls
is 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: Option<String>,
) -> Self
pub fn new_tool_message( content: impl Into<String>, tool_call_id: Option<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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.