Skip to main content

outfox_openai/spec/vectorstores/
api.rs

1use derive_builder::Builder;
2use serde::{Deserialize, Serialize};
3
4use crate::error::OpenAIError;
5
6/// Sort order for listing vector stores.
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
8#[serde(rename_all = "lowercase")]
9pub enum ListVectorStoresOrder {
10    /// Ascending order
11    Asc,
12    /// Descending order
13    Desc,
14}
15
16/// Query parameters for listing vector stores.
17#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
18#[builder(name = "ListVectorStoresQueryArgs")]
19#[builder(pattern = "mutable")]
20#[builder(setter(into, strip_option), default)]
21#[builder(derive(Debug))]
22#[builder(build_fn(error = "OpenAIError"))]
23pub struct ListVectorStoresQuery {
24    /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
25    /// default is 20.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub limit: Option<u32>,
28    /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and
29    /// `desc` for descending order.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub order: Option<ListVectorStoresOrder>,
32    /// A cursor for use in pagination. `after` is an object ID that defines your place in the
33    /// list.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub after: Option<String>,
36    /// A cursor for use in pagination. `before` is an object ID that defines your place in the
37    /// list.
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub before: Option<String>,
40}
41
42/// Sort order for listing files in vector store batch.
43#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
44#[serde(rename_all = "lowercase")]
45pub enum ListFilesInVectorStoreBatchOrder {
46    /// Ascending order
47    Asc,
48    /// Descending order
49    Desc,
50}
51
52/// Filter by file status for files in vector store batch.
53#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
54#[serde(rename_all = "snake_case")]
55pub enum ListFilesInVectorStoreBatchFilter {
56    /// In progress status
57    InProgress,
58    /// Completed status
59    Completed,
60    /// Failed status
61    Failed,
62    /// Cancelled status
63    Cancelled,
64}
65
66/// Query parameters for listing files in vector store batch.
67#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
68#[builder(name = "ListFilesInVectorStoreBatchQueryArgs")]
69#[builder(pattern = "mutable")]
70#[builder(setter(into, strip_option), default)]
71#[builder(derive(Debug))]
72#[builder(build_fn(error = "OpenAIError"))]
73pub struct ListFilesInVectorStoreBatchQuery {
74    /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
75    /// default is 20.
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub limit: Option<u32>,
78    /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and
79    /// `desc` for descending order.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub order: Option<ListFilesInVectorStoreBatchOrder>,
82    /// A cursor for use in pagination. `after` is an object ID that defines your place in the
83    /// list.
84    #[serde(skip_serializing_if = "Option::is_none")]
85    pub after: Option<String>,
86    /// A cursor for use in pagination. `before` is an object ID that defines your place in the
87    /// list.
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub before: Option<String>,
90    /// Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
91    #[serde(skip_serializing_if = "Option::is_none")]
92    pub filter: Option<ListFilesInVectorStoreBatchFilter>,
93}
94
95/// Sort order for listing vector store files.
96#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
97#[serde(rename_all = "lowercase")]
98pub enum ListVectorStoreFilesOrder {
99    /// Ascending order
100    Asc,
101    /// Descending order
102    Desc,
103}
104
105/// Filter by file status for vector store files.
106#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
107#[serde(rename_all = "snake_case")]
108pub enum ListVectorStoreFilesFilter {
109    /// In progress status
110    InProgress,
111    /// Completed status
112    Completed,
113    /// Failed status
114    Failed,
115    /// Cancelled status
116    Cancelled,
117}
118
119/// Query parameters for listing vector store files.
120#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
121#[builder(name = "ListVectorStoreFilesQueryArgs")]
122#[builder(pattern = "mutable")]
123#[builder(setter(into, strip_option), default)]
124#[builder(derive(Debug))]
125#[builder(build_fn(error = "OpenAIError"))]
126pub struct ListVectorStoreFilesQuery {
127    /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
128    /// default is 20.
129    #[serde(skip_serializing_if = "Option::is_none")]
130    pub limit: Option<u32>,
131    /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and
132    /// `desc` for descending order.
133    #[serde(skip_serializing_if = "Option::is_none")]
134    pub order: Option<ListVectorStoreFilesOrder>,
135    /// A cursor for use in pagination. `after` is an object ID that defines your place in the
136    /// list.
137    #[serde(skip_serializing_if = "Option::is_none")]
138    pub after: Option<String>,
139    /// A cursor for use in pagination. `before` is an object ID that defines your place in the
140    /// list.
141    #[serde(skip_serializing_if = "Option::is_none")]
142    pub before: Option<String>,
143    /// Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
144    #[serde(skip_serializing_if = "Option::is_none")]
145    pub filter: Option<ListVectorStoreFilesFilter>,
146}