vapi_client/models/text_editor_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};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct TextEditorToolWithToolCall {
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. \"textEditor\" for Text Editor 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 #[serde(rename = "toolCall")]
30 pub tool_call: models::ToolCall,
31 /// The name of the tool, fixed to 'str_replace_editor'
32 #[serde(rename = "name")]
33 pub name: Name,
34 /// 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.
35 #[serde(rename = "function", skip_serializing_if = "Option::is_none")]
36 pub function: Option<models::OpenAiFunction>,
37 /// 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.
38 #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
39 pub server: Option<models::Server>,
40}
41
42impl TextEditorToolWithToolCall {
43 pub fn new(
44 r#type: Type,
45 sub_type: SubType,
46 tool_call: models::ToolCall,
47 name: Name,
48 ) -> TextEditorToolWithToolCall {
49 TextEditorToolWithToolCall {
50 r#async: None,
51 messages: None,
52 r#type,
53 sub_type,
54 tool_call,
55 name,
56 function: None,
57 server: None,
58 }
59 }
60}
61/// The type of tool. \"textEditor\" for Text Editor tool.
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
63pub enum Type {
64 #[serde(rename = "textEditor")]
65 TextEditor,
66}
67
68impl Default for Type {
69 fn default() -> Type {
70 Self::TextEditor
71 }
72}
73/// The sub type of tool.
74#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
75pub enum SubType {
76 #[serde(rename = "text_editor_20241022")]
77 TextEditor20241022,
78}
79
80impl Default for SubType {
81 fn default() -> SubType {
82 Self::TextEditor20241022
83 }
84}
85/// The name of the tool, fixed to 'str_replace_editor'
86#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
87pub enum Name {
88 #[serde(rename = "str_replace_editor")]
89 StrReplaceEditor,
90}
91
92impl Default for Name {
93 fn default() -> Name {
94 Self::StrReplaceEditor
95 }
96}