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};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ToolCallResult {
17 /// 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
18 #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
19 pub message: Option<Vec<models::ToolCallResultMessageInner>>,
20 /// This is the name of the function the model called.
21 #[serde(rename = "name")]
22 pub name: String,
23 /// This is the unique identifier for the tool call.
24 #[serde(rename = "toolCallId")]
25 pub tool_call_id: String,
26 /// 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
27 #[serde(rename = "result", skip_serializing_if = "Option::is_none")]
28 pub result: Option<String>,
29 /// 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
30 #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
31 pub error: Option<String>,
32}
33
34impl ToolCallResult {
35 pub fn new(name: String, tool_call_id: String) -> ToolCallResult {
36 ToolCallResult {
37 message: None,
38 name,
39 tool_call_id,
40 result: None,
41 error: None,
42 }
43 }
44}