vapi_client/models/
chat.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 Chat {
16    /// This is the assistant that will be used for the chat. To use an existing assistant, use `assistantId` instead.
17    #[serde(rename = "assistantId", skip_serializing_if = "Option::is_none")]
18    pub assistant_id: Option<String>,
19    /// This is the assistant that will be used for the chat. To use an existing assistant, use `assistantId` instead.
20    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
21    pub assistant: Option<models::CreateAssistantDto>,
22    /// This is the name of the chat. This is just for your own reference.
23    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
24    pub name: Option<String>,
25    /// This is the ID of the session that will be used for the chat. Mutually exclusive with previousChatId.
26    #[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")]
27    pub session_id: Option<String>,
28    #[serde(rename = "input", skip_serializing_if = "Option::is_none")]
29    pub input: Option<models::ChatInput>,
30    /// This is a flag that determines whether the response should be streamed. When true, the response will be sent as chunks of text.
31    #[serde(rename = "stream", skip_serializing_if = "Option::is_none")]
32    pub stream: Option<bool>,
33    /// This is the ID of the chat that will be used as context for the new chat. The messages from the previous chat will be used as context. Mutually exclusive with sessionId.
34    #[serde(rename = "previousChatId", skip_serializing_if = "Option::is_none")]
35    pub previous_chat_id: Option<String>,
36    /// This is the unique identifier for the chat.
37    #[serde(rename = "id")]
38    pub id: String,
39    /// This is the unique identifier for the org that this chat belongs to.
40    #[serde(rename = "orgId")]
41    pub org_id: String,
42    /// This is an array of messages used as context for the chat. Used to provide message history for multi-turn conversations.
43    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
44    pub messages: Option<Vec<models::MessageArrayInner>>,
45    /// This is the output messages generated by the system in response to the input.
46    #[serde(rename = "output", skip_serializing_if = "Option::is_none")]
47    pub output: Option<Vec<models::MessageArrayInner>>,
48    /// This is the ISO 8601 date-time string of when the chat was created.
49    #[serde(rename = "createdAt")]
50    pub created_at: String,
51    /// This is the ISO 8601 date-time string of when the chat was last updated.
52    #[serde(rename = "updatedAt")]
53    pub updated_at: String,
54    /// These are the costs of individual components of the chat in USD.
55    #[serde(rename = "costs", skip_serializing_if = "Option::is_none")]
56    pub costs: Option<Vec<models::ChatCostsInner>>,
57    /// This is the cost of the chat in USD.
58    #[serde(rename = "cost", skip_serializing_if = "Option::is_none")]
59    pub cost: Option<f64>,
60}
61
62impl Chat {
63    pub fn new(id: String, org_id: String, created_at: String, updated_at: String) -> Chat {
64        Chat {
65            assistant_id: None,
66            assistant: None,
67            name: None,
68            session_id: None,
69            input: None,
70            stream: None,
71            previous_chat_id: None,
72            id,
73            org_id,
74            messages: None,
75            output: None,
76            created_at,
77            updated_at,
78            costs: None,
79            cost: None,
80        }
81    }
82}