gproxy_protocol/wire/openai/
compact.rs1use super::responses::{input::Input, response::ResponseOutputItem};
5use crate::Rest;
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
9#[serde(rename_all = "snake_case")]
10#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
11#[derive(gproxy_protocol_macros::DeclaredFields)]
12pub struct CompactRequestBody {
13 #[serde(
14 default,
15 deserialize_with = "super::responses::input::present_nullable",
16 skip_serializing_if = "Option::is_none"
17 )]
18 pub prompt_cache_options: Option<Option<super::responses::generate::PromptCacheOptions>>,
19 #[serde(
20 default,
21 deserialize_with = "super::responses::input::present_nullable",
22 skip_serializing_if = "Option::is_none"
23 )]
24 pub prompt_cache_retention: Option<Option<super::responses::generate::PromptCacheRetention>>,
25 #[wire(required)]
26 #[serde(deserialize_with = "super::responses::input::required_nullable")]
27 pub model: Option<String>,
28 #[serde(
29 default,
30 deserialize_with = "super::responses::input::present_nullable",
31 skip_serializing_if = "Option::is_none"
32 )]
33 pub input: Option<Option<Input>>,
34 #[serde(
35 default,
36 deserialize_with = "super::responses::input::present_nullable",
37 skip_serializing_if = "Option::is_none"
38 )]
39 pub instructions: Option<Option<String>>,
40 #[serde(
41 default,
42 deserialize_with = "super::responses::input::present_nullable",
43 skip_serializing_if = "Option::is_none"
44 )]
45 pub previous_response_id: Option<Option<String>>,
46 #[serde(
47 default,
48 deserialize_with = "super::responses::input::present_nullable",
49 skip_serializing_if = "Option::is_none"
50 )]
51 pub prompt_cache_key: Option<Option<String>>,
52 #[serde(
53 default,
54 deserialize_with = "super::responses::input::present_nullable",
55 skip_serializing_if = "Option::is_none"
56 )]
57 pub service_tier: Option<Option<ServiceTier>>,
58 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
59 pub rest: Rest,
60}
61pub type CompactRequest = crate::WireRequest<CompactRequestBody>;
62#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
63#[serde(rename_all = "snake_case")]
64#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
65#[derive(gproxy_protocol_macros::DeclaredFields)]
66pub enum ServiceTier {
67 Auto,
68 Default,
69 Fast,
70 Flex,
71 Priority,
72}
73#[derive(
74 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
75)]
76#[serde(rename_all = "snake_case")]
77#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
78#[derive(gproxy_protocol_macros::DeclaredFields)]
79pub struct CompactResponseBody {
80 pub usage: super::responses::response::ResponseUsage,
81 pub id: String,
82 pub created_at: i64,
83 pub object: CompactObject,
84 pub output: Vec<ResponseOutputItem>,
85 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
86 pub rest: Rest,
87}
88pub type CompactResponse = crate::WireResponse<CompactResponseBody>;
89#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
90#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
91#[derive(gproxy_protocol_macros::DeclaredFields)]
92pub enum CompactObject {
93 #[serde(rename = "response.compaction")]
94 ResponseCompaction,
95}
96
97#[derive(
100 Debug,
101 Clone,
102 PartialEq,
103 Serialize,
104 Deserialize,
105 gproxy_protocol_macros::WireBuilder,
106 gproxy_protocol_macros::DeclaredFields,
107)]
108#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
109pub struct ClientCompactRequestBody {
110 pub model: String,
111 pub input: Vec<super::guardian::ClientResponseItem>,
112 #[serde(default, skip_serializing_if = "String::is_empty")]
113 pub instructions: String,
114 #[serde(skip_serializing_if = "Option::is_none")]
115 pub tools: Option<serde_json::Value>,
116 pub parallel_tool_calls: bool,
117 #[serde(skip_serializing_if = "Option::is_none")]
118 pub reasoning: Option<super::guardian::Reasoning>,
119 #[serde(skip_serializing_if = "Option::is_none")]
120 pub service_tier: Option<String>,
121 #[serde(skip_serializing_if = "Option::is_none")]
122 pub prompt_cache_key: Option<String>,
123 #[serde(skip_serializing_if = "Option::is_none")]
124 pub text: Option<super::guardian::ClientTextControls>,
125 #[serde(skip_serializing_if = "Option::is_none")]
126 pub access_programs: Option<super::guardian::AccessPrograms>,
127 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
128 pub rest: Rest,
129}
130#[derive(
133 Debug,
134 Clone,
135 PartialEq,
136 Serialize,
137 Deserialize,
138 gproxy_protocol_macros::WireBuilder,
139 gproxy_protocol_macros::DeclaredFields,
140)]
141#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
142pub struct ClientCompactResponseBody {
143 pub output: Vec<super::guardian::ClientResponseItem>,
144 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
145 pub rest: Rest,
146}
147pub type ClientCompactRequest = crate::WireRequest<ClientCompactRequestBody>;
148pub type ClientCompactResponse = crate::WireResponse<ClientCompactResponseBody>;