Skip to main content

openai_types/file/
_gen.rs

1// AUTO-GENERATED by py2rust — do not edit.
2// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
3// Domain: file
4#![allow(unused_imports)]
5
6use serde::{Deserialize, Serialize};
7use super::*;
8
9pub type FileChunkingStrategy = serde_json::Value;
10
11pub type FileContent = String;
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
14#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
15pub struct FileCreateParams {
16    /// The File object (not file name) to be uploaded.
17    pub file: serde_json::Value,
18    /// The intended purpose of the uploaded file. One of:
19    pub purpose: FilePurpose,
20    /// The expiration policy for a file.
21    #[serde(skip_serializing_if = "Option::is_none", default)]
22    pub expires_after: Option<ExpiresAfter>,
23}
24
25/// The expiration policy for a file.
26#[derive(Debug, Clone, Serialize, Deserialize)]
27#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
28pub struct ExpiresAfter {
29    /// Anchor timestamp after which the expiration policy applies.
30    pub anchor: String,
31    /// The number of seconds after the anchor time that the file will expire.
32    pub seconds: i64,
33}
34
35#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
37#[non_exhaustive]
38pub enum FileListParamsOrder {
39    #[serde(rename = "asc")]
40    Asc,
41    #[serde(rename = "desc")]
42    Desc,
43}
44
45#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
46#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
47#[non_exhaustive]
48pub enum FileObjectPurpose {
49    #[serde(rename = "assistants")]
50    Assistants,
51    #[serde(rename = "assistants_output")]
52    AssistantsOutput,
53    #[serde(rename = "batch")]
54    Batch,
55    #[serde(rename = "batch_output")]
56    BatchOutput,
57    #[serde(rename = "fine-tune")]
58    FineTune,
59    #[serde(rename = "fine-tune-results")]
60    FineTuneResults,
61    #[serde(rename = "vision")]
62    Vision,
63    #[serde(rename = "user_data")]
64    UserData,
65}
66
67#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
68#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
69#[non_exhaustive]
70pub enum FileObjectStatus {
71    #[serde(rename = "uploaded")]
72    Uploaded,
73    #[serde(rename = "processed")]
74    Processed,
75    #[serde(rename = "error")]
76    Error,
77}
78
79/// This is returned when the chunking strategy is unknown.
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
82pub struct OtherFileChunkingStrategyObject {
83    /// Always `other`.
84    #[serde(rename = "type")]
85    pub type_: String,
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
90pub struct StaticFileChunkingStrategy {
91    /// The number of tokens that overlap between chunks. The default value is `400`.
92    pub chunk_overlap_tokens: i64,
93    /// The maximum number of tokens in each chunk.
94    pub max_chunk_size_tokens: i64,
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
98#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
99pub struct StaticFileChunkingStrategyObject {
100    #[serde(rename = "static")]
101    pub static_: StaticFileChunkingStrategy,
102    /// Always `static`.
103    #[serde(rename = "type")]
104    pub type_: String,
105}