vapi_client/models/
vapi_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};
12use utoipa::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct VapiModel {
19    /// This is the starting state for the conversation.
20    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
21    pub messages: Option<Vec<models::OpenAiMessage>>,
22    /// 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.
23    #[serde(rename = "tools", skip_serializing_if = "Option::is_none")]
24    pub tools: Option<Vec<models::AnyscaleModelToolsInner>>,
25    /// 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.
26    #[serde(rename = "toolIds", skip_serializing_if = "Option::is_none")]
27    pub tool_ids: Option<Vec<String>>,
28    #[serde(rename = "knowledgeBase", skip_serializing_if = "Option::is_none")]
29    pub knowledge_base: Option<models::AnyscaleModelKnowledgeBase>,
30    /// This is the ID of the knowledge base the model will use.
31    #[serde(rename = "knowledgeBaseId", skip_serializing_if = "Option::is_none")]
32    pub knowledge_base_id: Option<String>,
33    #[serde(rename = "steps", skip_serializing_if = "Option::is_none")]
34    pub steps: Option<Vec<models::VapiModelStepsInner>>,
35    #[serde(rename = "provider")]
36    pub provider: Provider,
37    /// This is the workflow that will be used for the call. To use a transient workflow, use `workflow` instead.
38    #[serde(rename = "workflowId", skip_serializing_if = "Option::is_none")]
39    pub workflow_id: Option<String>,
40    /// This is the workflow that will be used for the call. To use an existing workflow, use `workflowId` instead.
41    #[serde(rename = "workflow", skip_serializing_if = "Option::is_none")]
42    pub workflow: Option<models::Workflow>,
43    /// This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
44    #[serde(rename = "model")]
45    pub model: String,
46    /// This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.
47    #[serde(rename = "temperature", skip_serializing_if = "Option::is_none")]
48    pub temperature: Option<f64>,
49    /// This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.
50    #[serde(rename = "maxTokens", skip_serializing_if = "Option::is_none")]
51    pub max_tokens: Option<f64>,
52    /// 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
53    #[serde(
54        rename = "emotionRecognitionEnabled",
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub emotion_recognition_enabled: Option<bool>,
58    /// 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
59    #[serde(rename = "numFastTurns", skip_serializing_if = "Option::is_none")]
60    pub num_fast_turns: Option<f64>,
61}
62
63impl VapiModel {
64    pub fn new(provider: Provider, model: String) -> VapiModel {
65        VapiModel {
66            messages: None,
67            tools: None,
68            tool_ids: None,
69            knowledge_base: None,
70            knowledge_base_id: None,
71            steps: None,
72            provider,
73            workflow_id: None,
74            workflow: None,
75            model,
76            temperature: None,
77            max_tokens: None,
78            emotion_recognition_enabled: None,
79            num_fast_turns: None,
80        }
81    }
82}
83///
84#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
85pub enum Provider {
86    #[serde(rename = "vapi")]
87    Vapi,
88}
89
90impl Default for Provider {
91    fn default() -> Provider {
92        Self::Vapi
93    }
94}