vapi_client/models/
computer_tool_with_tool_call.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 ComputerToolWithToolCall {
19    /// This determines if the tool is async.  If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.  If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.  Defaults to synchronous (`false`).
20    #[serde(rename = "async", skip_serializing_if = "Option::is_none")]
21    pub r#async: Option<bool>,
22    /// These are the messages that will be spoken to the user as the tool is running.  For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured.
23    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
24    pub messages: Option<Vec<models::CreateDtmfToolDtoMessagesInner>>,
25    /// The type of tool. \"computer\" for Computer tool.
26    #[serde(rename = "type")]
27    pub r#type: Type,
28    /// The sub type of tool.
29    #[serde(rename = "subType")]
30    pub sub_type: SubType,
31    #[serde(rename = "toolCall")]
32    pub tool_call: models::ToolCall,
33    /// The name of the tool, fixed to 'computer'
34    #[serde(rename = "name")]
35    pub name: Name,
36    /// The display width in pixels
37    #[serde(rename = "displayWidthPx")]
38    pub display_width_px: f64,
39    /// The display height in pixels
40    #[serde(rename = "displayHeightPx")]
41    pub display_height_px: f64,
42    /// Optional display number
43    #[serde(rename = "displayNumber", skip_serializing_if = "Option::is_none")]
44    pub display_number: Option<f64>,
45    /// This is the function definition of the tool.  For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases.  An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument \"reason\". Then, in `messages` array, you can have many \"request-complete\" messages. One of these messages will be triggered if the `messages[].conditions` matches the \"reason\" argument.
46    #[serde(rename = "function", skip_serializing_if = "Option::is_none")]
47    pub function: Option<models::OpenAiFunction>,
48    /// This is the server that will be hit when this tool is requested by the model.  All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.  This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.
49    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
50    pub server: Option<models::Server>,
51}
52
53impl ComputerToolWithToolCall {
54    pub fn new(
55        r#type: Type,
56        sub_type: SubType,
57        tool_call: models::ToolCall,
58        name: Name,
59        display_width_px: f64,
60        display_height_px: f64,
61    ) -> ComputerToolWithToolCall {
62        ComputerToolWithToolCall {
63            r#async: None,
64            messages: None,
65            r#type,
66            sub_type,
67            tool_call,
68            name,
69            display_width_px,
70            display_height_px,
71            display_number: None,
72            function: None,
73            server: None,
74        }
75    }
76}
77/// The type of tool. \"computer\" for Computer tool.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
79pub enum Type {
80    #[serde(rename = "computer")]
81    Computer,
82}
83
84impl Default for Type {
85    fn default() -> Type {
86        Self::Computer
87    }
88}
89/// The sub type of tool.
90#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
91pub enum SubType {
92    #[serde(rename = "computer_20241022")]
93    Computer20241022,
94}
95
96impl Default for SubType {
97    fn default() -> SubType {
98        Self::Computer20241022
99    }
100}
101/// The name of the tool, fixed to 'computer'
102#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
103pub enum Name {
104    #[serde(rename = "computer")]
105    Computer,
106}
107
108impl Default for Name {
109    fn default() -> Name {
110        Self::Computer
111    }
112}