Skip to main content

gproxy_protocol/protocol/openai/common/enums/
content.rs

1use serde::{Deserialize, Serialize};
2
3strict_string_enum!(EmbeddingEncodingFormat {
4    Float => "float",
5    Base64 => "base64",
6});
7
8strict_string_enum!(ReasoningEffort {
9    None => "none",
10    Minimal => "minimal",
11    Low => "low",
12    Medium => "medium",
13    High => "high",
14    XHigh => "xhigh",
15    Max => "max",
16});
17
18strict_string_enum!(ReasoningSummary {
19    Auto => "auto",
20    Concise => "concise",
21    Detailed => "detailed",
22});
23
24extensible_string_enum!(ReasoningMode, ReasoningModeKnown {
25    Standard => "standard",
26    Pro => "pro",
27});
28
29strict_string_enum!(ServiceTier {
30    Auto => "auto",
31    Default => "default",
32    Fast => "fast",
33    Flex => "flex",
34    Scale => "scale",
35    Priority => "priority",
36    Ultrafast => "ultrafast",
37    OnDemand => "on_demand",
38});
39
40strict_string_enum!(TruncationStrategy {
41    Auto => "auto",
42    Disabled => "disabled",
43});
44
45strict_string_enum!(Verbosity {
46    Low => "low",
47    Medium => "medium",
48    High => "high",
49});
50
51strict_string_enum!(PromptCacheRetention {
52    InMemory => "in_memory",
53    TwentyFourHours => "24h",
54});
55
56strict_string_enum!(PromptCacheMode {
57    Implicit => "implicit",
58    Explicit => "explicit",
59});
60
61strict_string_enum!(PromptCacheBreakpointMode {
62    Explicit => "explicit",
63});
64
65strict_string_enum!(PromptCacheTtl {
66    ThirtyMinutes => "30m",
67});
68
69extensible_string_enum!(ResponsePersonality, ResponsePersonalityKnown {
70    Friendly => "friendly",
71    Pragmatic => "pragmatic",
72});
73
74extensible_string_enum!(ContextManagementType, ContextManagementTypeKnown {
75    Compaction => "compaction",
76});
77
78strict_string_enum!(SearchContextSize {
79    Low => "low",
80    Medium => "medium",
81    High => "high",
82});
83
84#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
85#[non_exhaustive]
86pub enum ApproximateLocationType {
87    #[serde(rename = "approximate")]
88    Approximate,
89}
90
91strict_string_enum!(TextOrAudioModality {
92    Text => "text",
93    Audio => "audio",
94});
95
96strict_string_enum!(InputAudioFormat {
97    Wav => "wav",
98    Mp3 => "mp3",
99});
100
101strict_string_enum!(AudioResponseFormat {
102    Wav => "wav",
103    Aac => "aac",
104    Mp3 => "mp3",
105    Flac => "flac",
106    Opus => "opus",
107    Pcm16 => "pcm16",
108});
109
110#[cfg(test)]
111mod tests {
112    use super::ServiceTier;
113
114    #[test]
115    fn ultrafast_service_tier_uses_openai_wire_value() {
116        assert_eq!(
117            serde_json::to_value(ServiceTier::Ultrafast).unwrap(),
118            serde_json::json!("ultrafast")
119        );
120        assert_eq!(
121            serde_json::from_value::<ServiceTier>(serde_json::json!("ultrafast")).unwrap(),
122            ServiceTier::Ultrafast
123        );
124    }
125}
126
127extensible_string_enum!(VoiceName, VoiceNameKnown {
128    Alloy => "alloy",
129    Ash => "ash",
130    Ballad => "ballad",
131    Coral => "coral",
132    Echo => "echo",
133    Fable => "fable",
134    Nova => "nova",
135    Onyx => "onyx",
136    Sage => "sage",
137    Shimmer => "shimmer",
138    Verse => "verse",
139    Marin => "marin",
140    Cedar => "cedar",
141});
142
143strict_string_enum!(DetailLevel {
144    Auto => "auto",
145    Low => "low",
146    High => "high",
147    Original => "original",
148});
149
150strict_string_enum!(ChatImageDetailLevel {
151    Auto => "auto",
152    Low => "low",
153    High => "high",
154});
155
156strict_string_enum!(InputFileDetailLevel {
157    Low => "low",
158    High => "high",
159});