vapi_client/models/
tool_call_result.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 ToolCallResult {
16    /// This is the message that will be spoken to the user.  If this is not returned, assistant will speak: 1. a `request-complete` or `request-failed` message from `tool.messages`, if it exists 2. a response generated by the model, if not
17    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
18    pub message: Option<Vec<models::ToolCallResultMessageInner>>,
19    /// This is the name of the function the model called.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// This is the unique identifier for the tool call.
23    #[serde(rename = "toolCallId")]
24    pub tool_call_id: String,
25    /// This is the result if the tool call was successful. This is added to the conversation history.  Further, if this is returned, assistant will speak: 1. the `message`, if it exists and is of type `request-complete` 2. a `request-complete` message from `tool.messages`, if it exists 3. a response generated by the model, if neither exist
26    #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
27    pub result: Option<String>,
28    /// This is the error if the tool call was not successful. This is added to the conversation history.  Further, if this is returned, assistant will speak: 1. the `message`, if it exists and is of type `request-failed` 2. a `request-failed` message from `tool.messages`, if it exists 3. a response generated by the model, if neither exist
29    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
30    pub error: Option<String>,
31}
32
33impl ToolCallResult {
34    pub fn new(name: String, tool_call_id: String) -> ToolCallResult {
35        ToolCallResult {
36            message: None,
37            name,
38            tool_call_id,
39            result: None,
40            error: None,
41        }
42    }
43}
44