1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Vapi API
*
* Voice AI for developers.
*
* The version of the OpenAPI document: 1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ToolCallResult {
#[serde(rename = "message", skip_serializing_if = "Option::is_none")]
pub message: Option<models::ToolCallResultMessage>,
/// This is the name of the function the model called.
#[serde(rename = "name")]
pub name: String,
/// This is the unique identifier for the tool call.
#[serde(rename = "toolCallId")]
pub tool_call_id: String,
/// 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
#[serde(rename = "result", skip_serializing_if = "Option::is_none")]
pub result: Option<String>,
/// 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
#[serde(rename = "error", skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
/// This is optional metadata for the tool call result to be sent to the client.
#[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
pub metadata: Option<serde_json::Value>,
}
impl ToolCallResult {
pub fn new(name: String, tool_call_id: String) -> ToolCallResult {
ToolCallResult {
message: None,
name,
tool_call_id,
result: None,
error: None,
metadata: None,
}
}
}