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