windmill-api 1.817.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * Windmill API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.817.0
 * Contact: contact@windmill.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FlowConversationMessage {
    /// Unique identifier for the message
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    /// The conversation this message belongs to
    #[serde(rename = "conversation_id")]
    pub conversation_id: uuid::Uuid,
    /// Type of the message
    #[serde(rename = "message_type")]
    pub message_type: MessageType,
    /// The message content
    #[serde(rename = "content")]
    pub content: String,
    /// Associated job ID if this message came from a flow run
    #[serde(rename = "job_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub job_id: Option<Option<uuid::Uuid>>,
    /// When the message was created
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Monotonic cursor assigned when the message is inserted
    #[serde(rename = "created_seq")]
    pub created_seq: i64,
    /// The step name that produced that message
    #[serde(rename = "step_name", skip_serializing_if = "Option::is_none")]
    pub step_name: Option<String>,
    /// Whether the message is a success
    #[serde(rename = "success", skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// 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.
    #[serde(rename = "tool_arguments", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tool_arguments: Option<Option<String>>,
    /// 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.
    #[serde(rename = "tool_result", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub tool_result: Option<Option<String>>,
    /// 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.
    #[serde(rename = "reasoning", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub reasoning: Option<Option<String>>,
    /// 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.
    #[serde(rename = "attachments", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub attachments: Option<Option<Vec<models::FlowConversationMessageAttachmentsInner>>>,
}

impl FlowConversationMessage {
    pub fn new(id: uuid::Uuid, conversation_id: uuid::Uuid, message_type: MessageType, content: String, created_at: String, created_seq: i64) -> FlowConversationMessage {
        FlowConversationMessage {
            id,
            conversation_id,
            message_type,
            content,
            job_id: None,
            created_at,
            created_seq,
            step_name: None,
            success: None,
            tool_arguments: None,
            tool_result: None,
            reasoning: None,
            attachments: None,
        }
    }
}
/// Type of the message
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum MessageType {
    #[serde(rename = "user")]
    User,
    #[serde(rename = "assistant")]
    Assistant,
    #[serde(rename = "system")]
    System,
    #[serde(rename = "tool")]
    Tool,
}

impl Default for MessageType {
    fn default() -> MessageType {
        Self::User
    }
}