1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* OpenAI API
*
* The OpenAI REST API. Please see pub https://platform.openai.com/docs/api-reference for more details.
*
* OpenAPI spec pub version: 2.3.0
*
* Generated pub by: https://github.com/swagger-api/swagger-codegen.git
*/
/// pub ChatCompletionRequestDeveloperMessage : Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, `developer` messages replace the previous `system` messages.
#[allow(unused_imports)]
use serde_json::Value;
use crate::ChatCompletionRequestMessageContentPartText;
#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct ChatCompletionRequestDeveloperMessage {
/// The contents of the developer message.
#[serde(rename = "content")]
pub content: ChatCompletionRequestDeveloperMessageContent,
/// An optional name for the participant. Provides the model information to differentiate between participants of the same role.
#[serde(rename = "name")]
pub name: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[serde(untagged)]
pub enum ChatCompletionRequestDeveloperMessageContent {
Text(String),
Array(Vec<ChatCompletionRequestMessageContentPartText>),
}
#[test]
fn test_message_developer_message_content() {
assert_eq!(
serde_json::to_string(&ChatCompletionRequestDeveloperMessageContent::Text(
"qwe".into()
))
.unwrap(),
"\"qwe\"".to_string()
);
}