mindcontrol_types 0.21.0

Mind Control types
Documentation
use super::prompt::PromptV1;
use super::var::VarV1;
use super::signature::SignatureV1;
use super::llm::LlmSettingsV1;
use super::fragment::FragmentV1;
use serde::{Deserialize, Serialize};
use litty::literal;
use genotype_runtime::Any;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ResourceV1 {
    ResourcePromptV1(ResourcePromptV1),
    ResourceChainV1(ResourceChainV1),
    ResourceDataV1(ResourceDataV1),
    ResourceSettingsV1(ResourceSettingsV1),
    ResourceFragmentsV1(ResourceFragmentsV1),
}

/// Prompt chain resource. Represents a chain of prompts.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourceChainV1 {
    /// Resource type.
    pub r#type: ResourceChainV1TypeChain,
    /// Chain variable
    pub var: VarV1,
    /// Chain signature.
    pub signature: SignatureV1,
    /// Prompts chain.
    pub chain: Vec<PromptV1>,
    /// Default system model instructions. Applied to each prompt in the chain unless specified.
    pub system: Option<String>,
    /// Default settings. Applied to each prompt in the chain unless specified.
    pub settings: Option<LlmSettingsV1>,
}

#[literal("chain")]
pub struct ResourceChainV1TypeChain;

/// Data resource. Represents free-form data.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourceDataV1 {
    /// Resource type.
    pub r#type: ResourceDataV1TypeData,
    /// Data variable.
    pub var: VarV1,
    /// Data.
    pub data: Any,
}

#[literal("data")]
pub struct ResourceDataV1TypeData;

/// Prompt resource. Represents a prompt template.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourcePromptV1 {
    /// Resource type.
    pub r#type: ResourcePromptV1TypePrompt,
    /// Prompt variable.
    pub var: VarV1,
    /// Prompt signature.
    pub signature: SignatureV1,
    /// Prompt.
    pub prompt: PromptV1,
}

#[literal("prompt")]
pub struct ResourcePromptV1TypePrompt;

/// AI model settings resource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourceSettingsV1 {
    /// Resource type.
    pub r#type: ResourceSettingsV1TypeSettings,
    /// Settings variable.
    pub var: VarV1,
    /// Settings object.
    pub settings: LlmSettingsV1,
}

#[literal("settings")]
pub struct ResourceSettingsV1TypeSettings;

/// Fragments resource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ResourceFragmentsV1 {
    /// Fragments type.
    pub r#type: ResourceFragmentsV1TypeFragments,
    /// Fragments variable.
    pub var: VarV1,
    /// Fragments array.
    pub fragments: Vec<FragmentV1>,
}

#[literal("fragments")]
pub struct ResourceFragmentsV1TypeFragments;