vapi_client/models/
client_message_conversation_update.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};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct ClientMessageConversationUpdate {
19    /// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
20    #[serde(rename = "type")]
21    pub r#type: Type,
22    /// This is the most up-to-date conversation history at the time the message is sent.
23    #[serde(rename = "messages", skip_serializing_if = "Option::is_none")]
24    pub messages: Option<Vec<models::ArtifactMessagesInner>>,
25    /// This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI.
26    #[serde(rename = "messagesOpenAIFormatted")]
27    pub messages_open_ai_formatted: Vec<models::OpenAiMessage>,
28}
29
30impl ClientMessageConversationUpdate {
31    pub fn new(
32        r#type: Type,
33        messages_open_ai_formatted: Vec<models::OpenAiMessage>,
34    ) -> ClientMessageConversationUpdate {
35        ClientMessageConversationUpdate {
36            r#type,
37            messages: None,
38            messages_open_ai_formatted,
39        }
40    }
41}
42/// This is the type of the message. \"conversation-update\" is sent when an update is committed to the conversation history.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
44pub enum Type {
45    #[serde(rename = "conversation-update")]
46    ConversationUpdate,
47}
48
49impl Default for Type {
50    fn default() -> Type {
51        Self::ConversationUpdate
52    }
53}