vapi_client/models/
open_ai_model.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OpenAiModel {
17    /// This is the starting state for the conversation.
18    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
19    pub messages: Option<Vec<models::OpenAiMessage>>,
20    /// These are the tools that the assistant can use during the call. To use existing tools, use `toolIds`.  Both `tools` and `toolIds` can be used together.
21    #[serde(rename = "tools", skip_serializing_if = "Option::is_none")]
22    pub tools: Option<Vec<models::AnyscaleModelToolsInner>>,
23    /// These are the tools that the assistant can use during the call. To use transient tools, use `tools`.  Both `tools` and `toolIds` can be used together.
24    #[serde(rename = "toolIds", skip_serializing_if = "Option::is_none")]
25    pub tool_ids: Option<Vec<String>>,
26    #[serde(rename = "knowledgeBase", skip_serializing_if = "Option::is_none")]
27    pub knowledge_base: Option<models::AnyscaleModelKnowledgeBase>,
28    /// This is the ID of the knowledge base the model will use.
29    #[serde(rename = "knowledgeBaseId", skip_serializing_if = "Option::is_none")]
30    pub knowledge_base_id: Option<String>,
31    /// This is the provider that will be used for the model.
32    #[serde(rename = "provider")]
33    pub provider: Provider,
34    /// This is the OpenAI model that will be used.
35    #[serde(rename = "model")]
36    pub model: Model,
37    /// These are the fallback models that will be used if the primary model fails. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest fallbacks that make sense.
38    #[serde(rename = "fallbackModels", skip_serializing_if = "Option::is_none")]
39    pub fallback_models: Option<Vec<FallbackModels>>,
40    /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.
41    #[serde(rename = "temperature", skip_serializing_if = "Option::is_none")]
42    pub temperature: Option<f64>,
43    /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.
44    #[serde(rename = "maxTokens", skip_serializing_if = "Option::is_none")]
45    pub max_tokens: Option<f64>,
46    /// This determines whether we detect user's emotion while they speak and send it as an additional info to model.  Default `false` because the model is usually are good at understanding the user's emotion from text.  @default false
47    #[serde(
48        rename = "emotionRecognitionEnabled",
49        skip_serializing_if = "Option::is_none"
50    )]
51    pub emotion_recognition_enabled: Option<bool>,
52    /// This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.  Default is 0.  @default 0
53    #[serde(rename = "numFastTurns", skip_serializing_if = "Option::is_none")]
54    pub num_fast_turns: Option<f64>,
55}
56
57impl OpenAiModel {
58    pub fn new(provider: Provider, model: Model) -> OpenAiModel {
59        OpenAiModel {
60            messages: None,
61            tools: None,
62            tool_ids: None,
63            knowledge_base: None,
64            knowledge_base_id: None,
65            provider,
66            model,
67            fallback_models: None,
68            temperature: None,
69            max_tokens: None,
70            emotion_recognition_enabled: None,
71            num_fast_turns: None,
72        }
73    }
74}
75/// This is the provider that will be used for the model.
76#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
77pub enum Provider {
78    #[serde(rename = "openai")]
79    Openai,
80}
81
82impl Default for Provider {
83    fn default() -> Provider {
84        Self::Openai
85    }
86}
87/// This is the OpenAI model that will be used.
88#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
89pub enum Model {
90    #[serde(rename = "gpt-4.5-preview")]
91    Gpt4Period5Preview,
92    #[serde(rename = "chatgpt-4o-latest")]
93    Chatgpt4oLatest,
94    #[serde(rename = "o3-mini")]
95    O3Mini,
96    #[serde(rename = "o1-preview")]
97    O1Preview,
98    #[serde(rename = "o1-preview-2024-09-12")]
99    O1Preview20240912,
100    #[serde(rename = "o1-mini")]
101    O1Mini,
102    #[serde(rename = "o1-mini-2024-09-12")]
103    O1Mini20240912,
104    #[serde(rename = "gpt-4o-realtime-preview-2024-10-01")]
105    Gpt4oRealtimePreview20241001,
106    #[serde(rename = "gpt-4o-realtime-preview-2024-12-17")]
107    Gpt4oRealtimePreview20241217,
108    #[serde(rename = "gpt-4o-mini-realtime-preview-2024-12-17")]
109    Gpt4oMiniRealtimePreview20241217,
110    #[serde(rename = "gpt-4o-mini")]
111    Gpt4oMini,
112    #[serde(rename = "gpt-4o-mini-2024-07-18")]
113    Gpt4oMini20240718,
114    #[serde(rename = "gpt-4o")]
115    Gpt4o,
116    #[serde(rename = "gpt-4o-2024-05-13")]
117    Gpt4o20240513,
118    #[serde(rename = "gpt-4o-2024-08-06")]
119    Gpt4o20240806,
120    #[serde(rename = "gpt-4o-2024-11-20")]
121    Gpt4o20241120,
122    #[serde(rename = "gpt-4-turbo")]
123    Gpt4Turbo,
124    #[serde(rename = "gpt-4-turbo-2024-04-09")]
125    Gpt4Turbo20240409,
126    #[serde(rename = "gpt-4-turbo-preview")]
127    Gpt4TurboPreview,
128    #[serde(rename = "gpt-4-0125-preview")]
129    Gpt40125Preview,
130    #[serde(rename = "gpt-4-1106-preview")]
131    Gpt41106Preview,
132    #[serde(rename = "gpt-4")]
133    Gpt4,
134    #[serde(rename = "gpt-4-0613")]
135    Gpt40613,
136    #[serde(rename = "gpt-3.5-turbo")]
137    Gpt3Period5Turbo,
138    #[serde(rename = "gpt-3.5-turbo-0125")]
139    Gpt3Period5Turbo0125,
140    #[serde(rename = "gpt-3.5-turbo-1106")]
141    Gpt3Period5Turbo1106,
142    #[serde(rename = "gpt-3.5-turbo-16k")]
143    Gpt3Period5Turbo16k,
144    #[serde(rename = "gpt-3.5-turbo-0613")]
145    Gpt3Period5Turbo0613,
146}
147
148impl Default for Model {
149    fn default() -> Model {
150        Self::Gpt4Period5Preview
151    }
152}
153/// These are the fallback models that will be used if the primary model fails. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest fallbacks that make sense.
154#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
155pub enum FallbackModels {
156    #[serde(rename = "gpt-4.5-preview")]
157    Gpt4Period5Preview,
158    #[serde(rename = "chatgpt-4o-latest")]
159    Chatgpt4oLatest,
160    #[serde(rename = "o3-mini")]
161    O3Mini,
162    #[serde(rename = "o1-preview")]
163    O1Preview,
164    #[serde(rename = "o1-preview-2024-09-12")]
165    O1Preview20240912,
166    #[serde(rename = "o1-mini")]
167    O1Mini,
168    #[serde(rename = "o1-mini-2024-09-12")]
169    O1Mini20240912,
170    #[serde(rename = "gpt-4o-realtime-preview-2024-10-01")]
171    Gpt4oRealtimePreview20241001,
172    #[serde(rename = "gpt-4o-realtime-preview-2024-12-17")]
173    Gpt4oRealtimePreview20241217,
174    #[serde(rename = "gpt-4o-mini-realtime-preview-2024-12-17")]
175    Gpt4oMiniRealtimePreview20241217,
176    #[serde(rename = "gpt-4o-mini")]
177    Gpt4oMini,
178    #[serde(rename = "gpt-4o-mini-2024-07-18")]
179    Gpt4oMini20240718,
180    #[serde(rename = "gpt-4o")]
181    Gpt4o,
182    #[serde(rename = "gpt-4o-2024-05-13")]
183    Gpt4o20240513,
184    #[serde(rename = "gpt-4o-2024-08-06")]
185    Gpt4o20240806,
186    #[serde(rename = "gpt-4o-2024-11-20")]
187    Gpt4o20241120,
188    #[serde(rename = "gpt-4-turbo")]
189    Gpt4Turbo,
190    #[serde(rename = "gpt-4-turbo-2024-04-09")]
191    Gpt4Turbo20240409,
192    #[serde(rename = "gpt-4-turbo-preview")]
193    Gpt4TurboPreview,
194    #[serde(rename = "gpt-4-0125-preview")]
195    Gpt40125Preview,
196    #[serde(rename = "gpt-4-1106-preview")]
197    Gpt41106Preview,
198    #[serde(rename = "gpt-4")]
199    Gpt4,
200    #[serde(rename = "gpt-4-0613")]
201    Gpt40613,
202    #[serde(rename = "gpt-3.5-turbo")]
203    Gpt3Period5Turbo,
204    #[serde(rename = "gpt-3.5-turbo-0125")]
205    Gpt3Period5Turbo0125,
206    #[serde(rename = "gpt-3.5-turbo-1106")]
207    Gpt3Period5Turbo1106,
208    #[serde(rename = "gpt-3.5-turbo-16k")]
209    Gpt3Period5Turbo16k,
210    #[serde(rename = "gpt-3.5-turbo-0613")]
211    Gpt3Period5Turbo0613,
212}
213
214impl Default for FallbackModels {
215    fn default() -> FallbackModels {
216        Self::Gpt4Period5Preview
217    }
218}