Skip to main content

windmill_api/models/
flow_conversation_message.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.817.0
7 * Contact: contact@windmill.dev
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 FlowConversationMessage {
16    /// Unique identifier for the message
17    #[serde(rename = "id")]
18    pub id: uuid::Uuid,
19    /// The conversation this message belongs to
20    #[serde(rename = "conversation_id")]
21    pub conversation_id: uuid::Uuid,
22    /// Type of the message
23    #[serde(rename = "message_type")]
24    pub message_type: MessageType,
25    /// The message content
26    #[serde(rename = "content")]
27    pub content: String,
28    /// Associated job ID if this message came from a flow run
29    #[serde(rename = "job_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub job_id: Option<Option<uuid::Uuid>>,
31    /// When the message was created
32    #[serde(rename = "created_at")]
33    pub created_at: String,
34    /// Monotonic cursor assigned when the message is inserted
35    #[serde(rename = "created_seq")]
36    pub created_seq: i64,
37    /// The step name that produced that message
38    #[serde(rename = "step_name", skip_serializing_if = "Option::is_none")]
39    pub step_name: Option<String>,
40    /// Whether the message is a success
41    #[serde(rename = "success", skip_serializing_if = "Option::is_none")]
42    pub success: Option<bool>,
43    /// On a tool row, the arguments the model wrote for the call. For a script, flow or AI agent tool these exclude the inputs its step wires in, which only the tool's job holds. Null for a provider-native web search, whose query the provider does not return.
44    #[serde(rename = "tool_arguments", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
45    pub tool_arguments: Option<Option<String>>,
46    /// On a tool row, the text the model got back from the call, or what the call failed with — the row's own text names the tool rather than the reason. For a provider-native web search, its citations.
47    #[serde(rename = "tool_result", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
48    pub tool_result: Option<Option<String>>,
49    /// On an answer, the thinking that produced it; on a tool row, the thinking that led to the call. Each round's thinking is on one row. The agent job's result keeps the turn's thinking as a single string.
50    #[serde(rename = "reasoning", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
51    pub reasoning: Option<Option<String>>,
52    /// The files a user message carried, as object-storage references: every flow input other than user_message that held one or a list of them, at most 20. Never file bytes or a presigned URL.
53    #[serde(rename = "attachments", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
54    pub attachments: Option<Option<Vec<models::FlowConversationMessageAttachmentsInner>>>,
55}
56
57impl FlowConversationMessage {
58    pub fn new(id: uuid::Uuid, conversation_id: uuid::Uuid, message_type: MessageType, content: String, created_at: String, created_seq: i64) -> FlowConversationMessage {
59        FlowConversationMessage {
60            id,
61            conversation_id,
62            message_type,
63            content,
64            job_id: None,
65            created_at,
66            created_seq,
67            step_name: None,
68            success: None,
69            tool_arguments: None,
70            tool_result: None,
71            reasoning: None,
72            attachments: None,
73        }
74    }
75}
76/// Type of the message
77#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
78pub enum MessageType {
79    #[serde(rename = "user")]
80    User,
81    #[serde(rename = "assistant")]
82    Assistant,
83    #[serde(rename = "system")]
84    System,
85    #[serde(rename = "tool")]
86    Tool,
87}
88
89impl Default for MessageType {
90    fn default() -> MessageType {
91        Self::User
92    }
93}
94