async_openai/types/assistants/
api.rs

1use crate::error::OpenAIError;
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5/// Sort order for listing messages.
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7#[serde(rename_all = "lowercase")]
8pub enum ListMessagesOrder {
9    /// Ascending order
10    Asc,
11    /// Descending order
12    Desc,
13}
14
15/// Query parameters for listing messages.
16#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
17#[builder(name = "ListMessagesQueryArgs")]
18#[builder(pattern = "mutable")]
19#[builder(setter(into, strip_option), default)]
20#[builder(derive(Debug))]
21#[builder(build_fn(error = "OpenAIError"))]
22pub struct ListMessagesQuery {
23    /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub limit: Option<u32>,
26    /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub order: Option<ListMessagesOrder>,
29    /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub after: Option<String>,
32    /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub before: Option<String>,
35    /// Filter messages by the run ID that generated them.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub run_id: Option<String>,
38}
39
40/// Sort order for listing runs.
41#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
42#[serde(rename_all = "lowercase")]
43pub enum ListRunsOrder {
44    /// Ascending order
45    Asc,
46    /// Descending order
47    Desc,
48}
49
50/// Query parameters for listing runs.
51#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
52#[builder(name = "ListRunsQueryArgs")]
53#[builder(pattern = "mutable")]
54#[builder(setter(into, strip_option), default)]
55#[builder(derive(Debug))]
56#[builder(build_fn(error = "OpenAIError"))]
57pub struct ListRunsQuery {
58    /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub limit: Option<u32>,
61    /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
62    #[serde(skip_serializing_if = "Option::is_none")]
63    pub order: Option<ListRunsOrder>,
64    /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub after: Option<String>,
67    /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
68    #[serde(skip_serializing_if = "Option::is_none")]
69    pub before: Option<String>,
70}
71
72/// Sort order for listing run steps.
73#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
74#[serde(rename_all = "lowercase")]
75pub enum ListRunStepsOrder {
76    /// Ascending order
77    Asc,
78    /// Descending order
79    Desc,
80}
81
82/// Query parameters for listing run steps.
83#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
84#[builder(name = "ListRunStepsQueryArgs")]
85#[builder(pattern = "mutable")]
86#[builder(setter(into, strip_option), default)]
87#[builder(derive(Debug))]
88#[builder(build_fn(error = "OpenAIError"))]
89pub struct ListRunStepsQuery {
90    /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
91    #[serde(skip_serializing_if = "Option::is_none")]
92    pub limit: Option<u32>,
93    /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
94    #[serde(skip_serializing_if = "Option::is_none")]
95    pub order: Option<ListRunStepsOrder>,
96    /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
97    #[serde(skip_serializing_if = "Option::is_none")]
98    pub after: Option<String>,
99    /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
100    #[serde(skip_serializing_if = "Option::is_none")]
101    pub before: Option<String>,
102    /// A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.
103    #[serde(skip_serializing_if = "Option::is_none")]
104    pub include: Option<Vec<String>>,
105}
106
107/// Query parameters for retrieving a run step.
108#[derive(Debug, Serialize, Default, Clone, Builder, PartialEq)]
109#[builder(name = "GetRunStepQueryArgs")]
110#[builder(pattern = "mutable")]
111#[builder(setter(into, strip_option), default)]
112#[builder(derive(Debug))]
113#[builder(build_fn(error = "OpenAIError"))]
114pub struct GetRunStepQuery {
115    /// A list of additional fields to include in the response. Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content.
116    #[serde(skip_serializing_if = "Option::is_none")]
117    pub include: Option<Vec<String>>,
118}