vapi_client/models/
open_ai_model.rs

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