openai-types 0.1.3

Typed OpenAI API models — zero dependencies beyond serde
Documentation
// AUTO-GENERATED by py2rust — do not edit.
// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
// Domain: file
#![allow(unused_imports)]

use serde::{Deserialize, Serialize};
use super::*;

pub type FileChunkingStrategy = serde_json::Value;

pub type FileContent = String;

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct FileCreateParams {
    /// The File object (not file name) to be uploaded.
    pub file: serde_json::Value,
    /// The intended purpose of the uploaded file. One of:
    pub purpose: FilePurpose,
    /// The expiration policy for a file.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub expires_after: Option<ExpiresAfter>,
}

/// The expiration policy for a file.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct ExpiresAfter {
    /// Anchor timestamp after which the expiration policy applies.
    pub anchor: String,
    /// The number of seconds after the anchor time that the file will expire.
    pub seconds: i64,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum FileListParamsOrder {
    #[serde(rename = "asc")]
    Asc,
    #[serde(rename = "desc")]
    Desc,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum FileObjectPurpose {
    #[serde(rename = "assistants")]
    Assistants,
    #[serde(rename = "assistants_output")]
    AssistantsOutput,
    #[serde(rename = "batch")]
    Batch,
    #[serde(rename = "batch_output")]
    BatchOutput,
    #[serde(rename = "fine-tune")]
    FineTune,
    #[serde(rename = "fine-tune-results")]
    FineTuneResults,
    #[serde(rename = "vision")]
    Vision,
    #[serde(rename = "user_data")]
    UserData,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
#[non_exhaustive]
pub enum FileObjectStatus {
    #[serde(rename = "uploaded")]
    Uploaded,
    #[serde(rename = "processed")]
    Processed,
    #[serde(rename = "error")]
    Error,
}

/// This is returned when the chunking strategy is unknown.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct OtherFileChunkingStrategyObject {
    /// Always `other`.
    #[serde(rename = "type")]
    pub type_: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct StaticFileChunkingStrategy {
    /// The number of tokens that overlap between chunks. The default value is `400`.
    pub chunk_overlap_tokens: i64,
    /// The maximum number of tokens in each chunk.
    pub max_chunk_size_tokens: i64,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
pub struct StaticFileChunkingStrategyObject {
    #[serde(rename = "static")]
    pub static_: StaticFileChunkingStrategy,
    /// Always `static`.
    #[serde(rename = "type")]
    pub type_: String,
}