1use super::generate;
5use super::input::{self, present_nullable, present_optional, required_nullable};
6use super::tools;
7use crate::Rest;
8use serde::{Deserialize, Serialize};
9use std::collections::BTreeMap;
10
11pub type GenerateContentResponse = crate::WireResponse<GenerateContentResponseBody>;
12pub type ResponseInstructions = input::Input;
14
15#[derive(
16 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
17)]
18#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
19#[derive(gproxy_protocol_macros::DeclaredFields)]
20pub struct GenerateContentResponseBody {
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub prompt_cache_diagnostics: Option<super::diagnostics::PromptCacheDiagnostics>,
23
24 pub id: String,
25 pub created_at: i64,
26 #[wire(required)]
27 #[serde(deserialize_with = "required_nullable")]
28 pub error: Option<ResponseError>,
29 #[wire(required)]
30 #[serde(deserialize_with = "required_nullable")]
31 pub incomplete_details: Option<ResponseIncompleteDetails>,
32 #[wire(required)]
33 #[serde(deserialize_with = "required_nullable")]
34 pub instructions: Option<ResponseInstructions>,
35 #[wire(required)]
36 #[serde(deserialize_with = "required_nullable")]
37 pub metadata: Option<BTreeMap<String, String>>,
38 pub model: String,
39 pub object: ResponseObject,
40 pub output: Vec<ResponseOutputItem>,
41 pub parallel_tool_calls: bool,
42 #[wire(required)]
43 #[serde(deserialize_with = "required_nullable")]
44 pub temperature: Option<serde_json::Number>,
45 pub tool_choice: input::ToolChoice,
46 pub tools: Vec<tools::Tool>,
47 #[wire(required)]
48 #[serde(deserialize_with = "required_nullable")]
49 pub top_p: Option<serde_json::Number>,
50 #[serde(
51 default,
52 deserialize_with = "present_nullable",
53 skip_serializing_if = "Option::is_none"
54 )]
55 pub background: Option<Option<bool>>,
56 #[serde(
57 default,
58 deserialize_with = "present_nullable",
59 skip_serializing_if = "Option::is_none"
60 )]
61 pub completed_at: Option<Option<i64>>,
62 #[serde(
63 default,
64 deserialize_with = "present_nullable",
65 skip_serializing_if = "Option::is_none"
66 )]
67 pub conversation: Option<Option<input::ResponseConversationParam>>,
68 #[serde(
69 default,
70 deserialize_with = "present_nullable",
71 skip_serializing_if = "Option::is_none"
72 )]
73 pub max_output_tokens: Option<Option<i64>>,
74 #[serde(
75 default,
76 deserialize_with = "present_nullable",
77 skip_serializing_if = "Option::is_none"
78 )]
79 pub max_tool_calls: Option<Option<i64>>,
80 #[serde(
81 default,
82 deserialize_with = "present_nullable",
83 skip_serializing_if = "Option::is_none"
84 )]
85 pub moderation: Option<Option<ResponseModerationReport>>,
86 #[serde(
87 default,
88 deserialize_with = "present_nullable",
89 skip_serializing_if = "Option::is_none"
90 )]
91 pub output_text: Option<Option<String>>,
92 #[serde(
93 default,
94 deserialize_with = "present_nullable",
95 skip_serializing_if = "Option::is_none"
96 )]
97 pub previous_response_id: Option<Option<String>>,
98 #[serde(
99 default,
100 deserialize_with = "present_nullable",
101 skip_serializing_if = "Option::is_none"
102 )]
103 pub prompt: Option<Option<generate::ResponsePrompt>>,
104 #[serde(
105 default,
106 deserialize_with = "present_nullable",
107 skip_serializing_if = "Option::is_none"
108 )]
109 pub prompt_cache_key: Option<Option<String>>,
110 #[serde(
111 default,
112 deserialize_with = "present_optional",
113 skip_serializing_if = "Option::is_none"
114 )]
115 pub prompt_cache_options: Option<ResponsePromptCacheOptions>,
116 #[serde(
117 default,
118 deserialize_with = "present_nullable",
119 skip_serializing_if = "Option::is_none"
120 )]
121 pub prompt_cache_retention: Option<Option<generate::PromptCacheRetention>>,
122 #[serde(
123 default,
124 deserialize_with = "present_nullable",
125 skip_serializing_if = "Option::is_none"
126 )]
127 pub reasoning: Option<Option<input::ReasoningConfig>>,
128 #[serde(
129 default,
130 deserialize_with = "present_nullable",
131 skip_serializing_if = "Option::is_none"
132 )]
133 pub safety_identifier: Option<Option<String>>,
134 #[serde(
135 default,
136 deserialize_with = "present_nullable",
137 skip_serializing_if = "Option::is_none"
138 )]
139 pub service_tier: Option<Option<generate::ServiceTier>>,
140 #[serde(
141 default,
142 deserialize_with = "present_optional",
143 skip_serializing_if = "Option::is_none"
144 )]
145 pub status: Option<ResponseStatus>,
146 #[serde(
147 default,
148 deserialize_with = "present_optional",
149 skip_serializing_if = "Option::is_none"
150 )]
151 pub text: Option<input::TextConfig>,
152 #[serde(
153 default,
154 deserialize_with = "present_nullable",
155 skip_serializing_if = "Option::is_none"
156 )]
157 pub top_logprobs: Option<Option<i64>>,
158 #[serde(
159 default,
160 deserialize_with = "present_nullable",
161 skip_serializing_if = "Option::is_none"
162 )]
163 pub truncation: Option<Option<generate::GenerateTruncation>>,
164 #[serde(
165 default,
166 deserialize_with = "present_nullable",
167 skip_serializing_if = "Option::is_none"
168 )]
169 pub usage: Option<Option<ResponseUsage>>,
170 #[serde(
171 default,
172 deserialize_with = "present_nullable",
173 skip_serializing_if = "Option::is_none"
174 )]
175 pub user: Option<Option<String>>,
176 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
177 pub rest: Rest,
178}
179
180#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
181#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
182#[derive(gproxy_protocol_macros::DeclaredFields)]
183pub enum ResponseObject {
184 #[serde(rename = "response")]
185 Response,
186}
187
188#[derive(
189 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
190)]
191#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
192#[derive(gproxy_protocol_macros::DeclaredFields)]
193pub struct ResponseError {
194 #[serde(skip_serializing_if = "Option::is_none")]
195 pub misalignment: Option<MisalignmentDetails>,
196
197 pub code: ResponseErrorCode,
198 pub message: String,
199 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
200 pub rest: Rest,
201}
202
203#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
204#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
205#[derive(gproxy_protocol_macros::DeclaredFields)]
206pub enum ResponseErrorCode {
207 #[serde(rename = "server_error")]
208 ServerError,
209 #[serde(rename = "rate_limit_exceeded")]
210 RateLimitExceeded,
211 #[serde(rename = "invalid_prompt")]
212 InvalidPrompt,
213 #[serde(rename = "data_residency_mismatch")]
214 DataResidencyMismatch,
215 #[serde(rename = "bio_policy")]
216 BioPolicy,
217 #[serde(rename = "vector_store_timeout")]
218 VectorStoreTimeout,
219 #[serde(rename = "invalid_image")]
220 InvalidImage,
221 #[serde(rename = "invalid_image_format")]
222 InvalidImageFormat,
223 #[serde(rename = "invalid_base64_image")]
224 InvalidBase64Image,
225 #[serde(rename = "invalid_image_url")]
226 InvalidImageUrl,
227 #[serde(rename = "image_too_large")]
228 ImageTooLarge,
229 #[serde(rename = "image_too_small")]
230 ImageTooSmall,
231 #[serde(rename = "image_parse_error")]
232 ImageParseError,
233 #[serde(rename = "image_content_policy_violation")]
234 ImageContentPolicyViolation,
235 #[serde(rename = "invalid_image_mode")]
236 InvalidImageMode,
237 #[serde(rename = "image_file_too_large")]
238 ImageFileTooLarge,
239 #[serde(rename = "unsupported_image_media_type")]
240 UnsupportedImageMediaType,
241 #[serde(rename = "empty_image_file")]
242 EmptyImageFile,
243 #[serde(rename = "failed_to_download_image")]
244 FailedToDownloadImage,
245 #[serde(rename = "image_file_not_found")]
246 ImageFileNotFound,
247}
248
249#[derive(
250 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
251)]
252#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
253#[derive(gproxy_protocol_macros::DeclaredFields)]
254pub struct ResponseIncompleteDetails {
255 #[serde(
256 default,
257 deserialize_with = "present_optional",
258 skip_serializing_if = "Option::is_none"
259 )]
260 pub reason: Option<ResponseIncompleteReason>,
261 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
262 pub rest: Rest,
263}
264
265#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
266#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
267#[derive(gproxy_protocol_macros::DeclaredFields)]
268pub enum ResponseIncompleteReason {
269 #[serde(rename = "max_messages")]
270 MaxMessages,
271 #[serde(rename = "steered")]
272 Steered,
273 #[serde(rename = "interrupted")]
274 Interrupted,
275 #[serde(rename = "max_output_tokens")]
276 MaxOutputTokens,
277 #[serde(rename = "content_filter")]
278 ContentFilter,
279}
280
281#[derive(
282 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
283)]
284#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
285#[derive(gproxy_protocol_macros::DeclaredFields)]
286pub struct ResponsePromptCacheOptions {
287 #[serde(
288 default,
289 deserialize_with = "present_nullable",
290 skip_serializing_if = "Option::is_none"
291 )]
292 pub comparison_response_id: Option<Option<String>>,
293
294 pub mode: generate::PromptCachingMode,
295 pub ttl: generate::PromptCacheTtl,
296 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
297 pub rest: Rest,
298}
299
300#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
301#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
302#[derive(gproxy_protocol_macros::DeclaredFields)]
303pub enum ResponseStatus {
304 #[serde(rename = "completed")]
305 Completed,
306 #[serde(rename = "failed")]
307 Failed,
308 #[serde(rename = "in_progress")]
309 InProgress,
310 #[serde(rename = "cancelled")]
311 Cancelled,
312 #[serde(rename = "queued")]
313 Queued,
314 #[serde(rename = "incomplete")]
315 Incomplete,
316}
317
318#[derive(
319 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
320)]
321#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
322#[derive(gproxy_protocol_macros::DeclaredFields)]
323pub struct ResponseModerationReport {
324 pub input: ResponseModerationOutcome,
325 pub output: ResponseModerationOutcome,
326 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
327 pub rest: Rest,
328}
329
330#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
331#[serde(untagged)]
332#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
333#[derive(gproxy_protocol_macros::DeclaredFields)]
334pub enum ResponseModerationOutcome {
335 Result(ResponseModerationResult),
336 Error(ResponseModerationError),
337}
338
339#[derive(
340 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
341)]
342#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
343#[derive(gproxy_protocol_macros::DeclaredFields)]
344pub struct ResponseModerationResult {
345 pub categories: BTreeMap<String, bool>,
346 pub category_applied_input_types: BTreeMap<String, Vec<ResponseModerationInputType>>,
347 pub category_scores: BTreeMap<String, serde_json::Number>,
348 pub flagged: bool,
349 pub model: String,
350 #[serde(rename = "type")]
351 pub type_: ResponseModerationResultType,
352 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
353 pub rest: Rest,
354}
355
356#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
357#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
358#[derive(gproxy_protocol_macros::DeclaredFields)]
359pub enum ResponseModerationInputType {
360 #[serde(rename = "text")]
361 Text,
362 #[serde(rename = "image")]
363 Image,
364}
365
366#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
367#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
368#[derive(gproxy_protocol_macros::DeclaredFields)]
369pub enum ResponseModerationResultType {
370 #[serde(rename = "moderation_result")]
371 ModerationResult,
372}
373
374#[derive(
375 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
376)]
377#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
378#[derive(gproxy_protocol_macros::DeclaredFields)]
379pub struct ResponseModerationError {
380 pub code: String,
381 pub message: String,
382 #[serde(rename = "type")]
383 pub type_: ResponseModerationErrorType,
384 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
385 pub rest: Rest,
386}
387
388#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
389#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
390#[derive(gproxy_protocol_macros::DeclaredFields)]
391pub enum ResponseModerationErrorType {
392 #[serde(rename = "error")]
393 Error,
394}
395
396#[derive(
397 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
398)]
399#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
400#[derive(gproxy_protocol_macros::DeclaredFields)]
401pub struct ResponseUsage {
402 pub input_tokens: i64,
403 pub input_tokens_details: ResponseInputTokensDetails,
404 pub output_tokens: i64,
405 pub output_tokens_details: ResponseOutputTokensDetails,
406 pub total_tokens: i64,
407 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
408 pub rest: Rest,
409}
410
411#[derive(
412 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
413)]
414#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
415#[derive(gproxy_protocol_macros::DeclaredFields)]
416pub struct ResponseInputTokensDetails {
417 pub cache_write_tokens: i64,
418 pub cached_tokens: i64,
419 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
420 pub rest: Rest,
421}
422
423#[derive(
424 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
425)]
426#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
427#[derive(gproxy_protocol_macros::DeclaredFields)]
428pub struct ResponseOutputTokensDetails {
429 pub reasoning_tokens: i64,
430 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
431 pub rest: Rest,
432}
433
434#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
437#[serde(untagged)]
438#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
439#[derive(gproxy_protocol_macros::DeclaredFields)]
440pub enum ResponseOutputItem {
441 MultiAgentCall(super::multi_agent::ResponseMultiAgentCall),
442 MultiAgentCallOutput(super::multi_agent::ResponseMultiAgentCallOutput),
443 AgentMessage(super::multi_agent::ResponseAgentMessage),
444 ConfigurationUpdate(input::ConfigurationUpdate),
445 Message(input::ResponseOutputMessage),
446 FileSearchCall(input::FileSearchCall),
447 FunctionCall(input::FunctionCall),
448 FunctionCallOutput(ResponseFunctionCallOutput),
449 WebSearchCall(input::WebSearchCall),
450 ComputerCall(input::ComputerCall),
451 ComputerCallOutput(ResponseComputerCallOutput),
452 Reasoning(input::ReasoningItem),
453 Program(input::Program),
454 ProgramOutput(input::ProgramOutput),
455 ToolSearchCall(ResponseToolSearchCall),
456 ToolSearchOutput(ResponseToolSearchOutput),
457 AdditionalTools(ResponseAdditionalTools),
458 Compaction(ResponseCompaction),
459 ImageGenerationCall(input::ImageGenerationCall),
460 CodeInterpreterCall(input::CodeInterpreterCall),
461 LocalShellCall(input::LocalShellCall),
462 LocalShellCallOutput(input::LocalShellCallOutput),
463 ShellCall(ResponseShellCall),
464 ShellCallOutput(ResponseShellCallOutput),
465 ApplyPatchCall(ResponseApplyPatchCall),
466 ApplyPatchCallOutput(ResponseApplyPatchCallOutput),
467 McpCall(input::McpCall),
468 McpListTools(input::McpListTools),
469 McpApprovalRequest(input::McpApprovalRequest),
470 McpApprovalResponse(ResponseMcpApprovalResponse),
471 CustomToolCall(input::CustomToolCall),
472 CustomToolCallOutput(ResponseCustomToolCallOutput),
473}
474
475#[derive(
476 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
477)]
478#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
479#[derive(gproxy_protocol_macros::DeclaredFields)]
480pub struct ResponseFunctionCallOutput {
481 #[serde(
482 default,
483 deserialize_with = "super::input::present_nullable",
484 skip_serializing_if = "Option::is_none"
485 )]
486 pub agent: Option<Option<super::multi_agent::Agent>>,
487 pub id: String,
488 pub call_id: String,
489 pub output: input::CustomOutput,
490 pub status: input::ItemStatus,
491 #[serde(rename = "type")]
492 pub type_: input::FunctionCallOutputType,
493 #[serde(
494 default,
495 deserialize_with = "present_nullable",
496 skip_serializing_if = "Option::is_none"
497 )]
498 pub caller: Option<Option<input::Caller>>,
499 #[serde(
500 default,
501 deserialize_with = "present_optional",
502 skip_serializing_if = "Option::is_none"
503 )]
504 pub created_by: Option<String>,
505 #[serde(
506 default,
507 deserialize_with = "present_optional",
508 skip_serializing_if = "Option::is_none"
509 )]
510 pub name: Option<String>,
511 #[serde(
512 default,
513 deserialize_with = "present_optional",
514 skip_serializing_if = "Option::is_none"
515 )]
516 pub namespace: Option<String>,
517 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
518 pub rest: Rest,
519}
520
521#[derive(
522 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
523)]
524#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
525#[derive(gproxy_protocol_macros::DeclaredFields)]
526pub struct ResponseComputerCallOutput {
527 #[serde(
528 default,
529 deserialize_with = "super::input::present_nullable",
530 skip_serializing_if = "Option::is_none"
531 )]
532 pub agent: Option<Option<super::multi_agent::Agent>>,
533 pub id: String,
534 pub call_id: String,
535 pub output: input::ComputerScreenshot,
536 pub status: ResponseComputerOutputStatus,
537 #[serde(rename = "type")]
538 pub type_: input::ComputerCallOutputType,
539 #[serde(
540 default,
541 deserialize_with = "present_optional",
542 skip_serializing_if = "Option::is_none"
543 )]
544 pub acknowledged_safety_checks: Option<Vec<input::PendingSafetyCheck>>,
545 #[serde(
546 default,
547 deserialize_with = "present_optional",
548 skip_serializing_if = "Option::is_none"
549 )]
550 pub created_by: Option<String>,
551 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
552 pub rest: Rest,
553}
554
555#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
556#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
557#[derive(gproxy_protocol_macros::DeclaredFields)]
558pub enum ResponseComputerOutputStatus {
559 #[serde(rename = "completed")]
560 Completed,
561 #[serde(rename = "incomplete")]
562 Incomplete,
563 #[serde(rename = "failed")]
564 Failed,
565 #[serde(rename = "in_progress")]
566 InProgress,
567}
568
569#[derive(
570 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
571)]
572#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
573#[derive(gproxy_protocol_macros::DeclaredFields)]
574pub struct ResponseToolSearchCall {
575 #[serde(
576 default,
577 deserialize_with = "super::input::present_nullable",
578 skip_serializing_if = "Option::is_none"
579 )]
580 pub agent: Option<Option<super::multi_agent::Agent>>,
581 pub id: String,
582 pub arguments: serde_json::Value,
584 #[wire(required)]
585 #[serde(deserialize_with = "required_nullable")]
586 pub call_id: Option<String>,
587 pub execution: tools::ToolExecution,
588 pub status: input::ItemStatus,
589 #[serde(rename = "type")]
590 pub type_: input::ToolSearchCallType,
591 #[serde(
592 default,
593 deserialize_with = "present_optional",
594 skip_serializing_if = "Option::is_none"
595 )]
596 pub created_by: Option<String>,
597 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
598 pub rest: Rest,
599}
600
601#[derive(
602 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
603)]
604#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
605#[derive(gproxy_protocol_macros::DeclaredFields)]
606pub struct ResponseToolSearchOutput {
607 #[serde(
608 default,
609 deserialize_with = "super::input::present_nullable",
610 skip_serializing_if = "Option::is_none"
611 )]
612 pub agent: Option<Option<super::multi_agent::Agent>>,
613 pub id: String,
614 #[wire(required)]
615 #[serde(deserialize_with = "required_nullable")]
616 pub call_id: Option<String>,
617 pub execution: tools::ToolExecution,
618 pub status: input::ItemStatus,
619 pub tools: Vec<tools::Tool>,
620 #[serde(rename = "type")]
621 pub type_: input::ToolSearchOutputType,
622 #[serde(
623 default,
624 deserialize_with = "present_optional",
625 skip_serializing_if = "Option::is_none"
626 )]
627 pub created_by: Option<String>,
628 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
629 pub rest: Rest,
630}
631
632#[derive(
633 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
634)]
635#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
636#[derive(gproxy_protocol_macros::DeclaredFields)]
637pub struct ResponseAdditionalTools {
638 #[serde(
639 default,
640 deserialize_with = "super::input::present_nullable",
641 skip_serializing_if = "Option::is_none"
642 )]
643 pub agent: Option<Option<super::multi_agent::Agent>>,
644 pub id: String,
645 pub role: ResponseAdditionalToolsRole,
646 pub tools: Vec<tools::Tool>,
647 #[serde(rename = "type")]
648 pub type_: input::AdditionalToolsType,
649 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
650 pub rest: Rest,
651}
652
653#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
654#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
655#[derive(gproxy_protocol_macros::DeclaredFields)]
656pub enum ResponseAdditionalToolsRole {
657 #[serde(rename = "unknown")]
658 Unknown,
659 #[serde(rename = "user")]
660 User,
661 #[serde(rename = "assistant")]
662 Assistant,
663 #[serde(rename = "system")]
664 System,
665 #[serde(rename = "critic")]
666 Critic,
667 #[serde(rename = "discriminator")]
668 Discriminator,
669 #[serde(rename = "developer")]
670 Developer,
671 #[serde(rename = "tool")]
672 Tool,
673}
674
675#[derive(
676 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
677)]
678#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
679#[derive(gproxy_protocol_macros::DeclaredFields)]
680pub struct ResponseCompaction {
681 #[serde(
682 default,
683 deserialize_with = "super::input::present_nullable",
684 skip_serializing_if = "Option::is_none"
685 )]
686 pub agent: Option<Option<super::multi_agent::Agent>>,
687 pub id: String,
688 pub encrypted_content: String,
689 #[serde(rename = "type")]
690 pub type_: input::CompactionType,
691 #[serde(
692 default,
693 deserialize_with = "present_optional",
694 skip_serializing_if = "Option::is_none"
695 )]
696 pub created_by: Option<String>,
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#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
705#[derive(gproxy_protocol_macros::DeclaredFields)]
706pub struct ResponseShellCall {
707 #[serde(
708 default,
709 deserialize_with = "super::input::present_nullable",
710 skip_serializing_if = "Option::is_none"
711 )]
712 pub agent: Option<Option<super::multi_agent::Agent>>,
713 pub id: String,
714 pub action: ResponseShellAction,
715 pub call_id: String,
716 #[wire(required)]
717 #[serde(deserialize_with = "required_nullable")]
718 pub environment: Option<ResponseShellEnvironment>,
719 pub status: input::ItemStatus,
720 #[serde(rename = "type")]
721 pub type_: input::ShellCallType,
722 #[serde(
723 default,
724 deserialize_with = "present_nullable",
725 skip_serializing_if = "Option::is_none"
726 )]
727 pub caller: Option<Option<input::Caller>>,
728 #[serde(
729 default,
730 deserialize_with = "present_optional",
731 skip_serializing_if = "Option::is_none"
732 )]
733 pub created_by: Option<String>,
734 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
735 pub rest: Rest,
736}
737
738#[derive(
739 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
740)]
741#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
742#[derive(gproxy_protocol_macros::DeclaredFields)]
743pub struct ResponseShellAction {
744 pub commands: Vec<String>,
745 #[wire(required)]
746 #[serde(deserialize_with = "required_nullable")]
747 pub max_output_length: Option<i64>,
748 #[wire(required)]
749 #[serde(deserialize_with = "required_nullable")]
750 pub timeout_ms: Option<i64>,
751 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
752 pub rest: Rest,
753}
754
755#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
756#[serde(untagged)]
757#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
758#[derive(gproxy_protocol_macros::DeclaredFields)]
759pub enum ResponseShellEnvironment {
760 Local(ResponseLocalEnvironment),
761 Reference(tools::ShellContainerReference),
762}
763
764#[derive(
765 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
766)]
767#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
768#[derive(gproxy_protocol_macros::DeclaredFields)]
769pub struct ResponseLocalEnvironment {
770 #[serde(rename = "type")]
771 pub type_: tools::ShellLocalType,
772 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
773 pub rest: Rest,
774}
775
776#[derive(
777 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
778)]
779#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
780#[derive(gproxy_protocol_macros::DeclaredFields)]
781pub struct ResponseShellCallOutput {
782 #[serde(
783 default,
784 deserialize_with = "super::input::present_nullable",
785 skip_serializing_if = "Option::is_none"
786 )]
787 pub agent: Option<Option<super::multi_agent::Agent>>,
788 pub id: String,
789 pub call_id: String,
790 #[wire(required)]
791 #[serde(deserialize_with = "required_nullable")]
792 pub max_output_length: Option<i64>,
793 pub output: Vec<ResponseShellOutputContent>,
794 pub status: input::ItemStatus,
795 #[serde(rename = "type")]
796 pub type_: input::ShellCallOutputType,
797 #[serde(
798 default,
799 deserialize_with = "present_nullable",
800 skip_serializing_if = "Option::is_none"
801 )]
802 pub caller: Option<Option<input::Caller>>,
803 #[serde(
804 default,
805 deserialize_with = "present_optional",
806 skip_serializing_if = "Option::is_none"
807 )]
808 pub created_by: Option<String>,
809 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
810 pub rest: Rest,
811}
812
813#[derive(
814 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
815)]
816#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
817#[derive(gproxy_protocol_macros::DeclaredFields)]
818pub struct ResponseShellOutputContent {
819 pub outcome: input::ShellOutputOutcome,
820 pub stderr: String,
821 pub stdout: String,
822 #[serde(
823 default,
824 deserialize_with = "present_optional",
825 skip_serializing_if = "Option::is_none"
826 )]
827 pub created_by: Option<String>,
828 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
829 pub rest: Rest,
830}
831
832#[derive(
833 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
834)]
835#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
836#[derive(gproxy_protocol_macros::DeclaredFields)]
837pub struct ResponseApplyPatchCall {
838 #[serde(
839 default,
840 deserialize_with = "super::input::present_nullable",
841 skip_serializing_if = "Option::is_none"
842 )]
843 pub agent: Option<Option<super::multi_agent::Agent>>,
844 pub id: String,
845 pub call_id: String,
846 pub operation: input::ApplyPatchOperation,
847 pub status: input::ApplyPatchStatus,
848 #[serde(rename = "type")]
849 pub type_: input::ApplyPatchCallType,
850 #[serde(
851 default,
852 deserialize_with = "present_nullable",
853 skip_serializing_if = "Option::is_none"
854 )]
855 pub caller: Option<Option<input::Caller>>,
856 #[serde(
857 default,
858 deserialize_with = "present_optional",
859 skip_serializing_if = "Option::is_none"
860 )]
861 pub created_by: Option<String>,
862 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
863 pub rest: Rest,
864}
865
866#[derive(
867 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
868)]
869#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
870#[derive(gproxy_protocol_macros::DeclaredFields)]
871pub struct ResponseApplyPatchCallOutput {
872 #[serde(
873 default,
874 deserialize_with = "super::input::present_nullable",
875 skip_serializing_if = "Option::is_none"
876 )]
877 pub agent: Option<Option<super::multi_agent::Agent>>,
878 pub id: String,
879 pub call_id: String,
880 pub status: input::ApplyPatchOutputStatus,
881 #[serde(rename = "type")]
882 pub type_: input::ApplyPatchCallOutputType,
883 #[serde(
884 default,
885 deserialize_with = "present_nullable",
886 skip_serializing_if = "Option::is_none"
887 )]
888 pub caller: Option<Option<input::Caller>>,
889 #[serde(
890 default,
891 deserialize_with = "present_optional",
892 skip_serializing_if = "Option::is_none"
893 )]
894 pub created_by: Option<String>,
895 #[serde(
896 default,
897 deserialize_with = "present_nullable",
898 skip_serializing_if = "Option::is_none"
899 )]
900 pub output: Option<Option<String>>,
901 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
902 pub rest: Rest,
903}
904
905#[derive(
906 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
907)]
908#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
909#[derive(gproxy_protocol_macros::DeclaredFields)]
910pub struct ResponseMcpApprovalResponse {
911 #[serde(
912 default,
913 deserialize_with = "super::input::present_nullable",
914 skip_serializing_if = "Option::is_none"
915 )]
916 pub agent: Option<Option<super::multi_agent::Agent>>,
917 pub id: String,
918 pub approval_request_id: String,
919 pub approve: bool,
920 #[serde(rename = "type")]
921 pub type_: input::McpApprovalResponseType,
922 #[serde(
923 default,
924 deserialize_with = "present_nullable",
925 skip_serializing_if = "Option::is_none"
926 )]
927 pub reason: Option<Option<String>>,
928 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
929 pub rest: Rest,
930}
931
932#[derive(
933 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
934)]
935#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
936#[derive(gproxy_protocol_macros::DeclaredFields)]
937pub struct ResponseCustomToolCallOutput {
938 #[serde(
939 default,
940 deserialize_with = "super::input::present_nullable",
941 skip_serializing_if = "Option::is_none"
942 )]
943 pub agent: Option<Option<super::multi_agent::Agent>>,
944 pub id: String,
945 pub call_id: String,
946 pub output: input::CustomOutput,
947 pub status: input::ItemStatus,
948 #[serde(rename = "type")]
949 pub type_: input::CustomToolCallOutputType,
950 #[serde(
951 default,
952 deserialize_with = "present_nullable",
953 skip_serializing_if = "Option::is_none"
954 )]
955 pub caller: Option<Option<input::Caller>>,
956 #[serde(
957 default,
958 deserialize_with = "present_optional",
959 skip_serializing_if = "Option::is_none"
960 )]
961 pub created_by: Option<String>,
962 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
963 pub rest: Rest,
964}
965
966#[derive(
967 Debug,
968 Clone,
969 PartialEq,
970 Eq,
971 Serialize,
972 Deserialize,
973 gproxy_protocol_macros::WireBuilder,
974 gproxy_protocol_macros::DeclaredFields,
975)]
976#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
977pub struct MisalignmentDetails {
978 #[serde(skip_serializing_if = "Option::is_none")]
979 pub detailed_explanation: Option<String>,
980 #[serde(skip_serializing_if = "Option::is_none")]
981 pub error_type: Option<String>,
982 #[serde(skip_serializing_if = "Option::is_none")]
983 pub steer: Option<MisalignmentSteer>,
984 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
985 pub rest: Rest,
986}
987
988#[derive(
989 Debug,
990 Clone,
991 PartialEq,
992 Eq,
993 Serialize,
994 Deserialize,
995 gproxy_protocol_macros::WireBuilder,
996 gproxy_protocol_macros::DeclaredFields,
997)]
998#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
999pub struct MisalignmentSteer {
1000 pub message: String,
1001 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
1002 pub rest: Rest,
1003}
1004
1005impl ResponseOutputItem {
1006 pub fn agent(&self) -> Option<&super::multi_agent::Agent> {
1007 match self {
1008 Self::ConfigurationUpdate(v) => v.agent.as_ref().and_then(Option::as_ref),
1009 Self::Message(v) => v.agent.as_ref().and_then(Option::as_ref),
1010 Self::FileSearchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1011 Self::FunctionCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1012 Self::FunctionCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1013 Self::WebSearchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1014 Self::ComputerCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1015 Self::ComputerCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1016 Self::Reasoning(v) => v.agent.as_ref().and_then(Option::as_ref),
1017 Self::Program(v) => v.agent.as_ref().and_then(Option::as_ref),
1018 Self::ProgramOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1019 Self::ToolSearchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1020 Self::ToolSearchOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1021 Self::AdditionalTools(v) => v.agent.as_ref().and_then(Option::as_ref),
1022 Self::Compaction(v) => v.agent.as_ref().and_then(Option::as_ref),
1023 Self::ImageGenerationCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1024 Self::CodeInterpreterCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1025 Self::LocalShellCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1026 Self::LocalShellCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1027 Self::ShellCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1028 Self::ShellCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1029 Self::ApplyPatchCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1030 Self::ApplyPatchCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1031 Self::McpCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1032 Self::McpListTools(v) => v.agent.as_ref().and_then(Option::as_ref),
1033 Self::McpApprovalRequest(v) => v.agent.as_ref().and_then(Option::as_ref),
1034 Self::McpApprovalResponse(v) => v.agent.as_ref().and_then(Option::as_ref),
1035 Self::CustomToolCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1036 Self::CustomToolCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1037 Self::MultiAgentCall(v) => v.agent.as_ref().and_then(Option::as_ref),
1038 Self::MultiAgentCallOutput(v) => v.agent.as_ref().and_then(Option::as_ref),
1039 Self::AgentMessage(v) => v.agent.as_ref().and_then(Option::as_ref),
1040 }
1041 }
1042}
1043
1044impl ResponseOutputItem {
1045 pub(crate) fn set_agent(&mut self, agent: super::multi_agent::Agent) {
1046 match self {
1047 Self::MultiAgentCall(v) => v.agent = Some(Some(agent)),
1048 Self::MultiAgentCallOutput(v) => v.agent = Some(Some(agent)),
1049 Self::AgentMessage(v) => v.agent = Some(Some(agent)),
1050 Self::ConfigurationUpdate(v) => v.agent = Some(Some(agent)),
1051 Self::Message(v) => v.agent = Some(Some(agent)),
1052 Self::FileSearchCall(v) => v.agent = Some(Some(agent)),
1053 Self::FunctionCall(v) => v.agent = Some(Some(agent)),
1054 Self::FunctionCallOutput(v) => v.agent = Some(Some(agent)),
1055 Self::WebSearchCall(v) => v.agent = Some(Some(agent)),
1056 Self::ComputerCall(v) => v.agent = Some(Some(agent)),
1057 Self::ComputerCallOutput(v) => v.agent = Some(Some(agent)),
1058 Self::Reasoning(v) => v.agent = Some(Some(agent)),
1059 Self::Program(v) => v.agent = Some(Some(agent)),
1060 Self::ProgramOutput(v) => v.agent = Some(Some(agent)),
1061 Self::ToolSearchCall(v) => v.agent = Some(Some(agent)),
1062 Self::ToolSearchOutput(v) => v.agent = Some(Some(agent)),
1063 Self::AdditionalTools(v) => v.agent = Some(Some(agent)),
1064 Self::Compaction(v) => v.agent = Some(Some(agent)),
1065 Self::ImageGenerationCall(v) => v.agent = Some(Some(agent)),
1066 Self::CodeInterpreterCall(v) => v.agent = Some(Some(agent)),
1067 Self::LocalShellCall(v) => v.agent = Some(Some(agent)),
1068 Self::LocalShellCallOutput(v) => v.agent = Some(Some(agent)),
1069 Self::ShellCall(v) => v.agent = Some(Some(agent)),
1070 Self::ShellCallOutput(v) => v.agent = Some(Some(agent)),
1071 Self::ApplyPatchCall(v) => v.agent = Some(Some(agent)),
1072 Self::ApplyPatchCallOutput(v) => v.agent = Some(Some(agent)),
1073 Self::McpCall(v) => v.agent = Some(Some(agent)),
1074 Self::McpListTools(v) => v.agent = Some(Some(agent)),
1075 Self::McpApprovalRequest(v) => v.agent = Some(Some(agent)),
1076 Self::McpApprovalResponse(v) => v.agent = Some(Some(agent)),
1077 Self::CustomToolCall(v) => v.agent = Some(Some(agent)),
1078 Self::CustomToolCallOutput(v) => v.agent = Some(Some(agent)),
1079 }
1080 }
1081}