vapi_client/models/
tool_node.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 ToolNode {
16    /// This is the Tool node. This can be used to call a tool in your workflow.  The flow is: - Workflow starts the tool node - Model is called to extract parameters needed by the tool from the conversation history - Tool is called with the parameters - Server returns a response - Workflow continues with the response
17    #[serde(rename = "type")]
18    pub r#type: TypeTrue,
19    #[serde(rename = "tool", skip_serializing_if = "Option::is_none")]
20    pub tool: Option<models::ToolNodeTool>,
21    /// This is the tool to call. To use a transient tool, send `tool` instead.
22    #[serde(rename = "toolId", skip_serializing_if = "Option::is_none")]
23    pub tool_id: Option<String>,
24    #[serde(rename = "name")]
25    pub name: String,
26    /// This is whether or not the node is the start of the workflow.
27    #[serde(rename = "isStart", skip_serializing_if = "Option::is_none")]
28    pub is_start: Option<bool>,
29    /// This is for metadata you want to store on the task.
30    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
31    pub metadata: Option<serde_json::Value>,
32}
33
34impl ToolNode {
35    pub fn new(r#type: TypeTrue, name: String) -> ToolNode {
36        ToolNode {
37            r#type,
38            tool: None,
39            tool_id: None,
40            name,
41            is_start: None,
42            metadata: None,
43        }
44    }
45}
46/// This is the Tool node. This can be used to call a tool in your workflow.  The flow is: - Workflow starts the tool node - Model is called to extract parameters needed by the tool from the conversation history - Tool is called with the parameters - Server returns a response - Workflow continues with the response
47#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
48pub enum TypeTrue {
49    #[serde(rename = "tool")]
50    Tool,
51}
52
53impl Default for TypeTrue {
54    fn default() -> TypeTrue {
55        Self::Tool
56    }
57}