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(
181 default,
182 deserialize_with = "present_nullable",
183 skip_serializing_if = "Option::is_none"
184 )]
185 pub user: Option<Option<String>>,
186 #[serde(
187 default,
188 deserialize_with = "present_nullable",
189 skip_serializing_if = "Option::is_none"
190 )]
191 pub verbosity: Option<Option<Verbosity>>,
192 #[serde(skip_serializing_if = "Option::is_none")]
193 pub web_search_options: Option<WebSearchOptions>,
194 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
195 pub rest: Rest,
196}
197pub type GenerateContentRequest = WireRequest<GenerateContentRequestBody>;
198
199#[derive(
200 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
201)]
202#[serde(rename_all = "snake_case")]
203#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
204#[derive(gproxy_protocol_macros::DeclaredFields)]
205#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
206pub struct ChatAudioParam {
207 pub voice: AudioVoice,
208 pub format: ChatAudioFormat,
209 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
210 pub rest: Rest,
211}
212#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
213#[serde(untagged)]
214#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
215#[derive(gproxy_protocol_macros::DeclaredFields)]
216#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
217pub enum AudioVoice {
218 Name(AudioVoiceName),
219 Custom(CustomVoice),
220 String(String),
221}
222#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
223#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
224#[derive(gproxy_protocol_macros::DeclaredFields)]
225#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
226pub enum AudioVoiceName {
227 #[serde(rename = "alloy")]
228 Alloy,
229 #[serde(rename = "ash")]
230 Ash,
231 #[serde(rename = "ballad")]
232 Ballad,
233 #[serde(rename = "coral")]
234 Coral,
235 #[serde(rename = "echo")]
236 Echo,
237 #[serde(rename = "fable")]
238 Fable,
239 #[serde(rename = "nova")]
240 Nova,
241 #[serde(rename = "onyx")]
242 Onyx,
243 #[serde(rename = "sage")]
244 Sage,
245 #[serde(rename = "shimmer")]
246 Shimmer,
247 #[serde(rename = "verse")]
248 Verse,
249 #[serde(rename = "marin")]
250 Marin,
251 #[serde(rename = "cedar")]
252 Cedar,
253}
254#[derive(
255 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
256)]
257#[serde(rename_all = "snake_case")]
258#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
259#[derive(gproxy_protocol_macros::DeclaredFields)]
260#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
261pub struct CustomVoice {
262 pub id: String,
263 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
264 pub rest: Rest,
265}
266#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
267#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
268#[derive(gproxy_protocol_macros::DeclaredFields)]
269#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
270pub enum ChatAudioFormat {
271 #[serde(rename = "wav")]
272 Wav,
273 #[serde(rename = "aac")]
274 Aac,
275 #[serde(rename = "mp3")]
276 Mp3,
277 #[serde(rename = "flac")]
278 Flac,
279 #[serde(rename = "opus")]
280 Opus,
281 #[serde(rename = "pcm16")]
282 Pcm16,
283}
284#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
285#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
286#[derive(gproxy_protocol_macros::DeclaredFields)]
287#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
288pub enum Modality {
289 #[serde(rename = "text")]
290 Text,
291 #[serde(rename = "audio")]
292 Audio,
293}
294#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
295#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
296#[derive(gproxy_protocol_macros::DeclaredFields)]
297#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
298pub enum FunctionCallMode {
299 #[serde(rename = "none")]
300 None,
301 #[serde(rename = "auto")]
302 Auto,
303}
304#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
305#[serde(untagged)]
306#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
307#[derive(gproxy_protocol_macros::DeclaredFields)]
308#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
309pub enum FunctionCallChoice {
310 Mode(FunctionCallMode),
311 Name(LegacyFunctionChoice),
312}
313#[derive(
314 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
315)]
316#[serde(rename_all = "snake_case")]
317#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
318#[derive(gproxy_protocol_macros::DeclaredFields)]
319#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
320pub struct LegacyFunctionChoice {
321 pub name: String,
322 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
323 pub rest: Rest,
324}
325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
326#[serde(rename_all = "snake_case")]
327#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
328#[derive(gproxy_protocol_macros::DeclaredFields)]
329#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
330pub struct LegacyFunction {
331 pub name: String,
332 #[serde(skip_serializing_if = "Option::is_none")]
333 pub description: Option<String>,
334 #[serde(skip_serializing_if = "Option::is_none")]
335 pub parameters: Option<Rest>,
336 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
337 pub rest: Rest,
338}
339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
340#[serde(rename_all = "snake_case")]
341#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
342#[derive(gproxy_protocol_macros::DeclaredFields)]
343#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
344pub struct Moderation {
345 pub model: String,
346 #[serde(
347 default,
348 deserialize_with = "present_nullable",
349 skip_serializing_if = "Option::is_none"
350 )]
351 pub policy: Option<Option<ModerationPolicy>>,
352 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
353 pub rest: Rest,
354}
355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
356#[serde(rename_all = "snake_case")]
357#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
358#[derive(gproxy_protocol_macros::DeclaredFields)]
359#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
360pub struct ModerationPolicy {
361 #[serde(
362 default,
363 deserialize_with = "present_nullable",
364 skip_serializing_if = "Option::is_none"
365 )]
366 pub input: Option<Option<ModerationMode>>,
367 #[serde(
368 default,
369 deserialize_with = "present_nullable",
370 skip_serializing_if = "Option::is_none"
371 )]
372 pub output: Option<Option<ModerationMode>>,
373 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
374 pub rest: Rest,
375}
376#[derive(
377 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
378)]
379#[serde(rename_all = "snake_case")]
380#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
381#[derive(gproxy_protocol_macros::DeclaredFields)]
382#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
383pub struct ModerationMode {
384 pub mode: ModerationModeType,
385 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
386 pub rest: Rest,
387}
388#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
389#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
390#[derive(gproxy_protocol_macros::DeclaredFields)]
391#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
392pub enum ModerationModeType {
393 #[serde(rename = "score")]
394 Score,
395 #[serde(rename = "block")]
396 Block,
397}
398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
399#[serde(rename_all = "snake_case")]
400#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
401#[derive(gproxy_protocol_macros::DeclaredFields)]
402#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
403pub struct Prediction {
404 #[serde(rename = "type")]
405 pub type_: PredictionType,
406 pub content: super::content::TextContent,
407 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
408 pub rest: Rest,
409}
410#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
411#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
412#[derive(gproxy_protocol_macros::DeclaredFields)]
413#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
414pub enum PredictionType {
415 #[serde(rename = "content")]
416 Content,
417}
418#[derive(
419 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
420)]
421#[serde(rename_all = "snake_case")]
422#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
423#[derive(gproxy_protocol_macros::DeclaredFields)]
424#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
425pub struct PromptCacheOptions {
426 #[serde(skip_serializing_if = "Option::is_none")]
427 pub mode: Option<PromptCacheOptionMode>,
428 #[serde(skip_serializing_if = "Option::is_none")]
429 pub ttl: Option<PromptCacheTtl>,
430 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
431 pub rest: Rest,
432}
433#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
434#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
435#[derive(gproxy_protocol_macros::DeclaredFields)]
436#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
437pub enum PromptCacheOptionMode {
438 #[serde(rename = "implicit")]
439 Implicit,
440 #[serde(rename = "explicit")]
441 Explicit,
442}
443#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
444#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
445#[derive(gproxy_protocol_macros::DeclaredFields)]
446#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
447pub enum PromptCacheTtl {
448 #[serde(rename = "30m")]
449 ThirtyMinutes,
450}
451#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
452#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
453#[derive(gproxy_protocol_macros::DeclaredFields)]
454#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
455pub enum PromptCacheRetention {
456 #[serde(rename = "in_memory")]
457 InMemory,
458 #[serde(rename = "24h")]
459 TwentyFourHours,
460}
461#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
462#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
463#[derive(gproxy_protocol_macros::DeclaredFields)]
464#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
465pub enum ReasoningEffort {
466 #[serde(rename = "none")]
467 None,
468 #[serde(rename = "minimal")]
469 Minimal,
470 #[serde(rename = "low")]
471 Low,
472 #[serde(rename = "medium")]
473 Medium,
474 #[serde(rename = "high")]
475 High,
476 #[serde(rename = "xhigh")]
477 XHigh,
478 #[serde(rename = "max")]
479 Max,
480}
481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
482#[serde(untagged)]
483#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
484#[derive(gproxy_protocol_macros::DeclaredFields)]
485#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
486pub enum ResponseFormat {
487 Text(TextResponseFormat),
488 JsonSchema(JsonSchemaResponseFormat),
489 JsonObject(JsonObjectResponseFormat),
490}
491#[derive(
492 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
493)]
494#[serde(rename_all = "snake_case")]
495#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
496#[derive(gproxy_protocol_macros::DeclaredFields)]
497#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
498pub struct TextResponseFormat {
499 #[serde(rename = "type")]
500 pub type_: TextResponseType,
501 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
502 pub rest: Rest,
503}
504#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
505#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
506#[derive(gproxy_protocol_macros::DeclaredFields)]
507#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
508pub enum TextResponseType {
509 #[serde(rename = "text")]
510 Text,
511}
512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
513#[serde(rename_all = "snake_case")]
514#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
515#[derive(gproxy_protocol_macros::DeclaredFields)]
516#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
517pub struct JsonSchemaResponseFormat {
518 #[serde(rename = "type")]
519 pub type_: JsonSchemaResponseType,
520 pub json_schema: JsonSchemaFormat,
521 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
522 pub rest: Rest,
523}
524#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
525#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
526#[derive(gproxy_protocol_macros::DeclaredFields)]
527#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
528pub enum JsonSchemaResponseType {
529 #[serde(rename = "json_schema")]
530 JsonSchema,
531}
532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
533#[serde(rename_all = "snake_case")]
534#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
535#[derive(gproxy_protocol_macros::DeclaredFields)]
536#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
537pub struct JsonSchemaFormat {
538 pub name: String,
539 #[serde(skip_serializing_if = "Option::is_none")]
540 pub description: Option<String>,
541 #[serde(skip_serializing_if = "Option::is_none")]
542 pub schema: Option<Rest>,
543 #[serde(
544 default,
545 deserialize_with = "present_nullable",
546 skip_serializing_if = "Option::is_none"
547 )]
548 pub strict: Option<Option<bool>>,
549 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
550 pub rest: Rest,
551}
552#[derive(
553 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
554)]
555#[serde(rename_all = "snake_case")]
556#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
557#[derive(gproxy_protocol_macros::DeclaredFields)]
558#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
559pub struct JsonObjectResponseFormat {
560 #[serde(rename = "type")]
561 pub type_: JsonObjectResponseType,
562 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
563 pub rest: Rest,
564}
565#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
566#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
567#[derive(gproxy_protocol_macros::DeclaredFields)]
568#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
569pub enum JsonObjectResponseType {
570 #[serde(rename = "json_object")]
571 JsonObject,
572}
573#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
574#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
575#[derive(gproxy_protocol_macros::DeclaredFields)]
576#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
577pub enum ServiceTier {
578 #[serde(rename = "auto")]
579 Auto,
580 #[serde(rename = "default")]
581 Default,
582 #[serde(rename = "flex")]
583 Flex,
584 #[serde(rename = "scale")]
585 Scale,
586 #[serde(rename = "priority")]
587 Priority,
588 #[serde(rename = "fast")]
589 Fast,
590 #[serde(rename = "ultrafast")]
591 Ultrafast,
592}
593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
594#[serde(untagged)]
595#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
596#[derive(gproxy_protocol_macros::DeclaredFields)]
597#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
598pub enum Stop {
599 String(String),
600 Sequences(Vec<String>),
601}
602#[derive(
603 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
604)]
605#[serde(rename_all = "snake_case")]
606#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
607#[derive(gproxy_protocol_macros::DeclaredFields)]
608#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
609pub struct StreamOptions {
610 #[serde(skip_serializing_if = "Option::is_none")]
611 pub include_obfuscation: Option<bool>,
612 #[serde(skip_serializing_if = "Option::is_none")]
613 pub include_usage: Option<bool>,
614 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
615 pub rest: Rest,
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 Verbosity {
622 #[serde(rename = "low")]
623 Low,
624 #[serde(rename = "medium")]
625 Medium,
626 #[serde(rename = "high")]
627 High,
628}
629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
630#[serde(rename_all = "snake_case")]
631#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
632#[derive(gproxy_protocol_macros::DeclaredFields)]
633#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
634pub struct WebSearchOptions {
635 #[serde(skip_serializing_if = "Option::is_none")]
636 pub search_context_size: Option<SearchContextSize>,
637 #[serde(
638 default,
639 deserialize_with = "present_nullable",
640 skip_serializing_if = "Option::is_none"
641 )]
642 pub user_location: Option<Option<UserLocation>>,
643 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
644 pub rest: Rest,
645}
646#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
647#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
648#[derive(gproxy_protocol_macros::DeclaredFields)]
649#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
650pub enum SearchContextSize {
651 #[serde(rename = "low")]
652 Low,
653 #[serde(rename = "medium")]
654 Medium,
655 #[serde(rename = "high")]
656 High,
657}
658#[derive(
659 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
660)]
661#[serde(rename_all = "snake_case")]
662#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
663#[derive(gproxy_protocol_macros::DeclaredFields)]
664#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
665pub struct UserLocation {
666 #[serde(rename = "type")]
667 pub type_: UserLocationType,
668 pub approximate: ApproximateLocation,
669 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
670 pub rest: Rest,
671}
672#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
673#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
674#[derive(gproxy_protocol_macros::DeclaredFields)]
675#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
676pub enum UserLocationType {
677 #[serde(rename = "approximate")]
678 Approximate,
679}
680#[derive(
681 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder,
682)]
683#[serde(rename_all = "snake_case")]
684#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
685#[derive(gproxy_protocol_macros::DeclaredFields)]
686#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
687pub struct ApproximateLocation {
688 #[serde(skip_serializing_if = "Option::is_none")]
689 pub city: Option<String>,
690 #[serde(skip_serializing_if = "Option::is_none")]
691 pub country: Option<String>,
692 #[serde(skip_serializing_if = "Option::is_none")]
693 pub region: Option<String>,
694 #[serde(skip_serializing_if = "Option::is_none")]
695 pub timezone: Option<String>,
696 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
697 pub rest: Rest,
698}