Skip to main content

gproxy_protocol/openai/generate_content/responses/tools/
runtime.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4use crate::openai::common::*;
5
6#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7#[serde(untagged)]
8#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
9pub enum CodeInterpreterContainer {
10    Id(String),
11    Auto(CodeInterpreterAutoContainer),
12    Unknown(Value),
13}
14
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
16#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
17pub struct CodeInterpreterAutoContainer {
18    #[serde(rename = "type")]
19    pub type_: CodeInterpreterContainerType,
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub file_ids: Option<Vec<String>>,
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub memory_limit: Option<CodeInterpreterMemoryLimit>,
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub network_policy: Option<CodeInterpreterNetworkPolicy>,
26    #[serde(default, flatten)]
27    pub rest: Rest,
28}
29
30#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
31#[serde(tag = "type")]
32#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
33pub enum CodeInterpreterNetworkPolicy {
34    #[serde(rename = "disabled")]
35    Disabled {
36        #[serde(default, flatten)]
37        rest: Rest,
38    },
39    #[serde(rename = "allowlist")]
40    Allowlist {
41        allowed_domains: Vec<String>,
42        #[serde(skip_serializing_if = "Option::is_none")]
43        domain_secrets: Option<Vec<CodeInterpreterDomainSecret>>,
44        #[serde(default, flatten)]
45        rest: Rest,
46    },
47}
48
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
50#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
51pub struct CodeInterpreterDomainSecret {
52    pub domain: String,
53    pub name: String,
54    pub value: String,
55    #[serde(default, flatten)]
56    pub rest: Rest,
57}
58
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
60#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
61pub struct ImageMask {
62    #[serde(skip_serializing_if = "Option::is_none")]
63    pub file_id: Option<String>,
64    #[serde(skip_serializing_if = "Option::is_none")]
65    pub image_url: Option<String>,
66    #[serde(default, flatten)]
67    pub rest: Rest,
68}
69
70#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
71#[serde(tag = "type")]
72#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
73pub enum ResponseShellEnvironment {
74    #[serde(rename = "container_auto")]
75    ContainerAuto {
76        #[serde(skip_serializing_if = "Option::is_none")]
77        file_ids: Option<Vec<String>>,
78        #[serde(skip_serializing_if = "Option::is_none")]
79        memory_limit: Option<CodeInterpreterMemoryLimit>,
80        #[serde(skip_serializing_if = "Option::is_none")]
81        network_policy: Option<CodeInterpreterNetworkPolicy>,
82        #[serde(skip_serializing_if = "Option::is_none")]
83        skills: Option<Vec<ResponseShellContainerSkill>>,
84        #[serde(default, flatten)]
85        rest: Rest,
86    },
87    #[serde(rename = "local")]
88    Local {
89        #[serde(skip_serializing_if = "Option::is_none")]
90        skills: Option<Vec<ResponseShellLocalSkill>>,
91        #[serde(default, flatten)]
92        rest: Rest,
93    },
94    #[serde(rename = "container_reference")]
95    ContainerReference {
96        container_id: String,
97        #[serde(default, flatten)]
98        rest: Rest,
99    },
100}
101
102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
103#[serde(untagged)]
104#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
105pub enum ResponseShellContainerSkill {
106    Reference(ResponseShellSkillReference),
107    Inline(ResponseShellInlineSkill),
108    Unknown(Value),
109}
110
111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
112#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
113pub struct ResponseShellSkillReference {
114    pub skill_id: String,
115    #[serde(rename = "type")]
116    pub type_: ResponseShellSkillReferenceType,
117    #[serde(skip_serializing_if = "Option::is_none")]
118    pub version: Option<String>,
119    #[serde(default, flatten)]
120    pub rest: Rest,
121}
122
123#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
124#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
125pub enum ResponseShellSkillReferenceType {
126    #[serde(rename = "skill_reference")]
127    SkillReference,
128}
129
130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
131#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
132pub struct ResponseShellInlineSkill {
133    pub description: String,
134    pub name: String,
135    pub source: ResponseShellInlineSkillSource,
136    #[serde(rename = "type")]
137    pub type_: ResponseShellInlineSkillType,
138    #[serde(default, flatten)]
139    pub rest: Rest,
140}
141
142#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
143#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
144pub enum ResponseShellInlineSkillType {
145    #[serde(rename = "inline")]
146    Inline,
147}
148
149#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
150#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
151pub struct ResponseShellInlineSkillSource {
152    pub data: String,
153    pub media_type: ResponseShellInlineSkillMediaType,
154    #[serde(rename = "type")]
155    pub type_: ResponseShellInlineSkillSourceType,
156    #[serde(default, flatten)]
157    pub rest: Rest,
158}
159
160#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
161#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
162pub enum ResponseShellInlineSkillMediaType {
163    #[serde(rename = "application/zip")]
164    ApplicationZip,
165}
166
167#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
168#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
169pub enum ResponseShellInlineSkillSourceType {
170    #[serde(rename = "base64")]
171    Base64,
172}
173
174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
175#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
176pub struct ResponseShellLocalSkill {
177    pub description: String,
178    pub name: String,
179    pub path: String,
180    #[serde(default, flatten)]
181    pub rest: Rest,
182}
183
184#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
185#[serde(rename_all = "snake_case")]
186#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
187pub enum SearchContentType {
188    Text,
189    Image,
190}
191
192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
193#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
194pub struct WebSearchPreviewUserLocation {
195    #[serde(rename = "type")]
196    pub type_: ApproximateLocationType,
197    #[serde(skip_serializing_if = "Option::is_none")]
198    pub city: Option<String>,
199    #[serde(skip_serializing_if = "Option::is_none")]
200    pub country: Option<String>,
201    #[serde(skip_serializing_if = "Option::is_none")]
202    pub region: Option<String>,
203    #[serde(skip_serializing_if = "Option::is_none")]
204    pub timezone: Option<String>,
205    #[serde(default, flatten)]
206    pub rest: Rest,
207}