vapi_client/models/
server_message_knowledge_base_request.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 ServerMessageKnowledgeBaseRequest {
16    #[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
17    pub phone_number: Option<models::ClientMessageWorkflowNodeStartedPhoneNumber>,
18    /// This is the type of the message. \"knowledge-base-request\" is sent to request knowledge base documents. To enable, use `assistant.knowledgeBase.provider=custom-knowledge-base`.
19    #[serde(rename = "type")]
20    pub r#type: TypeTrue,
21    /// These are the messages that are going to be sent to the `model` right after the `knowledge-base-request` webhook completes.
22    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
23    pub messages: Option<Vec<models::ArtifactMessagesInner>>,
24    /// This is just `messages` formatted for OpenAI.
25    #[serde(rename = "messagesOpenAIFormatted")]
26    pub messages_open_ai_formatted: Vec<models::OpenAiMessage>,
27    /// This is the timestamp of the message.
28    #[serde(rename = "timestamp", skip_serializing_if = "Option::is_none")]
29    pub timestamp: Option<f64>,
30    /// This is a live version of the `call.artifact`.  This matches what is stored on `call.artifact` after the call.
31    #[serde(rename = "artifact", skip_serializing_if = "Option::is_none")]
32    pub artifact: Option<models::Artifact>,
33    /// This is the assistant that the message is associated with.
34    #[serde(rename = "assistant", skip_serializing_if = "Option::is_none")]
35    pub assistant: Option<models::CreateAssistantDto>,
36    /// This is the customer that the message is associated with.
37    #[serde(rename = "customer", skip_serializing_if = "Option::is_none")]
38    pub customer: Option<models::CreateCustomerDto>,
39    /// This is the call that the message is associated with.
40    #[serde(rename = "call", skip_serializing_if = "Option::is_none")]
41    pub call: Option<models::Call>,
42    /// This is the chat object.
43    #[serde(rename = "chat", skip_serializing_if = "Option::is_none")]
44    pub chat: Option<models::Chat>,
45}
46
47impl ServerMessageKnowledgeBaseRequest {
48    pub fn new(
49        r#type: TypeTrue,
50        messages_open_ai_formatted: Vec<models::OpenAiMessage>,
51    ) -> ServerMessageKnowledgeBaseRequest {
52        ServerMessageKnowledgeBaseRequest {
53            phone_number: None,
54            r#type,
55            messages: None,
56            messages_open_ai_formatted,
57            timestamp: None,
58            artifact: None,
59            assistant: None,
60            customer: None,
61            call: None,
62            chat: None,
63        }
64    }
65}
66/// This is the type of the message. \"knowledge-base-request\" is sent to request knowledge base documents. To enable, use `assistant.knowledgeBase.provider=custom-knowledge-base`.
67#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
68pub enum TypeTrue {
69    #[serde(rename = "knowledge-base-request")]
70    KnowledgeBaseRequest,
71}
72
73impl Default for TypeTrue {
74    fn default() -> TypeTrue {
75        Self::KnowledgeBaseRequest
76    }
77}