vapi_client/models/computer_tool.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 ComputerTool {
17 /// 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`).
18 #[serde(rename = "async", skip_serializing_if = "Option::is_none")]
19 pub r#async: Option<bool>,
20 /// 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.
21 #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
22 pub messages: Option<Vec<models::CreateDtmfToolDtoMessagesInner>>,
23 /// The type of tool. \"computer\" for Computer tool.
24 #[serde(rename = "type")]
25 pub r#type: Type,
26 /// The sub type of tool.
27 #[serde(rename = "subType")]
28 pub sub_type: SubType,
29 /// This is the unique identifier for the tool.
30 #[serde(rename = "id")]
31 pub id: String,
32 /// This is the unique identifier for the organization that this tool belongs to.
33 #[serde(rename = "orgId")]
34 pub org_id: String,
35 /// This is the ISO 8601 date-time string of when the tool was created.
36 #[serde(rename = "createdAt")]
37 pub created_at: String,
38 /// This is the ISO 8601 date-time string of when the tool was last updated.
39 #[serde(rename = "updatedAt")]
40 pub updated_at: String,
41 /// 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.
42 #[serde(rename = "function", skip_serializing_if = "Option::is_none")]
43 pub function: Option<models::OpenAiFunction>,
44 /// 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.
45 #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
46 pub server: Option<models::Server>,
47 /// The name of the tool, fixed to 'computer'
48 #[serde(rename = "name")]
49 pub name: Name,
50 /// The display width in pixels
51 #[serde(rename = "displayWidthPx")]
52 pub display_width_px: f64,
53 /// The display height in pixels
54 #[serde(rename = "displayHeightPx")]
55 pub display_height_px: f64,
56 /// Optional display number
57 #[serde(rename = "displayNumber", skip_serializing_if = "Option::is_none")]
58 pub display_number: Option<f64>,
59}
60
61impl ComputerTool {
62 pub fn new(
63 r#type: Type,
64 sub_type: SubType,
65 id: String,
66 org_id: String,
67 created_at: String,
68 updated_at: String,
69 name: Name,
70 display_width_px: f64,
71 display_height_px: f64,
72 ) -> ComputerTool {
73 ComputerTool {
74 r#async: None,
75 messages: None,
76 r#type,
77 sub_type,
78 id,
79 org_id,
80 created_at,
81 updated_at,
82 function: None,
83 server: None,
84 name,
85 display_width_px,
86 display_height_px,
87 display_number: None,
88 }
89 }
90}
91/// The type of tool. \"computer\" for Computer tool.
92#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
93pub enum Type {
94 #[serde(rename = "computer")]
95 Computer,
96}
97
98impl Default for Type {
99 fn default() -> Type {
100 Self::Computer
101 }
102}
103/// The sub type of tool.
104#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
105pub enum SubType {
106 #[serde(rename = "computer_20241022")]
107 Computer20241022,
108}
109
110impl Default for SubType {
111 fn default() -> SubType {
112 Self::Computer20241022
113 }
114}
115/// The name of the tool, fixed to 'computer'
116#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
117pub enum Name {
118 #[serde(rename = "computer")]
119 Computer,
120}
121
122impl Default for Name {
123 fn default() -> Name {
124 Self::Computer
125 }
126}