1use super::content::ChatMessage;
2use super::content::present_nullable;
3use super::tools::{ChatTool, ToolChoice};
4use crate::{Rest, WireRequest};
5use serde::{Deserialize, Serialize};
6use std::collections::BTreeMap;
7
8#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
9#[serde(rename_all = "snake_case")]
10#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
11#[derive(gproxy_protocol_macros::DeclaredFields)]
12#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
13pub struct GenerateContentRequestBody {
14 pub messages: Vec<ChatMessage>,
15 pub model: String,
16 #[serde(
17 default,
18 deserialize_with = "present_nullable",
19 skip_serializing_if = "Option::is_none"
20 )]
21 pub audio: Option<Option<ChatAudioParam>>,
22 #[serde(
23 default,
24 deserialize_with = "present_nullable",
25 skip_serializing_if = "Option::is_none"
26 )]
27 pub frequency_penalty: Option<Option<f64>>,
28 #[serde(skip_serializing_if = "Option::is_none")]
29 pub function_call: Option<FunctionCallChoice>,
30 #[serde(skip_serializing_if = "Option::is_none")]
31 pub functions: Option<Vec<LegacyFunction>>,
32 #[serde(
33 default,
34 deserialize_with = "present_nullable",
35 skip_serializing_if = "Option::is_none"
36 )]
37 pub logit_bias: Option<Option<BTreeMap<String, f64>>>,
38 #[serde(
39 default,
40 deserialize_with = "present_nullable",
41 skip_serializing_if = "Option::is_none"
42 )]
43 pub logprobs: Option<Option<bool>>,
44 #[serde(
45 default,
46 deserialize_with = "present_nullable",
47 skip_serializing_if = "Option::is_none"
48 )]
49 pub max_completion_tokens: Option<Option<i64>>,
50 #[serde(
51 default,
52 deserialize_with = "present_nullable",
53 skip_serializing_if = "Option::is_none"
54 )]
55 pub max_tokens: Option<Option<i64>>,
56 #[serde(
57 default,
58 deserialize_with = "present_nullable",
59 skip_serializing_if = "Option::is_none"
60 )]
61 pub metadata: Option<Option<BTreeMap<String, String>>>,
62 #[serde(
63 default,
64 deserialize_with = "present_nullable",
65 skip_serializing_if = "Option::is_none"
66 )]
67 pub modalities: Option<Option<Vec<Modality>>>,
68 #[serde(
69 default,
70 deserialize_with = "present_nullable",
71 skip_serializing_if = "Option::is_none"
72 )]
73 pub moderation: Option<Option<Moderation>>,
74 #[serde(
75 default,
76 deserialize_with = "present_nullable",
77 skip_serializing_if = "Option::is_none"
78 )]
79 pub n: Option<Option<i64>>,
80 #[serde(skip_serializing_if = "Option::is_none")]
81 pub parallel_tool_calls: Option<bool>,
82 #[serde(
83 default,
84 deserialize_with = "present_nullable",
85 skip_serializing_if = "Option::is_none"
86 )]
87 pub prediction: Option<Option<Prediction>>,
88 #[serde(
89 default,
90 deserialize_with = "present_nullable",
91 skip_serializing_if = "Option::is_none"
92 )]
93 pub presence_penalty: Option<Option<f64>>,
94 #[serde(
95 default,
96 deserialize_with = "present_nullable",
97 skip_serializing_if = "Option::is_none"
98 )]
99 pub prompt_cache_key: Option<Option<String>>,
100 #[serde(skip_serializing_if = "Option::is_none")]
101 pub prompt_cache_options: Option<PromptCacheOptions>,
102 #[serde(
103 default,
104 deserialize_with = "present_nullable",
105 skip_serializing_if = "Option::is_none"
106 )]
107 pub prompt_cache_retention: Option<Option<PromptCacheRetention>>,
108 #[serde(
109 default,
110 deserialize_with = "present_nullable",
111 skip_serializing_if = "Option::is_none"
112 )]
113 pub reasoning_effort: Option<Option<ReasoningEffort>>,
114 #[serde(skip_serializing_if = "Option::is_none")]
115 pub response_format: Option<ResponseFormat>,
116 #[serde(
117 default,
118 deserialize_with = "present_nullable",
119 skip_serializing_if = "Option::is_none"
120 )]
121 pub safety_identifier: Option<Option<String>>,
122 #[serde(
123 default,
124 deserialize_with = "present_nullable",
125 skip_serializing_if = "Option::is_none"
126 )]
127 pub seed: Option<Option<i64>>,
128 #[serde(
129 default,
130 deserialize_with = "present_nullable",
131 skip_serializing_if = "Option::is_none"
132 )]
133 pub service_tier: Option<Option<ServiceTier>>,
134 #[serde(
135 default,
136 deserialize_with = "present_nullable",
137 skip_serializing_if = "Option::is_none"
138 )]
139 pub stop: Option<Option<Stop>>,
140 #[serde(
141 default,
142 deserialize_with = "present_nullable",
143 skip_serializing_if = "Option::is_none"
144 )]
145 pub store: Option<Option<bool>>,
146 #[serde(
147 default,
148 deserialize_with = "present_nullable",
149 skip_serializing_if = "Option::is_none"
150 )]
151 pub stream: Option<Option<bool>>,
152 #[serde(
153 default,
154 deserialize_with = "present_nullable",
155 skip_serializing_if = "Option::is_none"
156 )]
157 pub stream_options: Option<Option<StreamOptions>>,
158 #[serde(
159 default,
160 deserialize_with = "present_nullable",
161 skip_serializing_if = "Option::is_none"
162 )]
163 pub temperature: Option<Option<f64>>,
164 #[serde(skip_serializing_if = "Option::is_none")]
165 pub tool_choice: Option<ToolChoice>,
166 #[serde(skip_serializing_if = "Option::is_none")]
167 pub tools: Option<Vec<ChatTool>>,
168 #[serde(
169 default,
170 deserialize_with = "present_nullable",
171 skip_serializing_if = "Option::is_none"
172 )]
173 pub top_logprobs: Option<Option<i64>>,
174 #[serde(
175 default,
176 deserialize_with = "present_nullable",
177 skip_serializing_if = "Option::is_none"
178 )]
179 pub top_p: Option<Option<f64>>,
180 #[serde(skip_serializing_if = "Option::is_none")]
181 pub user: Option<String>,
182 #[serde(
183 default,
184 deserialize_with = "present_nullable",
185 skip_serializing_if = "Option::is_none"
186 )]
187 pub verbosity: Option<Option<Verbosity>>,
188 #[serde(skip_serializing_if = "Option::is_none")]
189 pub web_search_options: Option<WebSearchOptions>,
190 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
191 pub rest: Rest,
192}
193pub type GenerateContentRequest = WireRequest<GenerateContentRequestBody>;
194
195#[derive(
196 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
197)]
198#[serde(rename_all = "snake_case")]
199#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
200#[derive(gproxy_protocol_macros::DeclaredFields)]
201#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
202pub struct ChatAudioParam {
203 pub voice: AudioVoice,
204 pub format: ChatAudioFormat,
205 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
206 pub rest: Rest,
207}
208#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
209#[serde(untagged)]
210#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
211#[derive(gproxy_protocol_macros::DeclaredFields)]
212#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
213pub enum AudioVoice {
214 Name(AudioVoiceName),
215 Custom(CustomVoice),
216 String(String),
217}
218#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
219#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
220#[derive(gproxy_protocol_macros::DeclaredFields)]
221#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
222pub enum AudioVoiceName {
223 #[serde(rename = "alloy")]
224 Alloy,
225 #[serde(rename = "ash")]
226 Ash,
227 #[serde(rename = "ballad")]
228 Ballad,
229 #[serde(rename = "coral")]
230 Coral,
231 #[serde(rename = "echo")]
232 Echo,
233 #[serde(rename = "fable")]
234 Fable,
235 #[serde(rename = "nova")]
236 Nova,
237 #[serde(rename = "onyx")]
238 Onyx,
239 #[serde(rename = "sage")]
240 Sage,
241 #[serde(rename = "shimmer")]
242 Shimmer,
243 #[serde(rename = "verse")]
244 Verse,
245 #[serde(rename = "marin")]
246 Marin,
247 #[serde(rename = "cedar")]
248 Cedar,
249}
250#[derive(
251 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
252)]
253#[serde(rename_all = "snake_case")]
254#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
255#[derive(gproxy_protocol_macros::DeclaredFields)]
256#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
257pub struct CustomVoice {
258 pub id: String,
259 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
260 pub rest: Rest,
261}
262#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
263#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
264#[derive(gproxy_protocol_macros::DeclaredFields)]
265#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
266pub enum ChatAudioFormat {
267 #[serde(rename = "wav")]
268 Wav,
269 #[serde(rename = "aac")]
270 Aac,
271 #[serde(rename = "mp3")]
272 Mp3,
273 #[serde(rename = "flac")]
274 Flac,
275 #[serde(rename = "opus")]
276 Opus,
277 #[serde(rename = "pcm16")]
278 Pcm16,
279}
280#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
281#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
282#[derive(gproxy_protocol_macros::DeclaredFields)]
283#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
284pub enum Modality {
285 #[serde(rename = "text")]
286 Text,
287 #[serde(rename = "audio")]
288 Audio,
289}
290#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
291#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
292#[derive(gproxy_protocol_macros::DeclaredFields)]
293#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
294pub enum FunctionCallMode {
295 #[serde(rename = "none")]
296 None,
297 #[serde(rename = "auto")]
298 Auto,
299}
300#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
301#[serde(untagged)]
302#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
303#[derive(gproxy_protocol_macros::DeclaredFields)]
304#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
305pub enum FunctionCallChoice {
306 Mode(FunctionCallMode),
307 Name(LegacyFunctionChoice),
308}
309#[derive(
310 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
311)]
312#[serde(rename_all = "snake_case")]
313#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
314#[derive(gproxy_protocol_macros::DeclaredFields)]
315#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
316pub struct LegacyFunctionChoice {
317 pub name: String,
318 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
319 pub rest: Rest,
320}
321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
322#[serde(rename_all = "snake_case")]
323#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
324#[derive(gproxy_protocol_macros::DeclaredFields)]
325#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
326pub struct LegacyFunction {
327 pub name: String,
328 #[serde(skip_serializing_if = "Option::is_none")]
329 pub description: Option<String>,
330 #[serde(skip_serializing_if = "Option::is_none")]
331 pub parameters: Option<Rest>,
332 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
333 pub rest: Rest,
334}
335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
336#[serde(rename_all = "snake_case")]
337#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
338#[derive(gproxy_protocol_macros::DeclaredFields)]
339#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
340pub struct Moderation {
341 pub model: String,
342 #[serde(
343 default,
344 deserialize_with = "present_nullable",
345 skip_serializing_if = "Option::is_none"
346 )]
347 pub policy: Option<Option<ModerationPolicy>>,
348 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
349 pub rest: Rest,
350}
351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
352#[serde(rename_all = "snake_case")]
353#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
354#[derive(gproxy_protocol_macros::DeclaredFields)]
355#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
356pub struct ModerationPolicy {
357 #[serde(
358 default,
359 deserialize_with = "present_nullable",
360 skip_serializing_if = "Option::is_none"
361 )]
362 pub input: Option<Option<ModerationMode>>,
363 #[serde(
364 default,
365 deserialize_with = "present_nullable",
366 skip_serializing_if = "Option::is_none"
367 )]
368 pub output: Option<Option<ModerationMode>>,
369 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
370 pub rest: Rest,
371}
372#[derive(
373 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
374)]
375#[serde(rename_all = "snake_case")]
376#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
377#[derive(gproxy_protocol_macros::DeclaredFields)]
378#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
379pub struct ModerationMode {
380 pub mode: ModerationModeType,
381 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
382 pub rest: Rest,
383}
384#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
385#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
386#[derive(gproxy_protocol_macros::DeclaredFields)]
387#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
388pub enum ModerationModeType {
389 #[serde(rename = "score")]
390 Score,
391 #[serde(rename = "block")]
392 Block,
393}
394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
395#[serde(rename_all = "snake_case")]
396#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
397#[derive(gproxy_protocol_macros::DeclaredFields)]
398#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
399pub struct Prediction {
400 #[serde(rename = "type")]
401 pub type_: PredictionType,
402 pub content: super::content::TextContent,
403 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
404 pub rest: Rest,
405}
406#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
407#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
408#[derive(gproxy_protocol_macros::DeclaredFields)]
409#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
410pub enum PredictionType {
411 #[serde(rename = "content")]
412 Content,
413}
414#[derive(
415 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
416)]
417#[serde(rename_all = "snake_case")]
418#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
419#[derive(gproxy_protocol_macros::DeclaredFields)]
420#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
421pub struct PromptCacheOptions {
422 #[serde(skip_serializing_if = "Option::is_none")]
423 pub mode: Option<PromptCacheOptionMode>,
424 #[serde(skip_serializing_if = "Option::is_none")]
425 pub ttl: Option<PromptCacheTtl>,
426 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
427 pub rest: Rest,
428}
429#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
430#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
431#[derive(gproxy_protocol_macros::DeclaredFields)]
432#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
433pub enum PromptCacheOptionMode {
434 #[serde(rename = "implicit")]
435 Implicit,
436 #[serde(rename = "explicit")]
437 Explicit,
438}
439#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
440#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
441#[derive(gproxy_protocol_macros::DeclaredFields)]
442#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
443pub enum PromptCacheTtl {
444 #[serde(rename = "30m")]
445 ThirtyMinutes,
446}
447#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
448#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
449#[derive(gproxy_protocol_macros::DeclaredFields)]
450#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
451pub enum PromptCacheRetention {
452 #[serde(rename = "in_memory")]
453 InMemory,
454 #[serde(rename = "24h")]
455 TwentyFourHours,
456}
457#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
458#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
459#[derive(gproxy_protocol_macros::DeclaredFields)]
460#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
461pub enum ReasoningEffort {
462 #[serde(rename = "none")]
463 None,
464 #[serde(rename = "minimal")]
465 Minimal,
466 #[serde(rename = "low")]
467 Low,
468 #[serde(rename = "medium")]
469 Medium,
470 #[serde(rename = "high")]
471 High,
472 #[serde(rename = "xhigh")]
473 XHigh,
474 #[serde(rename = "max")]
475 Max,
476}
477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
478#[serde(untagged)]
479#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
480#[derive(gproxy_protocol_macros::DeclaredFields)]
481#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
482pub enum ResponseFormat {
483 Text(TextResponseFormat),
484 JsonSchema(JsonSchemaResponseFormat),
485 JsonObject(JsonObjectResponseFormat),
486}
487#[derive(
488 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
489)]
490#[serde(rename_all = "snake_case")]
491#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
492#[derive(gproxy_protocol_macros::DeclaredFields)]
493#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
494pub struct TextResponseFormat {
495 #[serde(rename = "type")]
496 pub type_: TextResponseType,
497 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
498 pub rest: Rest,
499}
500#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
501#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
502#[derive(gproxy_protocol_macros::DeclaredFields)]
503#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
504pub enum TextResponseType {
505 #[serde(rename = "text")]
506 Text,
507}
508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
509#[serde(rename_all = "snake_case")]
510#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
511#[derive(gproxy_protocol_macros::DeclaredFields)]
512#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
513pub struct JsonSchemaResponseFormat {
514 #[serde(rename = "type")]
515 pub type_: JsonSchemaResponseType,
516 pub json_schema: JsonSchemaFormat,
517 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
518 pub rest: Rest,
519}
520#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
521#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
522#[derive(gproxy_protocol_macros::DeclaredFields)]
523#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
524pub enum JsonSchemaResponseType {
525 #[serde(rename = "json_schema")]
526 JsonSchema,
527}
528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
529#[serde(rename_all = "snake_case")]
530#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
531#[derive(gproxy_protocol_macros::DeclaredFields)]
532#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
533pub struct JsonSchemaFormat {
534 pub name: String,
535 #[serde(skip_serializing_if = "Option::is_none")]
536 pub description: Option<String>,
537 #[serde(skip_serializing_if = "Option::is_none")]
538 pub schema: Option<Rest>,
539 #[serde(
540 default,
541 deserialize_with = "present_nullable",
542 skip_serializing_if = "Option::is_none"
543 )]
544 pub strict: Option<Option<bool>>,
545 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
546 pub rest: Rest,
547}
548#[derive(
549 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
550)]
551#[serde(rename_all = "snake_case")]
552#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
553#[derive(gproxy_protocol_macros::DeclaredFields)]
554#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
555pub struct JsonObjectResponseFormat {
556 #[serde(rename = "type")]
557 pub type_: JsonObjectResponseType,
558 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
559 pub rest: Rest,
560}
561#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
562#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
563#[derive(gproxy_protocol_macros::DeclaredFields)]
564#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
565pub enum JsonObjectResponseType {
566 #[serde(rename = "json_object")]
567 JsonObject,
568}
569#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
570#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
571#[derive(gproxy_protocol_macros::DeclaredFields)]
572#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
573pub enum ServiceTier {
574 #[serde(rename = "auto")]
575 Auto,
576 #[serde(rename = "default")]
577 Default,
578 #[serde(rename = "flex")]
579 Flex,
580 #[serde(rename = "scale")]
581 Scale,
582 #[serde(rename = "priority")]
583 Priority,
584 #[serde(rename = "fast")]
585 Fast,
586 #[serde(rename = "ultrafast")]
587 Ultrafast,
588}
589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
590#[serde(untagged)]
591#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
592#[derive(gproxy_protocol_macros::DeclaredFields)]
593#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
594pub enum Stop {
595 String(String),
596 Sequences(Vec<String>),
597}
598#[derive(
599 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
600)]
601#[serde(rename_all = "snake_case")]
602#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
603#[derive(gproxy_protocol_macros::DeclaredFields)]
604#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
605pub struct StreamOptions {
606 #[serde(skip_serializing_if = "Option::is_none")]
607 pub include_obfuscation: Option<bool>,
608 #[serde(skip_serializing_if = "Option::is_none")]
609 pub include_usage: Option<bool>,
610 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
611 pub rest: Rest,
612}
613#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
614#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
615#[derive(gproxy_protocol_macros::DeclaredFields)]
616#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
617pub enum Verbosity {
618 #[serde(rename = "low")]
619 Low,
620 #[serde(rename = "medium")]
621 Medium,
622 #[serde(rename = "high")]
623 High,
624}
625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
626#[serde(rename_all = "snake_case")]
627#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
628#[derive(gproxy_protocol_macros::DeclaredFields)]
629#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
630pub struct WebSearchOptions {
631 #[serde(skip_serializing_if = "Option::is_none")]
632 pub search_context_size: Option<SearchContextSize>,
633 #[serde(
634 default,
635 deserialize_with = "present_nullable",
636 skip_serializing_if = "Option::is_none"
637 )]
638 pub user_location: Option<Option<UserLocation>>,
639 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
640 pub rest: Rest,
641}
642#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
643#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
644#[derive(gproxy_protocol_macros::DeclaredFields)]
645#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
646pub enum SearchContextSize {
647 #[serde(rename = "low")]
648 Low,
649 #[serde(rename = "medium")]
650 Medium,
651 #[serde(rename = "high")]
652 High,
653}
654#[derive(
655 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
656)]
657#[serde(rename_all = "snake_case")]
658#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
659#[derive(gproxy_protocol_macros::DeclaredFields)]
660#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
661pub struct UserLocation {
662 #[serde(rename = "type")]
663 pub type_: UserLocationType,
664 pub approximate: ApproximateLocation,
665 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
666 pub rest: Rest,
667}
668#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
669#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
670#[derive(gproxy_protocol_macros::DeclaredFields)]
671#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
672pub enum UserLocationType {
673 #[serde(rename = "approximate")]
674 Approximate,
675}
676#[derive(
677 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
678)]
679#[serde(rename_all = "snake_case")]
680#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
681#[derive(gproxy_protocol_macros::DeclaredFields)]
682#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
683pub struct ApproximateLocation {
684 #[serde(skip_serializing_if = "Option::is_none")]
685 pub city: Option<String>,
686 #[serde(skip_serializing_if = "Option::is_none")]
687 pub country: Option<String>,
688 #[serde(skip_serializing_if = "Option::is_none")]
689 pub region: Option<String>,
690 #[serde(skip_serializing_if = "Option::is_none")]
691 pub timezone: Option<String>,
692 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
693 pub rest: Rest,
694}