openai_struct/models/
chat_completion_request_assistant_message.rs

1/*
2 * OpenAI API
3 *
4 * The OpenAI REST API. Please see pub https://platform.openai.com/docs/api-reference for more details.
5 *
6 * OpenAPI spec pub version: 2.3.0
7 *
8 * Generated pub by: https://github.com/swagger-api/swagger-codegen.git
9 */
10
11/// pub ChatCompletionRequestAssistantMessage : Messages sent by the model in response to user messages.
12
13#[allow(unused_imports)]
14use serde_json::Value;
15
16#[derive(Debug, Serialize, Deserialize, PartialEq)]
17pub struct ChatCompletionRequestAssistantMessage {
18    #[serde(rename = "audio")]
19    pub audio: Option<crate::models::ChatCompletionRequestAssistantMessageAudio>,
20    /// The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified.
21    #[serde(rename = "content")]
22    pub content: Option<ChatCompletionRequestAssistantMessageContent>,
23    #[serde(rename = "function_call")]
24    pub function_call: Option<crate::models::ChatCompletionRequestAssistantMessageFunctionCall>,
25    /// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
26    #[serde(rename = "name")]
27    pub name: Option<String>,
28    /// The refusal message by the assistant.
29    #[serde(rename = "refusal")]
30    pub refusal: Option<String>,
31    #[serde(rename = "tool_calls")]
32    pub tool_calls: Option<crate::models::ChatCompletionMessageToolCalls>,
33}
34
35impl Default for ChatCompletionRequestAssistantMessage {
36    fn default() -> Self {
37        Self {
38            audio: None,
39            content: None,
40            function_call: None,
41            name: None,
42            refusal: None,
43            tool_calls: None,
44        }
45    }
46}
47
48#[derive(Debug, Serialize, Deserialize, PartialEq)]
49#[serde(untagged)]
50pub enum ChatCompletionRequestAssistantMessageContent {
51    /// The contents of the assistant message.
52    Text(String),
53    /// An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`.
54    Array(Vec<crate::ChatCompletionRequestAssistantMessageContentPart>),
55}
56
57impl Default for ChatCompletionRequestAssistantMessageContent {
58    fn default() -> Self {
59        Self::Text(String::default())
60    }
61}