openai-lib 0.1.0

APIs for sampling from and fine-tuning language models
Documentation
/*
 * OpenAI API
 *
 * APIs for sampling from and fine-tuning language models
 *
 * The version of the OpenAPI document: 1.2.0
 * 
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct CreateImageRequest {
    /// A text description of the desired image(s). The maximum length is 1000 characters.
    #[serde(rename = "prompt")]
    pub prompt: String,
    /// The number of images to generate. Must be between 1 and 10.
    #[serde(rename = "n", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub n: Option<Option<i32>>,
    /// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
    #[serde(rename = "size", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub size: Option<Option<Size>>,
    /// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
    #[serde(rename = "response_format", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub response_format: Option<Option<ResponseFormat>>,
    /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). 
    #[serde(rename = "user", skip_serializing_if = "Option::is_none")]
    pub user: Option<String>,
}

impl CreateImageRequest {
    pub fn new(prompt: String) -> CreateImageRequest {
        CreateImageRequest {
            prompt,
            n: None,
            size: None,
            response_format: None,
            user: None,
        }
    }
}

/// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Size {
    #[serde(rename = "256x256")]
    Variant256x256,
    #[serde(rename = "512x512")]
    Variant512x512,
    #[serde(rename = "1024x1024")]
    Variant1024x1024,
}

impl Default for Size {
    fn default() -> Size {
        Self::Variant256x256
    }
}
/// The format in which the generated images are returned. Must be one of `url` or `b64_json`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ResponseFormat {
    #[serde(rename = "url")]
    Url,
    #[serde(rename = "b64_json")]
    B64Json,
}

impl Default for ResponseFormat {
    fn default() -> ResponseFormat {
        Self::Url
    }
}