vapi_client/models/
tool_call_result.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 ToolCallResult {
19    /// 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
20    #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
21    pub message: Option<Vec<models::ToolCallResultMessageInner>>,
22    /// This is the name of the function the model called.
23    #[serde(rename = "name")]
24    pub name: String,
25    /// This is the unique identifier for the tool call.
26    #[serde(rename = "toolCallId")]
27    pub tool_call_id: String,
28    /// 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
29    #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
30    pub result: Option<String>,
31    /// 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
32    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
33    pub error: Option<String>,
34}
35
36impl ToolCallResult {
37    pub fn new(name: String, tool_call_id: String) -> ToolCallResult {
38        ToolCallResult {
39            message: None,
40            name,
41            tool_call_id,
42            result: None,
43            error: None,
44        }
45    }
46}