pub enum ChatCompletionRequestMessage {
System {
content: String,
name: Option<String>,
},
Developer {
content: String,
name: Option<String>,
},
User {
content: ChatCompletionUserMessageContent,
name: Option<String>,
},
Assistant {
content: Option<String>,
name: Option<String>,
tool_calls: Option<Vec<ChatCompletionMessageToolCall>>,
function_call: Option<FunctionCall>,
},
Tool {
content: String,
tool_call_id: String,
},
Function {
content: String,
name: String,
},
}Expand description
A chat completion message in a conversation.
Variants§
System
System message that sets the behavior of the assistant
Fields
Developer
Developer message (new role by OpenAI for select models)
Fields
User
User message in the conversation
Fields
§
content: ChatCompletionUserMessageContentThe contents of the user message (text or array of content parts)
Assistant
Assistant message in the conversation
Fields
§
tool_calls: Option<Vec<ChatCompletionMessageToolCall>>Tool calls generated by the model
§
function_call: Option<FunctionCall>Deprecated: Function call (use tool_calls instead)
Tool
Tool response message
Fields
Function
Function response message (deprecated)
Implementations§
Source§impl ChatCompletionRequestMessage
impl ChatCompletionRequestMessage
Sourcepub fn system(content: impl Into<String>) -> Self
pub fn system(content: impl Into<String>) -> Self
Creates a system message.
§Example
use portkey_sdk::model::ChatCompletionRequestMessage;
let msg = ChatCompletionRequestMessage::system("You are a helpful assistant.");Trait Implementations§
Source§impl Clone for ChatCompletionRequestMessage
impl Clone for ChatCompletionRequestMessage
Source§fn clone(&self) -> ChatCompletionRequestMessage
fn clone(&self) -> ChatCompletionRequestMessage
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 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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more