Skip to main content

gproxy_protocol/wire/claude/
generate_content.rs

1use crate::Rest;
2use serde::{Deserialize, Serialize};
3
4use super::{
5    content::{self, Message},
6    count_tokens::{
7        ContextManagementConfig, JsonOutputFormat, McpServerUrlDefinition, OutputConfig, Speed,
8        SystemPrompt, ThinkingConfig, ToolChoice,
9    },
10    tools::ToolUnion,
11};
12
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
14#[serde(rename_all = "snake_case")]
15#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
16#[derive(gproxy_protocol_macros::DeclaredFields)]
17#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
18pub struct GenerateContentRequestBody {
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub compaction: Option<CompactionConfig>,
21
22    pub max_tokens: i64,
23    pub messages: Vec<Message>,
24    pub model: String,
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub cache_control: Option<super::content::CacheControl>,
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub container: Option<ContainerParam>,
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub context_management: Option<ContextManagementConfig>,
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub diagnostics: Option<DiagnosticsParam>,
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub fallback_credit_token: Option<FallbackCreditTokenParam>,
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub fallbacks: Option<FallbacksParam>,
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub inference_geo: Option<String>,
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub mcp_servers: Option<Vec<McpServerUrlDefinition>>,
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub metadata: Option<Metadata>,
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub output_config: Option<OutputConfig>,
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub output_format: Option<JsonOutputFormat>,
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub service_tier: Option<ServiceTier>,
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub speed: Option<Speed>,
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub stop_sequences: Option<Vec<String>>,
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub stream: Option<bool>,
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub system: Option<SystemPrompt>,
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub temperature: Option<f64>,
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub thinking: Option<ThinkingConfig>,
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub tool_choice: Option<ToolChoice>,
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub tools: Option<Vec<ToolUnion>>,
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub top_k: Option<i64>,
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub top_p: Option<f64>,
69    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
70    pub rest: Rest,
71}
72pub type GenerateContentRequest = crate::WireRequest<GenerateContentRequestBody>;
73#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
74#[serde(untagged)]
75#[derive(gproxy_protocol_macros::DeclaredFields)]
76#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
77pub enum ContainerParam {
78    Id(String),
79    Params(ContainerParams),
80}
81
82#[derive(
83    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
84)]
85#[serde(rename_all = "snake_case")]
86#[derive(gproxy_protocol_macros::DeclaredFields)]
87#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
88pub struct ContainerParams {
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub id: Option<String>,
91    #[serde(skip_serializing_if = "Option::is_none")]
92    pub skills: Option<Vec<SkillParam>>,
93    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
94    pub rest: Rest,
95}
96#[derive(
97    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
98)]
99#[serde(rename_all = "snake_case")]
100#[derive(gproxy_protocol_macros::DeclaredFields)]
101#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
102pub struct SkillParam {
103    pub skill_id: String,
104    #[serde(rename = "type")]
105    pub type_: SkillType,
106    #[serde(skip_serializing_if = "Option::is_none")]
107    pub version: Option<String>,
108    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
109    pub rest: Rest,
110}
111#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
112#[serde(rename_all = "snake_case")]
113#[derive(gproxy_protocol_macros::DeclaredFields)]
114#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
115pub enum SkillType {
116    Anthropic,
117    Custom,
118}
119#[derive(
120    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
121)]
122#[serde(rename_all = "snake_case")]
123#[derive(gproxy_protocol_macros::DeclaredFields)]
124#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
125pub struct DiagnosticsParam {
126    #[serde(
127        default,
128        deserialize_with = "present_nullable",
129        skip_serializing_if = "Option::is_none"
130    )]
131    pub previous_message_id: Option<Option<String>>,
132    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
133    pub rest: Rest,
134}
135#[derive(
136    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
137)]
138#[serde(rename_all = "snake_case")]
139#[derive(gproxy_protocol_macros::DeclaredFields)]
140#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
141pub struct FallbackCreditToken {
142    pub token: String,
143    #[serde(skip_serializing_if = "Option::is_none")]
144    pub mode: Option<FallbackCreditMode>,
145    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
146    pub rest: Rest,
147}
148#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
149#[serde(rename_all = "snake_case")]
150#[derive(gproxy_protocol_macros::DeclaredFields)]
151#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
152pub enum FallbackCreditMode {
153    Strict,
154    BestEffort,
155}
156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
157#[serde(rename_all = "snake_case")]
158#[derive(gproxy_protocol_macros::DeclaredFields)]
159#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
160pub struct FallbackParam {
161    pub model: String,
162    #[serde(skip_serializing_if = "Option::is_none")]
163    pub max_tokens: Option<i64>,
164    #[serde(skip_serializing_if = "Option::is_none")]
165    pub output_config: Option<OutputConfig>,
166    #[serde(skip_serializing_if = "Option::is_none")]
167    pub speed: Option<Speed>,
168    #[serde(skip_serializing_if = "Option::is_none")]
169    pub thinking: Option<ThinkingConfig>,
170    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
171    pub rest: Rest,
172}
173#[derive(
174    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
175)]
176#[serde(rename_all = "snake_case")]
177#[derive(gproxy_protocol_macros::DeclaredFields)]
178#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
179pub struct Metadata {
180    #[serde(skip_serializing_if = "Option::is_none")]
181    pub user_id: Option<String>,
182    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
183    pub rest: Rest,
184}
185#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
186#[serde(rename_all = "snake_case")]
187#[derive(gproxy_protocol_macros::DeclaredFields)]
188#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
189pub enum ServiceTier {
190    Auto,
191    StandardOnly,
192}
193
194// Response nullability follows the official SDK where the generated reference
195// omits it: anthropics/anthropic-sdk-python, src/anthropic/types/beta/.
196// Keep absent fields distinct from explicit null (for example, pending diagnostics).
197fn present_nullable<'de, D, T>(deserializer: D) -> Result<Option<Option<T>>, D::Error>
198where
199    D: serde::Deserializer<'de>,
200    T: Deserialize<'de>,
201{
202    Option::<T>::deserialize(deserializer).map(Some)
203}
204
205#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
206#[serde(untagged)]
207#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
208#[derive(gproxy_protocol_macros::DeclaredFields)]
209#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
210pub enum FallbackCreditTokenParam {
211    Token(String),
212    Params(FallbackCreditToken),
213}
214
215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
216#[serde(untagged)]
217#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
218#[derive(gproxy_protocol_macros::DeclaredFields)]
219#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
220pub enum FallbacksParam {
221    Models(Vec<FallbackParam>),
222    Default(DefaultFallbacks),
223}
224
225#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
226#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
227#[derive(gproxy_protocol_macros::DeclaredFields)]
228#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
229pub enum DefaultFallbacks {
230    #[serde(rename = "default")]
231    Default,
232}
233
234#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
235#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
236#[derive(gproxy_protocol_macros::DeclaredFields)]
237#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
238pub enum GenerateContentResponseBodyType {
239    #[serde(rename = "message")]
240    Tag,
241}
242
243#[derive(
244    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
245)]
246#[serde(rename_all = "snake_case")]
247#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
248#[derive(gproxy_protocol_macros::DeclaredFields)]
249#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
250pub struct GenerateContentResponseBody {
251    #[serde(
252        default,
253        deserialize_with = "present_nullable",
254        skip_serializing_if = "Option::is_none"
255    )]
256    pub input_transformations: Option<Option<Vec<InputTransformation>>>,
257
258    #[serde(rename = "type")]
259    pub type_: GenerateContentResponseBodyType,
260    pub id: String,
261    #[serde(
262        default,
263        deserialize_with = "present_nullable",
264        skip_serializing_if = "Option::is_none"
265    )]
266    pub container: Option<Option<ResponseContainer>>,
267    pub content: Vec<ResponseContentBlock>,
268    #[serde(
269        default,
270        deserialize_with = "present_nullable",
271        skip_serializing_if = "Option::is_none"
272    )]
273    pub context_management: Option<Option<ContextManagementResponse>>,
274    #[serde(
275        default,
276        deserialize_with = "present_nullable",
277        skip_serializing_if = "Option::is_none"
278    )]
279    pub diagnostics: Option<Option<DiagnosticsResponse>>,
280    pub model: String,
281    pub role: ResponseRole,
282    #[serde(
283        default,
284        deserialize_with = "present_nullable",
285        skip_serializing_if = "Option::is_none"
286    )]
287    pub stop_details: Option<Option<RefusalStopDetails>>,
288    pub stop_reason: StopReason,
289    #[serde(
290        default,
291        deserialize_with = "present_nullable",
292        skip_serializing_if = "Option::is_none"
293    )]
294    pub stop_sequence: Option<Option<String>>,
295    pub usage: Usage,
296    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
297    pub rest: Rest,
298}
299
300pub type GenerateContentResponse = crate::WireResponse<GenerateContentResponseBody>;
301pub type ResponseType = GenerateContentResponseBodyType;
302#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
303#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
304#[derive(gproxy_protocol_macros::DeclaredFields)]
305#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
306pub enum ResponseRole {
307    #[serde(rename = "assistant")]
308    Assistant,
309}
310
311#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
312#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
313#[derive(gproxy_protocol_macros::DeclaredFields)]
314#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
315pub enum StopReason {
316    #[serde(rename = "end_turn")]
317    EndTurn,
318    #[serde(rename = "max_tokens")]
319    MaxTokens,
320    #[serde(rename = "stop_sequence")]
321    StopSequence,
322    #[serde(rename = "tool_use")]
323    ToolUse,
324    #[serde(rename = "pause_turn")]
325    PauseTurn,
326    #[serde(rename = "compaction")]
327    Compaction,
328    #[serde(rename = "refusal")]
329    Refusal,
330    #[serde(rename = "model_context_window_exceeded")]
331    ModelContextWindowExceeded,
332}
333
334#[derive(
335    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
336)]
337#[serde(rename_all = "snake_case")]
338#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
339#[derive(gproxy_protocol_macros::DeclaredFields)]
340#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
341pub struct ResponseContainer {
342    pub id: String,
343    pub expires_at: String,
344    #[serde(
345        default,
346        deserialize_with = "present_nullable",
347        skip_serializing_if = "Option::is_none"
348    )]
349    pub skills: Option<Option<Vec<ResponseSkill>>>,
350    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
351    pub rest: Rest,
352}
353
354#[derive(
355    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
356)]
357#[serde(rename_all = "snake_case")]
358#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
359#[derive(gproxy_protocol_macros::DeclaredFields)]
360#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
361pub struct ResponseSkill {
362    pub skill_id: String,
363    #[serde(rename = "type")]
364    pub type_: SkillType,
365    pub version: String,
366    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
367    pub rest: Rest,
368}
369
370#[derive(
371    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
372)]
373#[serde(rename_all = "snake_case")]
374#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
375#[derive(gproxy_protocol_macros::DeclaredFields)]
376#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
377pub struct ContextManagementResponse {
378    pub applied_edits: Vec<ContextEditResponse>,
379    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
380    pub rest: Rest,
381}
382
383#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
384#[serde(untagged)]
385#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
386#[derive(gproxy_protocol_macros::DeclaredFields)]
387#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
388pub enum ContextEditResponse {
389    Tools(ClearedTools),
390    Thinking(ClearedThinking),
391}
392
393#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
394#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
395#[derive(gproxy_protocol_macros::DeclaredFields)]
396#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
397pub enum ClearedToolsType {
398    #[serde(rename = "clear_tool_uses_20250919")]
399    Tag,
400}
401
402#[derive(
403    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
404)]
405#[serde(rename_all = "snake_case")]
406#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
407#[derive(gproxy_protocol_macros::DeclaredFields)]
408#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
409pub struct ClearedTools {
410    #[serde(rename = "type")]
411    pub type_: ClearedToolsType,
412    pub cleared_input_tokens: i64,
413    pub cleared_tool_uses: i64,
414    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
415    pub rest: Rest,
416}
417
418#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
419#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
420#[derive(gproxy_protocol_macros::DeclaredFields)]
421#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
422pub enum ClearedThinkingType {
423    #[serde(rename = "clear_thinking_20251015")]
424    Tag,
425}
426
427#[derive(
428    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
429)]
430#[serde(rename_all = "snake_case")]
431#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
432#[derive(gproxy_protocol_macros::DeclaredFields)]
433#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
434pub struct ClearedThinking {
435    #[serde(rename = "type")]
436    pub type_: ClearedThinkingType,
437    pub cleared_input_tokens: i64,
438    pub cleared_thinking_turns: i64,
439    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
440    pub rest: Rest,
441}
442
443#[derive(
444    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
445)]
446#[serde(rename_all = "snake_case")]
447#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
448#[derive(gproxy_protocol_macros::DeclaredFields)]
449#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
450pub struct DiagnosticsResponse {
451    #[serde(
452        default,
453        deserialize_with = "present_nullable",
454        skip_serializing_if = "Option::is_none"
455    )]
456    pub cache_miss_reason: Option<Option<CacheMissReason>>,
457    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
458    pub rest: Rest,
459}
460
461#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
462#[serde(untagged)]
463#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
464#[derive(gproxy_protocol_macros::DeclaredFields)]
465#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
466pub enum CacheMissReason {
467    ModelChanged(CacheMissModelChanged),
468    SystemChanged(CacheMissSystemChanged),
469    ToolsChanged(CacheMissToolsChanged),
470    MessagesChanged(CacheMissMessagesChanged),
471    PreviousMessageNotFound(CacheMissPreviousMessageNotFound),
472    Unavailable(CacheMissUnavailable),
473}
474
475#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
476#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
477#[derive(gproxy_protocol_macros::DeclaredFields)]
478#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
479pub enum CacheMissModelChangedType {
480    #[serde(rename = "model_changed")]
481    Tag,
482}
483
484#[derive(
485    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
486)]
487#[serde(rename_all = "snake_case")]
488#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
489#[derive(gproxy_protocol_macros::DeclaredFields)]
490#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
491pub struct CacheMissModelChanged {
492    #[serde(rename = "type")]
493    pub type_: CacheMissModelChangedType,
494    pub cache_missed_input_tokens: i64,
495    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
496    pub rest: Rest,
497}
498
499#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
500#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
501#[derive(gproxy_protocol_macros::DeclaredFields)]
502#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
503pub enum CacheMissSystemChangedType {
504    #[serde(rename = "system_changed")]
505    Tag,
506}
507
508#[derive(
509    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
510)]
511#[serde(rename_all = "snake_case")]
512#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
513#[derive(gproxy_protocol_macros::DeclaredFields)]
514#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
515pub struct CacheMissSystemChanged {
516    #[serde(rename = "type")]
517    pub type_: CacheMissSystemChangedType,
518    pub cache_missed_input_tokens: i64,
519    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
520    pub rest: Rest,
521}
522
523#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
524#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
525#[derive(gproxy_protocol_macros::DeclaredFields)]
526#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
527pub enum CacheMissToolsChangedType {
528    #[serde(rename = "tools_changed")]
529    Tag,
530}
531
532#[derive(
533    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
534)]
535#[serde(rename_all = "snake_case")]
536#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
537#[derive(gproxy_protocol_macros::DeclaredFields)]
538#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
539pub struct CacheMissToolsChanged {
540    #[serde(rename = "type")]
541    pub type_: CacheMissToolsChangedType,
542    pub cache_missed_input_tokens: i64,
543    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
544    pub rest: Rest,
545}
546
547#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
548#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
549#[derive(gproxy_protocol_macros::DeclaredFields)]
550#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
551pub enum CacheMissMessagesChangedType {
552    #[serde(rename = "messages_changed")]
553    Tag,
554}
555
556#[derive(
557    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
558)]
559#[serde(rename_all = "snake_case")]
560#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
561#[derive(gproxy_protocol_macros::DeclaredFields)]
562#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
563pub struct CacheMissMessagesChanged {
564    #[serde(rename = "type")]
565    pub type_: CacheMissMessagesChangedType,
566    pub cache_missed_input_tokens: i64,
567    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
568    pub rest: Rest,
569}
570
571#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
572#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
573#[derive(gproxy_protocol_macros::DeclaredFields)]
574#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
575pub enum CacheMissPreviousMessageNotFoundType {
576    #[serde(rename = "previous_message_not_found")]
577    Tag,
578}
579
580#[derive(
581    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
582)]
583#[serde(rename_all = "snake_case")]
584#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
585#[derive(gproxy_protocol_macros::DeclaredFields)]
586#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
587pub struct CacheMissPreviousMessageNotFound {
588    #[serde(rename = "type")]
589    pub type_: CacheMissPreviousMessageNotFoundType,
590    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
591    pub rest: Rest,
592}
593
594#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
595#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
596#[derive(gproxy_protocol_macros::DeclaredFields)]
597#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
598pub enum CacheMissUnavailableType {
599    #[serde(rename = "unavailable")]
600    Tag,
601}
602
603#[derive(
604    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
605)]
606#[serde(rename_all = "snake_case")]
607#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
608#[derive(gproxy_protocol_macros::DeclaredFields)]
609#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
610pub struct CacheMissUnavailable {
611    #[serde(rename = "type")]
612    pub type_: CacheMissUnavailableType,
613    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
614    pub rest: Rest,
615}
616
617#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
618#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
619#[derive(gproxy_protocol_macros::DeclaredFields)]
620#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
621pub enum RefusalCategory {
622    #[serde(rename = "cyber")]
623    Cyber,
624    #[serde(rename = "bio")]
625    Bio,
626    #[serde(rename = "frontier_llm")]
627    FrontierLlm,
628    #[serde(rename = "reasoning_extraction")]
629    ReasoningExtraction,
630    #[serde(rename = "general_harms")]
631    GeneralHarms,
632}
633
634#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
635#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
636#[derive(gproxy_protocol_macros::DeclaredFields)]
637#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
638pub enum RefusalStopDetailsType {
639    #[serde(rename = "refusal")]
640    Tag,
641}
642
643#[derive(
644    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
645)]
646#[serde(rename_all = "snake_case")]
647#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
648#[derive(gproxy_protocol_macros::DeclaredFields)]
649#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
650pub struct RefusalStopDetails {
651    #[serde(rename = "type")]
652    pub type_: RefusalStopDetailsType,
653    #[serde(
654        default,
655        deserialize_with = "present_nullable",
656        skip_serializing_if = "Option::is_none"
657    )]
658    pub category: Option<Option<RefusalCategory>>,
659    #[serde(
660        default,
661        deserialize_with = "present_nullable",
662        skip_serializing_if = "Option::is_none"
663    )]
664    pub explanation: Option<Option<String>>,
665    #[serde(
666        default,
667        deserialize_with = "present_nullable",
668        skip_serializing_if = "Option::is_none"
669    )]
670    pub fallback_credit_token: Option<Option<String>>,
671    #[serde(
672        default,
673        deserialize_with = "present_nullable",
674        skip_serializing_if = "Option::is_none"
675    )]
676    pub fallback_has_prefill_claim: Option<Option<bool>>,
677    #[serde(
678        default,
679        deserialize_with = "present_nullable",
680        skip_serializing_if = "Option::is_none"
681    )]
682    pub recommended_model: Option<Option<String>>,
683    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
684    pub rest: Rest,
685}
686
687#[derive(
688    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
689)]
690#[serde(rename_all = "snake_case")]
691#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
692#[derive(gproxy_protocol_macros::DeclaredFields)]
693#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
694pub struct CacheCreation {
695    pub ephemeral_1h_input_tokens: i64,
696    pub ephemeral_5m_input_tokens: i64,
697    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
698    pub rest: Rest,
699}
700
701#[derive(
702    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
703)]
704#[serde(rename_all = "snake_case")]
705#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
706#[derive(gproxy_protocol_macros::DeclaredFields)]
707#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
708pub struct Usage {
709    #[serde(
710        default,
711        deserialize_with = "present_nullable",
712        skip_serializing_if = "Option::is_none"
713    )]
714    pub cache_creation: Option<Option<CacheCreation>>,
715    #[serde(
716        default,
717        deserialize_with = "present_nullable",
718        skip_serializing_if = "Option::is_none"
719    )]
720    pub cache_creation_input_tokens: Option<Option<i64>>,
721    #[serde(
722        default,
723        deserialize_with = "present_nullable",
724        skip_serializing_if = "Option::is_none"
725    )]
726    pub cache_read_input_tokens: Option<Option<i64>>,
727    #[serde(
728        default,
729        deserialize_with = "present_nullable",
730        skip_serializing_if = "Option::is_none"
731    )]
732    pub fallback_credit: Option<Option<FallbackCreditUsage>>,
733    #[serde(
734        default,
735        deserialize_with = "present_nullable",
736        skip_serializing_if = "Option::is_none"
737    )]
738    pub inference_geo: Option<Option<String>>,
739    pub input_tokens: i64,
740    #[serde(
741        default,
742        deserialize_with = "present_nullable",
743        skip_serializing_if = "Option::is_none"
744    )]
745    pub iterations: Option<Option<Vec<IterationUsage>>>,
746    pub output_tokens: i64,
747    #[serde(
748        default,
749        deserialize_with = "present_nullable",
750        skip_serializing_if = "Option::is_none"
751    )]
752    pub output_tokens_details: Option<Option<OutputTokensDetails>>,
753    #[serde(
754        default,
755        deserialize_with = "present_nullable",
756        skip_serializing_if = "Option::is_none"
757    )]
758    pub server_tool_use: Option<Option<ServerToolUsage>>,
759    #[serde(
760        default,
761        deserialize_with = "present_nullable",
762        skip_serializing_if = "Option::is_none"
763    )]
764    pub service_tier: Option<Option<ResponseServiceTier>>,
765    #[serde(
766        default,
767        deserialize_with = "present_nullable",
768        skip_serializing_if = "Option::is_none"
769    )]
770    pub speed: Option<Option<Speed>>,
771    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
772    pub rest: Rest,
773}
774
775#[derive(
776    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
777)]
778#[serde(rename_all = "snake_case")]
779#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
780#[derive(gproxy_protocol_macros::DeclaredFields)]
781#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
782pub struct OutputTokensDetails {
783    pub thinking_tokens: i64,
784    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
785    pub rest: Rest,
786}
787
788#[derive(
789    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
790)]
791#[serde(rename_all = "snake_case")]
792#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
793#[derive(gproxy_protocol_macros::DeclaredFields)]
794#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
795pub struct ServerToolUsage {
796    pub web_fetch_requests: i64,
797    pub web_search_requests: i64,
798    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
799    pub rest: Rest,
800}
801
802#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
803#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
804#[derive(gproxy_protocol_macros::DeclaredFields)]
805#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
806pub enum ResponseServiceTier {
807    #[serde(rename = "standard")]
808    Standard,
809    #[serde(rename = "priority")]
810    Priority,
811    #[serde(rename = "batch")]
812    Batch,
813}
814
815#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
816#[serde(untagged)]
817#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
818#[derive(gproxy_protocol_macros::DeclaredFields)]
819#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
820pub enum IterationUsage {
821    Message(MessageIterationUsage),
822    Compaction(CompactionIterationUsage),
823    Advisor(AdvisorMessageIterationUsage),
824    Fallback(FallbackMessageIterationUsage),
825}
826
827#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
828#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
829#[derive(gproxy_protocol_macros::DeclaredFields)]
830#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
831pub enum MessageIterationUsageType {
832    #[serde(rename = "message")]
833    Tag,
834}
835
836#[derive(
837    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
838)]
839#[serde(rename_all = "snake_case")]
840#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
841#[derive(gproxy_protocol_macros::DeclaredFields)]
842#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
843pub struct MessageIterationUsage {
844    #[serde(rename = "type")]
845    pub type_: MessageIterationUsageType,
846    #[serde(
847        default,
848        deserialize_with = "present_nullable",
849        skip_serializing_if = "Option::is_none"
850    )]
851    pub cache_creation: Option<Option<CacheCreation>>,
852    pub cache_creation_input_tokens: i64,
853    pub cache_read_input_tokens: i64,
854    pub input_tokens: i64,
855    pub model: String,
856    pub output_tokens: i64,
857    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
858    pub rest: Rest,
859}
860
861#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
862#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
863#[derive(gproxy_protocol_macros::DeclaredFields)]
864#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
865pub enum CompactionIterationUsageType {
866    #[serde(rename = "compaction")]
867    Tag,
868}
869
870#[derive(
871    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
872)]
873#[serde(rename_all = "snake_case")]
874#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
875#[derive(gproxy_protocol_macros::DeclaredFields)]
876#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
877pub struct CompactionIterationUsage {
878    #[serde(rename = "type")]
879    pub type_: CompactionIterationUsageType,
880    #[serde(
881        default,
882        deserialize_with = "present_nullable",
883        skip_serializing_if = "Option::is_none"
884    )]
885    pub cache_creation: Option<Option<CacheCreation>>,
886    pub cache_creation_input_tokens: i64,
887    pub cache_read_input_tokens: i64,
888    pub input_tokens: i64,
889    pub output_tokens: i64,
890    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
891    pub rest: Rest,
892}
893
894#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
895#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
896#[derive(gproxy_protocol_macros::DeclaredFields)]
897#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
898pub enum AdvisorMessageIterationUsageType {
899    #[serde(rename = "advisor_message")]
900    Tag,
901}
902
903#[derive(
904    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
905)]
906#[serde(rename_all = "snake_case")]
907#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
908#[derive(gproxy_protocol_macros::DeclaredFields)]
909#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
910pub struct AdvisorMessageIterationUsage {
911    #[serde(rename = "type")]
912    pub type_: AdvisorMessageIterationUsageType,
913    #[serde(
914        default,
915        deserialize_with = "present_nullable",
916        skip_serializing_if = "Option::is_none"
917    )]
918    pub cache_creation: Option<Option<CacheCreation>>,
919    pub cache_creation_input_tokens: i64,
920    pub cache_read_input_tokens: i64,
921    pub input_tokens: i64,
922    pub model: String,
923    pub output_tokens: i64,
924    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
925    pub rest: Rest,
926}
927
928#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
929#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
930#[derive(gproxy_protocol_macros::DeclaredFields)]
931#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
932pub enum FallbackMessageIterationUsageType {
933    #[serde(rename = "fallback_message")]
934    Tag,
935}
936
937#[derive(
938    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
939)]
940#[serde(rename_all = "snake_case")]
941#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
942#[derive(gproxy_protocol_macros::DeclaredFields)]
943#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
944pub struct FallbackMessageIterationUsage {
945    #[serde(rename = "type")]
946    pub type_: FallbackMessageIterationUsageType,
947    #[serde(
948        default,
949        deserialize_with = "present_nullable",
950        skip_serializing_if = "Option::is_none"
951    )]
952    pub cache_creation: Option<Option<CacheCreation>>,
953    pub cache_creation_input_tokens: i64,
954    pub cache_read_input_tokens: i64,
955    pub input_tokens: i64,
956    pub model: String,
957    pub output_tokens: i64,
958    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
959    pub rest: Rest,
960}
961
962#[derive(
963    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
964)]
965#[serde(rename_all = "snake_case")]
966#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
967#[derive(gproxy_protocol_macros::DeclaredFields)]
968#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
969pub struct FallbackCreditUsage {
970    pub status: FallbackCreditStatus,
971    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
972    pub rest: Rest,
973}
974
975#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
976#[serde(untagged)]
977#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
978#[derive(gproxy_protocol_macros::DeclaredFields)]
979#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
980pub enum FallbackCreditStatus {
981    Redeemed(FallbackRedeemed),
982    NotApplied(FallbackNotApplied),
983}
984
985#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
986#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
987#[derive(gproxy_protocol_macros::DeclaredFields)]
988#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
989pub enum FallbackRedeemedType {
990    #[serde(rename = "redeemed")]
991    Tag,
992}
993
994#[derive(
995    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
996)]
997#[serde(rename_all = "snake_case")]
998#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
999#[derive(gproxy_protocol_macros::DeclaredFields)]
1000#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1001pub struct FallbackRedeemed {
1002    #[serde(rename = "type")]
1003    pub type_: FallbackRedeemedType,
1004    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1005    pub rest: Rest,
1006}
1007
1008#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1009#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1010#[derive(gproxy_protocol_macros::DeclaredFields)]
1011#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1012pub enum FallbackNotAppliedType {
1013    #[serde(rename = "not_applied")]
1014    Tag,
1015}
1016
1017#[derive(
1018    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1019)]
1020#[serde(rename_all = "snake_case")]
1021#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1022#[derive(gproxy_protocol_macros::DeclaredFields)]
1023#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1024pub struct FallbackNotApplied {
1025    #[serde(rename = "type")]
1026    pub type_: FallbackNotAppliedType,
1027    pub reason: FallbackNotAppliedReason,
1028    #[serde(skip_serializing_if = "Option::is_none")]
1029    pub remove_to_redeem: Option<Vec<String>>,
1030    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1031    pub rest: Rest,
1032}
1033
1034#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1035#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1036#[derive(gproxy_protocol_macros::DeclaredFields)]
1037#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1038pub enum FallbackNotAppliedReason {
1039    #[serde(rename = "body_mismatch")]
1040    BodyMismatch,
1041    #[serde(rename = "continuation_excluded")]
1042    ContinuationExcluded,
1043    #[serde(rename = "continuation_only")]
1044    ContinuationOnly,
1045    #[serde(rename = "expired")]
1046    Expired,
1047    #[serde(rename = "invalid_target_model")]
1048    InvalidTargetModel,
1049    #[serde(rename = "not_enabled")]
1050    NotEnabled,
1051    #[serde(rename = "reprice_unavailable")]
1052    RepriceUnavailable,
1053    #[serde(rename = "temporarily_unavailable")]
1054    TemporarilyUnavailable,
1055    #[serde(rename = "variant_fields_present")]
1056    VariantFieldsPresent,
1057    #[serde(rename = "wrong_organization")]
1058    WrongOrganization,
1059    #[serde(rename = "wrong_platform")]
1060    WrongPlatform,
1061    #[serde(rename = "wrong_workspace")]
1062    WrongWorkspace,
1063}
1064
1065// The response union deliberately excludes request-only image/document/tool-result
1066// and conversation-edit blocks. Shared leaves below have identical wire contracts.
1067#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1068#[serde(untagged)]
1069#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1070#[derive(gproxy_protocol_macros::DeclaredFields)]
1071#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1072pub enum ResponseContentBlock {
1073    Text(ResponseTextBlock),
1074    Thinking(content::ThinkingBlock),
1075    RedactedThinking(content::RedactedThinkingBlock),
1076    ToolUse(ResponseToolUseBlock),
1077    ServerToolUse(ResponseServerToolUseBlock),
1078    WebSearchToolResult(ResponseWebSearchToolResultBlock),
1079    WebFetchToolResult(ResponseWebFetchToolResultBlock),
1080    AdvisorToolResult(ResponseAdvisorToolResultBlock),
1081    CodeExecutionToolResult(ResponseCodeExecutionToolResultBlock),
1082    BashCodeExecutionToolResult(ResponseBashCodeExecutionToolResultBlock),
1083    TextEditorCodeExecutionToolResult(ResponseTextEditorCodeExecutionToolResultBlock),
1084    ToolSearchToolResult(ResponseToolSearchToolResultBlock),
1085    McpToolListing(content::McpToolListingBlock),
1086    McpToolUse(ResponseMcpToolUseBlock),
1087    McpToolResult(ResponseMcpToolResultBlock),
1088    ContainerUpload(ResponseContainerUploadBlock),
1089    Compaction(ResponseCompactionBlock),
1090    Fallback(ResponseFallbackBlock),
1091}
1092
1093#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1094#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1095#[derive(gproxy_protocol_macros::DeclaredFields)]
1096#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1097pub enum ResponseTextBlockType {
1098    #[serde(rename = "text")]
1099    Tag,
1100}
1101
1102#[derive(
1103    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1104)]
1105#[serde(rename_all = "snake_case")]
1106#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1107#[derive(gproxy_protocol_macros::DeclaredFields)]
1108#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1109pub struct ResponseTextBlock {
1110    #[serde(rename = "type")]
1111    pub type_: ResponseTextBlockType,
1112    #[serde(
1113        default,
1114        deserialize_with = "present_nullable",
1115        skip_serializing_if = "Option::is_none"
1116    )]
1117    pub citations: Option<Option<Vec<ResponseTextCitation>>>,
1118    pub text: String,
1119    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1120    pub rest: Rest,
1121}
1122
1123#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1124#[serde(untagged)]
1125#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1126#[derive(gproxy_protocol_macros::DeclaredFields)]
1127#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1128pub enum ResponseTextCitation {
1129    Char(ResponseCharCitation),
1130    Page(ResponsePageCitation),
1131    ContentBlock(ResponseContentBlockCitation),
1132    Web(ResponseWebCitation),
1133    Search(ResponseSearchCitation),
1134}
1135
1136#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1137#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1138#[derive(gproxy_protocol_macros::DeclaredFields)]
1139#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1140pub enum ResponseCharCitationType {
1141    #[serde(rename = "char_location")]
1142    Tag,
1143}
1144
1145#[derive(
1146    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1147)]
1148#[serde(rename_all = "snake_case")]
1149#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1150#[derive(gproxy_protocol_macros::DeclaredFields)]
1151#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1152pub struct ResponseCharCitation {
1153    #[serde(rename = "type")]
1154    pub type_: ResponseCharCitationType,
1155    pub cited_text: String,
1156    pub document_index: i64,
1157    #[serde(
1158        default,
1159        deserialize_with = "present_nullable",
1160        skip_serializing_if = "Option::is_none"
1161    )]
1162    pub document_title: Option<Option<String>>,
1163    #[serde(
1164        default,
1165        deserialize_with = "present_nullable",
1166        skip_serializing_if = "Option::is_none"
1167    )]
1168    pub file_id: Option<Option<String>>,
1169    pub end_char_index: i64,
1170    pub start_char_index: i64,
1171    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1172    pub rest: Rest,
1173}
1174
1175#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1176#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1177#[derive(gproxy_protocol_macros::DeclaredFields)]
1178#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1179pub enum ResponsePageCitationType {
1180    #[serde(rename = "page_location")]
1181    Tag,
1182}
1183
1184#[derive(
1185    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1186)]
1187#[serde(rename_all = "snake_case")]
1188#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1189#[derive(gproxy_protocol_macros::DeclaredFields)]
1190#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1191pub struct ResponsePageCitation {
1192    #[serde(rename = "type")]
1193    pub type_: ResponsePageCitationType,
1194    pub cited_text: String,
1195    pub document_index: i64,
1196    #[serde(
1197        default,
1198        deserialize_with = "present_nullable",
1199        skip_serializing_if = "Option::is_none"
1200    )]
1201    pub document_title: Option<Option<String>>,
1202    #[serde(
1203        default,
1204        deserialize_with = "present_nullable",
1205        skip_serializing_if = "Option::is_none"
1206    )]
1207    pub file_id: Option<Option<String>>,
1208    pub end_page_number: i64,
1209    pub start_page_number: i64,
1210    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1211    pub rest: Rest,
1212}
1213
1214#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1215#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1216#[derive(gproxy_protocol_macros::DeclaredFields)]
1217#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1218pub enum ResponseContentBlockCitationType {
1219    #[serde(rename = "content_block_location")]
1220    Tag,
1221}
1222
1223#[derive(
1224    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1225)]
1226#[serde(rename_all = "snake_case")]
1227#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1228#[derive(gproxy_protocol_macros::DeclaredFields)]
1229#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1230pub struct ResponseContentBlockCitation {
1231    #[serde(rename = "type")]
1232    pub type_: ResponseContentBlockCitationType,
1233    pub cited_text: String,
1234    pub document_index: i64,
1235    #[serde(
1236        default,
1237        deserialize_with = "present_nullable",
1238        skip_serializing_if = "Option::is_none"
1239    )]
1240    pub document_title: Option<Option<String>>,
1241    #[serde(
1242        default,
1243        deserialize_with = "present_nullable",
1244        skip_serializing_if = "Option::is_none"
1245    )]
1246    pub file_id: Option<Option<String>>,
1247    pub end_block_index: i64,
1248    pub start_block_index: i64,
1249    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1250    pub rest: Rest,
1251}
1252
1253#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1254#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1255#[derive(gproxy_protocol_macros::DeclaredFields)]
1256#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1257pub enum ResponseWebCitationType {
1258    #[serde(rename = "web_search_result_location")]
1259    Tag,
1260}
1261
1262#[derive(
1263    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1264)]
1265#[serde(rename_all = "snake_case")]
1266#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1267#[derive(gproxy_protocol_macros::DeclaredFields)]
1268#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1269pub struct ResponseWebCitation {
1270    #[serde(rename = "type")]
1271    pub type_: ResponseWebCitationType,
1272    pub cited_text: String,
1273    pub encrypted_index: String,
1274    #[serde(
1275        default,
1276        deserialize_with = "present_nullable",
1277        skip_serializing_if = "Option::is_none"
1278    )]
1279    pub title: Option<Option<String>>,
1280    pub url: String,
1281    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1282    pub rest: Rest,
1283}
1284
1285#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1286#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1287#[derive(gproxy_protocol_macros::DeclaredFields)]
1288#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1289pub enum ResponseSearchCitationType {
1290    #[serde(rename = "search_result_location")]
1291    Tag,
1292}
1293
1294#[derive(
1295    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1296)]
1297#[serde(rename_all = "snake_case")]
1298#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1299#[derive(gproxy_protocol_macros::DeclaredFields)]
1300#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1301pub struct ResponseSearchCitation {
1302    #[serde(rename = "type")]
1303    pub type_: ResponseSearchCitationType,
1304    pub cited_text: String,
1305    pub end_block_index: i64,
1306    pub search_result_index: i64,
1307    pub source: String,
1308    pub start_block_index: i64,
1309    #[serde(
1310        default,
1311        deserialize_with = "present_nullable",
1312        skip_serializing_if = "Option::is_none"
1313    )]
1314    pub title: Option<Option<String>>,
1315    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1316    pub rest: Rest,
1317}
1318
1319#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1320#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1321#[derive(gproxy_protocol_macros::DeclaredFields)]
1322#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1323pub enum ResponseToolUseBlockType {
1324    #[serde(rename = "tool_use")]
1325    Tag,
1326}
1327
1328#[derive(
1329    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1330)]
1331#[serde(rename_all = "snake_case")]
1332#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1333#[derive(gproxy_protocol_macros::DeclaredFields)]
1334#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1335pub struct ResponseToolUseBlock {
1336    #[serde(
1337        default,
1338        deserialize_with = "present_nullable",
1339        skip_serializing_if = "Option::is_none"
1340    )]
1341    pub toolset_name: Option<Option<String>>,
1342
1343    #[serde(rename = "type")]
1344    pub type_: ResponseToolUseBlockType,
1345    pub id: String,
1346    pub input: serde_json::Map<String, serde_json::Value>,
1347    pub name: String,
1348    #[serde(
1349        default,
1350        deserialize_with = "present_nullable",
1351        skip_serializing_if = "Option::is_none"
1352    )]
1353    pub caller: Option<Option<content::Caller>>,
1354    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1355    pub rest: Rest,
1356}
1357
1358#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1359#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1360#[derive(gproxy_protocol_macros::DeclaredFields)]
1361#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1362pub enum ResponseServerToolUseBlockType {
1363    #[serde(rename = "server_tool_use")]
1364    Tag,
1365}
1366
1367#[derive(
1368    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1369)]
1370#[serde(rename_all = "snake_case")]
1371#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1372#[derive(gproxy_protocol_macros::DeclaredFields)]
1373#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1374pub struct ResponseServerToolUseBlock {
1375    #[serde(rename = "type")]
1376    pub type_: ResponseServerToolUseBlockType,
1377    pub id: String,
1378    pub input: serde_json::Map<String, serde_json::Value>,
1379    pub name: content::ServerToolName,
1380    #[serde(
1381        default,
1382        deserialize_with = "present_nullable",
1383        skip_serializing_if = "Option::is_none"
1384    )]
1385    pub caller: Option<Option<content::Caller>>,
1386    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1387    pub rest: Rest,
1388}
1389
1390#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1391#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1392#[derive(gproxy_protocol_macros::DeclaredFields)]
1393#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1394pub enum ResponseWebSearchToolResultBlockType {
1395    #[serde(rename = "web_search_tool_result")]
1396    Tag,
1397}
1398
1399#[derive(
1400    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1401)]
1402#[serde(rename_all = "snake_case")]
1403#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1404#[derive(gproxy_protocol_macros::DeclaredFields)]
1405#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1406pub struct ResponseWebSearchToolResultBlock {
1407    #[serde(rename = "type")]
1408    pub type_: ResponseWebSearchToolResultBlockType,
1409    pub content: ResponseWebSearchResultContent,
1410    pub tool_use_id: String,
1411    #[serde(
1412        default,
1413        deserialize_with = "present_nullable",
1414        skip_serializing_if = "Option::is_none"
1415    )]
1416    pub caller: Option<Option<content::Caller>>,
1417    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1418    pub rest: Rest,
1419}
1420
1421#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1422#[serde(untagged)]
1423#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1424#[derive(gproxy_protocol_macros::DeclaredFields)]
1425#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1426pub enum ResponseWebSearchResultContent {
1427    Error(content::WebSearchError),
1428    Results(Vec<ResponseWebSearchResult>),
1429}
1430
1431#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1432#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1433#[derive(gproxy_protocol_macros::DeclaredFields)]
1434#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1435pub enum ResponseWebSearchResultType {
1436    #[serde(rename = "web_search_result")]
1437    Tag,
1438}
1439
1440#[derive(
1441    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1442)]
1443#[serde(rename_all = "snake_case")]
1444#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1445#[derive(gproxy_protocol_macros::DeclaredFields)]
1446#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1447pub struct ResponseWebSearchResult {
1448    #[serde(rename = "type")]
1449    pub type_: ResponseWebSearchResultType,
1450    pub encrypted_content: String,
1451    #[serde(
1452        default,
1453        deserialize_with = "present_nullable",
1454        skip_serializing_if = "Option::is_none"
1455    )]
1456    pub page_age: Option<Option<String>>,
1457    pub title: String,
1458    pub url: String,
1459    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1460    pub rest: Rest,
1461}
1462
1463#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1464#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1465#[derive(gproxy_protocol_macros::DeclaredFields)]
1466#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1467pub enum ResponseWebFetchToolResultBlockType {
1468    #[serde(rename = "web_fetch_tool_result")]
1469    Tag,
1470}
1471
1472#[derive(
1473    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1474)]
1475#[serde(rename_all = "snake_case")]
1476#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1477#[derive(gproxy_protocol_macros::DeclaredFields)]
1478#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1479pub struct ResponseWebFetchToolResultBlock {
1480    #[serde(rename = "type")]
1481    pub type_: ResponseWebFetchToolResultBlockType,
1482    pub content: ResponseWebFetchResultContent,
1483    pub tool_use_id: String,
1484    #[serde(
1485        default,
1486        deserialize_with = "present_nullable",
1487        skip_serializing_if = "Option::is_none"
1488    )]
1489    pub caller: Option<Option<content::Caller>>,
1490    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1491    pub rest: Rest,
1492}
1493
1494#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1495#[serde(untagged)]
1496#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1497#[derive(gproxy_protocol_macros::DeclaredFields)]
1498#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1499pub enum ResponseWebFetchResultContent {
1500    Error(content::WebFetchError),
1501    Result(ResponseWebFetchResult),
1502}
1503
1504#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1505#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1506#[derive(gproxy_protocol_macros::DeclaredFields)]
1507#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1508pub enum ResponseWebFetchResultType {
1509    #[serde(rename = "web_fetch_result")]
1510    Tag,
1511}
1512
1513#[derive(
1514    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1515)]
1516#[serde(rename_all = "snake_case")]
1517#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1518#[derive(gproxy_protocol_macros::DeclaredFields)]
1519#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1520pub struct ResponseWebFetchResult {
1521    #[serde(rename = "type")]
1522    pub type_: ResponseWebFetchResultType,
1523    pub content: ResponseDocumentBlock,
1524    #[serde(
1525        default,
1526        deserialize_with = "present_nullable",
1527        skip_serializing_if = "Option::is_none"
1528    )]
1529    pub retrieved_at: Option<Option<String>>,
1530    pub url: String,
1531    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1532    pub rest: Rest,
1533}
1534
1535#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1536#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1537#[derive(gproxy_protocol_macros::DeclaredFields)]
1538#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1539pub enum ResponseDocumentBlockType {
1540    #[serde(rename = "document")]
1541    Tag,
1542}
1543
1544#[derive(
1545    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1546)]
1547#[serde(rename_all = "snake_case")]
1548#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1549#[derive(gproxy_protocol_macros::DeclaredFields)]
1550#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1551pub struct ResponseDocumentBlock {
1552    #[serde(rename = "type")]
1553    pub type_: ResponseDocumentBlockType,
1554    #[serde(
1555        default,
1556        deserialize_with = "present_nullable",
1557        skip_serializing_if = "Option::is_none"
1558    )]
1559    pub citations: Option<Option<ResponseCitationConfig>>,
1560    pub source: ResponseDocumentSource,
1561    #[serde(
1562        default,
1563        deserialize_with = "present_nullable",
1564        skip_serializing_if = "Option::is_none"
1565    )]
1566    pub title: Option<Option<String>>,
1567    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1568    pub rest: Rest,
1569}
1570
1571#[derive(
1572    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1573)]
1574#[serde(rename_all = "snake_case")]
1575#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1576#[derive(gproxy_protocol_macros::DeclaredFields)]
1577#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1578pub struct ResponseCitationConfig {
1579    pub enabled: bool,
1580    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1581    pub rest: Rest,
1582}
1583
1584#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1585#[serde(tag = "type")]
1586#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1587#[derive(gproxy_protocol_macros::DeclaredFields)]
1588#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1589pub enum ResponseDocumentSource {
1590    #[serde(rename = "base64")]
1591    Base64(content::PdfBase64Source),
1592    #[serde(rename = "text")]
1593    Text(content::PlainTextSource),
1594}
1595
1596#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1597#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1598#[derive(gproxy_protocol_macros::DeclaredFields)]
1599#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1600pub enum ResponseAdvisorToolResultBlockType {
1601    #[serde(rename = "advisor_tool_result")]
1602    Tag,
1603}
1604
1605#[derive(
1606    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1607)]
1608#[serde(rename_all = "snake_case")]
1609#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1610#[derive(gproxy_protocol_macros::DeclaredFields)]
1611#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1612pub struct ResponseAdvisorToolResultBlock {
1613    #[serde(rename = "type")]
1614    pub type_: ResponseAdvisorToolResultBlockType,
1615    pub content: ResponseAdvisorResultContent,
1616    pub tool_use_id: String,
1617    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1618    pub rest: Rest,
1619}
1620
1621#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1622#[serde(untagged)]
1623#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1624#[derive(gproxy_protocol_macros::DeclaredFields)]
1625#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1626pub enum ResponseAdvisorResultContent {
1627    Error(content::AdvisorError),
1628    Result(ResponseAdvisorResult),
1629    Redacted(ResponseAdvisorRedactedResult),
1630}
1631
1632#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1633#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1634#[derive(gproxy_protocol_macros::DeclaredFields)]
1635#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1636pub enum ResponseAdvisorResultType {
1637    #[serde(rename = "advisor_result")]
1638    Tag,
1639}
1640
1641#[derive(
1642    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1643)]
1644#[serde(rename_all = "snake_case")]
1645#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1646#[derive(gproxy_protocol_macros::DeclaredFields)]
1647#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1648pub struct ResponseAdvisorResult {
1649    #[serde(rename = "type")]
1650    pub type_: ResponseAdvisorResultType,
1651    #[serde(
1652        default,
1653        deserialize_with = "present_nullable",
1654        skip_serializing_if = "Option::is_none"
1655    )]
1656    pub stop_reason: Option<Option<String>>,
1657    pub text: String,
1658    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1659    pub rest: Rest,
1660}
1661
1662#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1663#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1664#[derive(gproxy_protocol_macros::DeclaredFields)]
1665#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1666pub enum ResponseAdvisorRedactedResultType {
1667    #[serde(rename = "advisor_redacted_result")]
1668    Tag,
1669}
1670
1671#[derive(
1672    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1673)]
1674#[serde(rename_all = "snake_case")]
1675#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1676#[derive(gproxy_protocol_macros::DeclaredFields)]
1677#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1678pub struct ResponseAdvisorRedactedResult {
1679    #[serde(rename = "type")]
1680    pub type_: ResponseAdvisorRedactedResultType,
1681    pub encrypted_content: String,
1682    #[serde(
1683        default,
1684        deserialize_with = "present_nullable",
1685        skip_serializing_if = "Option::is_none"
1686    )]
1687    pub stop_reason: Option<Option<String>>,
1688    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1689    pub rest: Rest,
1690}
1691
1692#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1693#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1694#[derive(gproxy_protocol_macros::DeclaredFields)]
1695#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1696pub enum ResponseCodeExecutionToolResultBlockType {
1697    #[serde(rename = "code_execution_tool_result")]
1698    Tag,
1699}
1700
1701#[derive(
1702    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1703)]
1704#[serde(rename_all = "snake_case")]
1705#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1706#[derive(gproxy_protocol_macros::DeclaredFields)]
1707#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1708pub struct ResponseCodeExecutionToolResultBlock {
1709    #[serde(rename = "type")]
1710    pub type_: ResponseCodeExecutionToolResultBlockType,
1711    pub content: content::CodeExecutionResultContent,
1712    pub tool_use_id: String,
1713    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1714    pub rest: Rest,
1715}
1716
1717#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1718#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1719#[derive(gproxy_protocol_macros::DeclaredFields)]
1720#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1721pub enum ResponseBashCodeExecutionToolResultBlockType {
1722    #[serde(rename = "bash_code_execution_tool_result")]
1723    Tag,
1724}
1725
1726#[derive(
1727    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1728)]
1729#[serde(rename_all = "snake_case")]
1730#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1731#[derive(gproxy_protocol_macros::DeclaredFields)]
1732#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1733pub struct ResponseBashCodeExecutionToolResultBlock {
1734    #[serde(rename = "type")]
1735    pub type_: ResponseBashCodeExecutionToolResultBlockType,
1736    pub content: content::BashCodeExecutionResultContent,
1737    pub tool_use_id: String,
1738    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1739    pub rest: Rest,
1740}
1741
1742#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1743#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1744#[derive(gproxy_protocol_macros::DeclaredFields)]
1745#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1746pub enum ResponseTextEditorCodeExecutionToolResultBlockType {
1747    #[serde(rename = "text_editor_code_execution_tool_result")]
1748    Tag,
1749}
1750
1751#[derive(
1752    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1753)]
1754#[serde(rename_all = "snake_case")]
1755#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1756#[derive(gproxy_protocol_macros::DeclaredFields)]
1757#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1758pub struct ResponseTextEditorCodeExecutionToolResultBlock {
1759    #[serde(rename = "type")]
1760    pub type_: ResponseTextEditorCodeExecutionToolResultBlockType,
1761    pub content: ResponseTextEditorResultContent,
1762    pub tool_use_id: String,
1763    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1764    pub rest: Rest,
1765}
1766
1767#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1768#[serde(untagged)]
1769#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1770#[derive(gproxy_protocol_macros::DeclaredFields)]
1771#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1772pub enum ResponseTextEditorResultContent {
1773    Error(ResponseTextEditorError),
1774    View(ResponseTextEditorViewResult),
1775    Create(content::TextEditorCreateResult),
1776    Replace(ResponseTextEditorReplaceResult),
1777}
1778
1779#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1780#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1781#[derive(gproxy_protocol_macros::DeclaredFields)]
1782#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1783pub enum ResponseTextEditorErrorType {
1784    #[serde(rename = "text_editor_code_execution_tool_result_error")]
1785    Tag,
1786}
1787
1788#[derive(
1789    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1790)]
1791#[serde(rename_all = "snake_case")]
1792#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1793#[derive(gproxy_protocol_macros::DeclaredFields)]
1794#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1795pub struct ResponseTextEditorError {
1796    #[serde(rename = "type")]
1797    pub type_: ResponseTextEditorErrorType,
1798    pub error_code: content::TextEditorErrorCode,
1799    #[serde(
1800        default,
1801        deserialize_with = "present_nullable",
1802        skip_serializing_if = "Option::is_none"
1803    )]
1804    pub error_message: Option<Option<String>>,
1805    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1806    pub rest: Rest,
1807}
1808
1809#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1810#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1811#[derive(gproxy_protocol_macros::DeclaredFields)]
1812#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1813pub enum ResponseTextEditorViewResultType {
1814    #[serde(rename = "text_editor_code_execution_view_result")]
1815    Tag,
1816}
1817
1818#[derive(
1819    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1820)]
1821#[serde(rename_all = "snake_case")]
1822#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1823#[derive(gproxy_protocol_macros::DeclaredFields)]
1824#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1825pub struct ResponseTextEditorViewResult {
1826    #[serde(rename = "type")]
1827    pub type_: ResponseTextEditorViewResultType,
1828    pub content: String,
1829    pub file_type: content::TextEditorFileType,
1830    #[serde(
1831        default,
1832        deserialize_with = "present_nullable",
1833        skip_serializing_if = "Option::is_none"
1834    )]
1835    pub num_lines: Option<Option<i64>>,
1836    #[serde(
1837        default,
1838        deserialize_with = "present_nullable",
1839        skip_serializing_if = "Option::is_none"
1840    )]
1841    pub start_line: Option<Option<i64>>,
1842    #[serde(
1843        default,
1844        deserialize_with = "present_nullable",
1845        skip_serializing_if = "Option::is_none"
1846    )]
1847    pub total_lines: Option<Option<i64>>,
1848    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1849    pub rest: Rest,
1850}
1851
1852#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1853#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1854#[derive(gproxy_protocol_macros::DeclaredFields)]
1855#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1856pub enum ResponseTextEditorReplaceResultType {
1857    #[serde(rename = "text_editor_code_execution_str_replace_result")]
1858    Tag,
1859}
1860
1861#[derive(
1862    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1863)]
1864#[serde(rename_all = "snake_case")]
1865#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1866#[derive(gproxy_protocol_macros::DeclaredFields)]
1867#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1868pub struct ResponseTextEditorReplaceResult {
1869    #[serde(rename = "type")]
1870    pub type_: ResponseTextEditorReplaceResultType,
1871    #[serde(
1872        default,
1873        deserialize_with = "present_nullable",
1874        skip_serializing_if = "Option::is_none"
1875    )]
1876    pub lines: Option<Option<Vec<String>>>,
1877    #[serde(
1878        default,
1879        deserialize_with = "present_nullable",
1880        skip_serializing_if = "Option::is_none"
1881    )]
1882    pub new_lines: Option<Option<i64>>,
1883    #[serde(
1884        default,
1885        deserialize_with = "present_nullable",
1886        skip_serializing_if = "Option::is_none"
1887    )]
1888    pub new_start: Option<Option<i64>>,
1889    #[serde(
1890        default,
1891        deserialize_with = "present_nullable",
1892        skip_serializing_if = "Option::is_none"
1893    )]
1894    pub old_lines: Option<Option<i64>>,
1895    #[serde(
1896        default,
1897        deserialize_with = "present_nullable",
1898        skip_serializing_if = "Option::is_none"
1899    )]
1900    pub old_start: Option<Option<i64>>,
1901    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1902    pub rest: Rest,
1903}
1904
1905#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1906#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1907#[derive(gproxy_protocol_macros::DeclaredFields)]
1908#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1909pub enum ResponseToolSearchToolResultBlockType {
1910    #[serde(rename = "tool_search_tool_result")]
1911    Tag,
1912}
1913
1914#[derive(
1915    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1916)]
1917#[serde(rename_all = "snake_case")]
1918#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1919#[derive(gproxy_protocol_macros::DeclaredFields)]
1920#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1921pub struct ResponseToolSearchToolResultBlock {
1922    #[serde(rename = "type")]
1923    pub type_: ResponseToolSearchToolResultBlockType,
1924    pub content: ResponseToolSearchResultContent,
1925    pub tool_use_id: String,
1926    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1927    pub rest: Rest,
1928}
1929
1930#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
1931#[serde(untagged)]
1932#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1933#[derive(gproxy_protocol_macros::DeclaredFields)]
1934#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1935pub enum ResponseToolSearchResultContent {
1936    Error(ResponseToolSearchError),
1937    Search(ResponseToolSearchResults),
1938}
1939
1940#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1941#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1942#[derive(gproxy_protocol_macros::DeclaredFields)]
1943#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1944pub enum ResponseToolSearchErrorType {
1945    #[serde(rename = "tool_search_tool_result_error")]
1946    Tag,
1947}
1948
1949#[derive(
1950    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1951)]
1952#[serde(rename_all = "snake_case")]
1953#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1954#[derive(gproxy_protocol_macros::DeclaredFields)]
1955#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1956pub struct ResponseToolSearchError {
1957    #[serde(rename = "type")]
1958    pub type_: ResponseToolSearchErrorType,
1959    pub error_code: content::ToolSearchErrorCode,
1960    #[serde(
1961        default,
1962        deserialize_with = "present_nullable",
1963        skip_serializing_if = "Option::is_none"
1964    )]
1965    pub error_message: Option<Option<String>>,
1966    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1967    pub rest: Rest,
1968}
1969
1970#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1971#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1972#[derive(gproxy_protocol_macros::DeclaredFields)]
1973#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1974pub enum ResponseToolSearchResultsType {
1975    #[serde(rename = "tool_search_tool_search_result")]
1976    Tag,
1977}
1978
1979#[derive(
1980    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
1981)]
1982#[serde(rename_all = "snake_case")]
1983#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1984#[derive(gproxy_protocol_macros::DeclaredFields)]
1985#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1986pub struct ResponseToolSearchResults {
1987    #[serde(rename = "type")]
1988    pub type_: ResponseToolSearchResultsType,
1989    pub tool_references: Vec<ResponseToolReferenceBlock>,
1990    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1991    pub rest: Rest,
1992}
1993
1994#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1995#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
1996#[derive(gproxy_protocol_macros::DeclaredFields)]
1997#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1998pub enum ResponseToolReferenceBlockType {
1999    #[serde(rename = "tool_reference")]
2000    Tag,
2001}
2002
2003#[derive(
2004    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2005)]
2006#[serde(rename_all = "snake_case")]
2007#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2008#[derive(gproxy_protocol_macros::DeclaredFields)]
2009#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2010pub struct ResponseToolReferenceBlock {
2011    #[serde(rename = "type")]
2012    pub type_: ResponseToolReferenceBlockType,
2013    pub tool_name: String,
2014    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2015    pub rest: Rest,
2016}
2017
2018#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2019#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2020#[derive(gproxy_protocol_macros::DeclaredFields)]
2021#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2022pub enum ResponseMcpToolUseBlockType {
2023    #[serde(rename = "mcp_tool_use")]
2024    Tag,
2025}
2026
2027#[derive(
2028    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2029)]
2030#[serde(rename_all = "snake_case")]
2031#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2032#[derive(gproxy_protocol_macros::DeclaredFields)]
2033#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2034pub struct ResponseMcpToolUseBlock {
2035    #[serde(rename = "type")]
2036    pub type_: ResponseMcpToolUseBlockType,
2037    pub id: String,
2038    pub input: serde_json::Map<String, serde_json::Value>,
2039    pub name: String,
2040    pub server_name: String,
2041    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2042    pub rest: Rest,
2043}
2044
2045#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2046#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2047#[derive(gproxy_protocol_macros::DeclaredFields)]
2048#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2049pub enum ResponseMcpToolResultBlockType {
2050    #[serde(rename = "mcp_tool_result")]
2051    Tag,
2052}
2053
2054#[derive(
2055    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2056)]
2057#[serde(rename_all = "snake_case")]
2058#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2059#[derive(gproxy_protocol_macros::DeclaredFields)]
2060#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2061pub struct ResponseMcpToolResultBlock {
2062    #[serde(rename = "type")]
2063    pub type_: ResponseMcpToolResultBlockType,
2064    pub content: ResponseMcpResultContent,
2065    pub is_error: bool,
2066    pub tool_use_id: String,
2067    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2068    pub rest: Rest,
2069}
2070
2071#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
2072#[serde(untagged)]
2073#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2074#[derive(gproxy_protocol_macros::DeclaredFields)]
2075#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2076pub enum ResponseMcpResultContent {
2077    Text(String),
2078    Blocks(Vec<ResponseTextBlock>),
2079}
2080
2081#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2082#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2083#[derive(gproxy_protocol_macros::DeclaredFields)]
2084#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2085pub enum ResponseContainerUploadBlockType {
2086    #[serde(rename = "container_upload")]
2087    Tag,
2088}
2089
2090#[derive(
2091    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2092)]
2093#[serde(rename_all = "snake_case")]
2094#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2095#[derive(gproxy_protocol_macros::DeclaredFields)]
2096#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2097pub struct ResponseContainerUploadBlock {
2098    #[serde(rename = "type")]
2099    pub type_: ResponseContainerUploadBlockType,
2100    pub file_id: String,
2101    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2102    pub rest: Rest,
2103}
2104
2105#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2106#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2107#[derive(gproxy_protocol_macros::DeclaredFields)]
2108#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2109pub enum ResponseCompactionBlockType {
2110    #[serde(rename = "compaction")]
2111    Tag,
2112}
2113
2114#[derive(
2115    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2116)]
2117#[serde(rename_all = "snake_case")]
2118#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2119#[derive(gproxy_protocol_macros::DeclaredFields)]
2120#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2121pub struct ResponseCompactionBlock {
2122    #[serde(
2123        default,
2124        deserialize_with = "present_nullable",
2125        skip_serializing_if = "Option::is_none"
2126    )]
2127    pub signature: Option<Option<String>>,
2128
2129    #[serde(rename = "type")]
2130    pub type_: ResponseCompactionBlockType,
2131    #[serde(
2132        default,
2133        deserialize_with = "present_nullable",
2134        skip_serializing_if = "Option::is_none"
2135    )]
2136    pub content: Option<Option<String>>,
2137    #[serde(
2138        default,
2139        deserialize_with = "present_nullable",
2140        skip_serializing_if = "Option::is_none"
2141    )]
2142    pub encrypted_content: Option<Option<String>>,
2143    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2144    pub rest: Rest,
2145}
2146
2147#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2148#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2149#[derive(gproxy_protocol_macros::DeclaredFields)]
2150#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2151pub enum ResponseFallbackBlockType {
2152    #[serde(rename = "fallback")]
2153    Tag,
2154}
2155
2156#[derive(
2157    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2158)]
2159#[serde(rename_all = "snake_case")]
2160#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2161#[derive(gproxy_protocol_macros::DeclaredFields)]
2162#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2163pub struct ResponseFallbackBlock {
2164    #[serde(rename = "type")]
2165    pub type_: ResponseFallbackBlockType,
2166    pub from: content::FallbackInfo,
2167    pub to: content::FallbackInfo,
2168    pub trigger: FallbackRefusalTrigger,
2169    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2170    pub rest: Rest,
2171}
2172
2173#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
2174#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2175#[derive(gproxy_protocol_macros::DeclaredFields)]
2176#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2177pub enum FallbackRefusalTriggerType {
2178    #[serde(rename = "refusal")]
2179    Tag,
2180}
2181
2182#[derive(
2183    Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
2184)]
2185#[serde(rename_all = "snake_case")]
2186#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2187#[derive(gproxy_protocol_macros::DeclaredFields)]
2188#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2189pub struct FallbackRefusalTrigger {
2190    #[serde(rename = "type")]
2191    pub type_: FallbackRefusalTriggerType,
2192    #[serde(
2193        default,
2194        deserialize_with = "present_nullable",
2195        skip_serializing_if = "Option::is_none"
2196    )]
2197    pub category: Option<Option<RefusalCategory>>,
2198    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2199    pub rest: Rest,
2200}
2201
2202#[derive(
2203    Debug,
2204    Clone,
2205    Copy,
2206    PartialEq,
2207    Eq,
2208    Serialize,
2209    Deserialize,
2210    gproxy_protocol_macros::DeclaredFields,
2211)]
2212#[serde(rename_all = "snake_case")]
2213#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2214#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2215pub enum CompactionConfigType {
2216    Summarize,
2217}
2218
2219#[derive(
2220    Debug,
2221    Clone,
2222    PartialEq,
2223    Eq,
2224    Serialize,
2225    Deserialize,
2226    gproxy_protocol_macros::WireBuilder,
2227    gproxy_protocol_macros::DeclaredFields,
2228)]
2229#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2230#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2231pub struct CompactionConfig {
2232    #[serde(rename = "type")]
2233    pub type_: CompactionConfigType,
2234    #[serde(skip_serializing_if = "Option::is_none")]
2235    pub instructions: Option<String>,
2236    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2237    pub rest: Rest,
2238}
2239
2240#[derive(
2241    Debug,
2242    Clone,
2243    PartialEq,
2244    Eq,
2245    Serialize,
2246    Deserialize,
2247    gproxy_protocol_macros::WireBuilder,
2248    gproxy_protocol_macros::DeclaredFields,
2249)]
2250#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2251#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2252pub struct InputTransformation {
2253    #[serde(rename = "type")]
2254    pub type_: InputTransformationType,
2255    pub path: String,
2256    pub reason: ThinkingBindingMismatchReason,
2257    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
2258    pub rest: Rest,
2259}
2260
2261#[derive(
2262    Debug,
2263    Clone,
2264    Copy,
2265    PartialEq,
2266    Eq,
2267    Serialize,
2268    Deserialize,
2269    gproxy_protocol_macros::DeclaredFields,
2270)]
2271#[serde(rename_all = "snake_case")]
2272#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2273#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2274pub enum InputTransformationType {
2275    ThinkingDropped,
2276    ThinkingMismatchAllowed,
2277    #[serde(other)]
2278    Unknown,
2279}
2280
2281#[derive(
2282    Debug,
2283    Clone,
2284    Copy,
2285    PartialEq,
2286    Eq,
2287    Serialize,
2288    Deserialize,
2289    gproxy_protocol_macros::DeclaredFields,
2290)]
2291#[serde(rename_all = "snake_case")]
2292#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
2293#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
2294pub enum ThinkingBindingMismatchReason {
2295    ModelBindingMismatch,
2296    PrefixBindingMismatch,
2297    OrganizationBindingMismatch,
2298    EndUserBindingMismatch,
2299    #[serde(other)]
2300    Unknown,
2301}