openai_struct/models/
chat_completion_modalities.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 ChatCompletionModalities : Output types that you would like the model to generate for this request. Most models are capable of generating text, which is the pub default:  `[\"text\"]`  The `gpt-4o-audio-preview` model can also be used to [generate audio](/docs/guides/audio). To request that this model generate both text and audio responses, you can pub use:  `[\"text\", \"audio\"]`
12
13#[allow(unused_imports)]
14use serde_json::Value;
15
16/// # on openapi.yaml
17///
18/// ```yaml
19/// ChatCompletionModalities:
20///   type: array
21///   nullable: true
22///   description: >
23///     Output types that you would like the model to generate for this request.
24///
25///     Most models are capable of generating text, which is the default:
26///
27///
28///     `["text"]`
29///
30///
31///     The `gpt-4o-audio-preview` model can also be used to [generate
32///     audio](/docs/guides/audio). To
33///
34///     request that this model generate both text and audio responses, you can
35///
36///     use:
37///
38///
39///     `["text", "audio"]`
40///   items:
41///     type: string
42///     enum:
43///       - text
44///       - audio
45/// ```
46#[derive(Debug, Serialize, Deserialize)]
47pub struct ChatCompletionModalities(
48    #[serde(default = "default_modalities")] Vec<ChatCompletionModality>,
49);
50
51#[derive(Debug, Serialize, Deserialize, Clone)]
52pub enum ChatCompletionModality {
53    #[serde(rename = "text")]
54    Text,
55    #[serde(rename = "audio")]
56    Audio,
57}
58
59fn default_modalities() -> Vec<ChatCompletionModality> {
60    vec![ChatCompletionModality::Text]
61}
62
63#[test]
64fn test_mode() {
65    assert_eq!(
66        serde_json::to_string(&ChatCompletionModalities(vec![
67            ChatCompletionModality::Text,
68            ChatCompletionModality::Audio
69        ]))
70        .unwrap(),
71        r#"["text","audio"]"#
72    );
73}