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#[macro_export]
11macro_rules! impl_builder_methods {
12 ($builder:ident, $($field:ident: $field_type:ty),*) => {
13 impl $builder {
14 $(
15 pub fn $field(mut self, $field: $field_type) -> Self {
16 self.$field = Some($field);
17 self
18 }
19 )*
20 }
21 };
22}
23
24#[derive(Debug, Serialize, Deserialize)]
25pub struct EmptyRequestBody {}
26
27pub const GPT4_5_PREVIEW: &str = "gpt-4.5-preview";
29pub const GPT4_5_PREVIEW_2025_02_27: &str = "gpt-4.5-preview-2025-02-27";
30
31pub const O1_PREVIEW: &str = "o1-preview";
33pub const O1_PREVIEW_2024_09_12: &str = "o1-preview-2024-09-12";
34pub const O1_MINI: &str = "o1-mini";
35pub const O1_MINI_2024_09_12: &str = "o1-mini-2024-09-12";
36
37pub const GPT4_O_MINI: &str = "gpt-4o-mini";
39pub const GPT4_O_MINI_2024_07_18: &str = "gpt-4o-mini-2024-07-18";
40
41pub const GPT4_O: &str = "gpt-4o";
43pub const GPT4_O_2024_05_13: &str = "gpt-4o-2024-05-13";
44pub const GPT4_O_2024_08_06: &str = "gpt-4o-2024-08-06";
45pub const GPT4_O_LATEST: &str = "chatgpt-4o-latest";
46
47pub const GPT3_5_TURBO_1106: &str = "gpt-3.5-turbo-1106";
49pub const GPT3_5_TURBO: &str = "gpt-3.5-turbo";
50pub const GPT3_5_TURBO_16K: &str = "gpt-3.5-turbo-16k";
51pub const GPT3_5_TURBO_INSTRUCT: &str = "gpt-3.5-turbo-instruct";
52pub const GPT3_5_TURBO_0613: &str = "gpt-3.5-turbo-0613";
54pub const GPT3_5_TURBO_16K_0613: &str = "gpt-3.5-turbo-16k-0613";
55pub const GPT3_5_TURBO_0301: &str = "gpt-3.5-turbo-0301";
56
57pub const GPT4_0125_PREVIEW: &str = "gpt-4-0125-preview";
59pub const GPT4_TURBO_PREVIEW: &str = "gpt-4-turbo-preview";
60pub const GPT4_1106_PREVIEW: &str = "gpt-4-1106-preview";
61pub const GPT4_VISION_PREVIEW: &str = "gpt-4-vision-preview";
62pub const GPT4: &str = "gpt-4";
63pub const GPT4_32K: &str = "gpt-4-32k";
64pub const GPT4_0613: &str = "gpt-4-0613";
65pub const GPT4_32K_0613: &str = "gpt-4-32k-0613";
66pub const GPT4_0314: &str = "gpt-4-0314";
68pub const GPT4_32K_0314: &str = "gpt-4-32k-0314";
69
70pub const DALL_E_2: &str = "dall-e-2";
72pub const DALL_E_3: &str = "dall-e-3";
73
74pub const TEXT_EMBEDDING_3_SMALL: &str = "text-embedding-3-small";
76pub const TEXT_EMBEDDING_3_LARGE: &str = "text-embedding-3-large";
77pub const TEXT_EMBEDDING_ADA_002: &str = "text-embedding-ada-002";