openai_api_rs/v1/
common.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Deserialize, Serialize)]
4pub struct Usage {
5 pub prompt_tokens: i32,
6 pub completion_tokens: i32,
7 pub total_tokens: i32,
8}
9
10#[derive(Debug, Deserialize, Serialize)]
11pub struct DeletionStatus {
12 pub id: String,
13 pub object: String,
14 pub deleted: bool,
15}
16
17#[macro_export]
18macro_rules! impl_builder_methods {
19 ($builder:ident, $($field:ident: $field_type:ty),*) => {
20 impl $builder {
21 $(
22 pub fn $field(mut self, $field: $field_type) -> Self {
23 self.$field = Some($field);
24 self
25 }
26 )*
27 }
28 };
29}
30
31#[derive(Debug, Serialize, Deserialize)]
32pub struct EmptyRequestBody {}
33
34pub const O3: &str = "o3";
36pub const O3_2025_04_16: &str = "o3-2025-04-16";
37pub const O3_MINI: &str = "o3-mini";
38pub const O3_MINI_2025_01_31: &str = "o3-mini-2025-01-31";
39
40pub const GPT4_5_PREVIEW: &str = "gpt-4.5-preview";
42pub const GPT4_5_PREVIEW_2025_02_27: &str = "gpt-4.5-preview-2025-02-27";
43
44pub const O1_PREVIEW: &str = "o1-preview";
46pub const O1_PREVIEW_2024_09_12: &str = "o1-preview-2024-09-12";
47pub const O1_MINI: &str = "o1-mini";
48pub const O1_MINI_2024_09_12: &str = "o1-mini-2024-09-12";
49
50pub const GPT4_O_MINI: &str = "gpt-4o-mini";
52pub const GPT4_O_MINI_2024_07_18: &str = "gpt-4o-mini-2024-07-18";
53
54pub const GPT4_O: &str = "gpt-4o";
56pub const GPT4_O_2024_05_13: &str = "gpt-4o-2024-05-13";
57pub const GPT4_O_2024_08_06: &str = "gpt-4o-2024-08-06";
58pub const GPT4_O_LATEST: &str = "chatgpt-4o-latest";
59
60pub const GPT3_5_TURBO_1106: &str = "gpt-3.5-turbo-1106";
62pub const GPT3_5_TURBO: &str = "gpt-3.5-turbo";
63pub const GPT3_5_TURBO_16K: &str = "gpt-3.5-turbo-16k";
64pub const GPT3_5_TURBO_INSTRUCT: &str = "gpt-3.5-turbo-instruct";
65pub const GPT3_5_TURBO_0613: &str = "gpt-3.5-turbo-0613";
67pub const GPT3_5_TURBO_16K_0613: &str = "gpt-3.5-turbo-16k-0613";
68pub const GPT3_5_TURBO_0301: &str = "gpt-3.5-turbo-0301";
69
70pub const GPT4_0125_PREVIEW: &str = "gpt-4-0125-preview";
72pub const GPT4_TURBO_PREVIEW: &str = "gpt-4-turbo-preview";
73pub const GPT4_1106_PREVIEW: &str = "gpt-4-1106-preview";
74pub const GPT4_VISION_PREVIEW: &str = "gpt-4-vision-preview";
75pub const GPT4: &str = "gpt-4";
76pub const GPT4_32K: &str = "gpt-4-32k";
77pub const GPT4_0613: &str = "gpt-4-0613";
78pub const GPT4_32K_0613: &str = "gpt-4-32k-0613";
79pub const GPT4_0314: &str = "gpt-4-0314";
81pub const GPT4_32K_0314: &str = "gpt-4-32k-0314";
82
83pub const DALL_E_2: &str = "dall-e-2";
85pub const DALL_E_3: &str = "dall-e-3";
86
87pub const TEXT_EMBEDDING_3_SMALL: &str = "text-embedding-3-small";
89pub const TEXT_EMBEDDING_3_LARGE: &str = "text-embedding-3-large";
90pub const TEXT_EMBEDDING_ADA_002: &str = "text-embedding-ada-002";