Skip to main content

openai_types/conversations/
_gen.rs

1// AUTO-GENERATED by py2rust — do not edit.
2// Re-generate: python3 scripts/py2rust.py sync <python_dir> <rust_dir>
3// Domain: conversations
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
9#[non_exhaustive]
10pub enum ComputerScreenshotContentDetail {
11    #[serde(rename = "low")]
12    Low,
13    #[serde(rename = "high")]
14    High,
15    #[serde(rename = "auto")]
16    Auto,
17    #[serde(rename = "original")]
18    Original,
19}
20
21/// A screenshot of a computer.
22#[derive(Debug, Clone, Serialize, Deserialize)]
23#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
24pub struct ComputerScreenshotContent {
25    /// The detail level of the screenshot image to be sent to the model.
26    pub detail: ComputerScreenshotContentDetail,
27    /// The identifier of an uploaded file that contains the screenshot.
28    #[serde(skip_serializing_if = "Option::is_none", default)]
29    pub file_id: Option<String>,
30    /// The URL of the screenshot image.
31    #[serde(skip_serializing_if = "Option::is_none", default)]
32    pub image_url: Option<String>,
33    /// Specifies the event type.
34    #[serde(rename = "type")]
35    pub type_: String,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
40pub struct Conversation {
41    /// The unique ID of the conversation.
42    pub id: String,
43    /// The time at which the conversation was created, measured in seconds since the
44    pub created_at: i64,
45    /// Set of 16 key-value pairs that can be attached to an object.
46    pub metadata: serde_json::Value,
47    /// The object type, which is always `conversation`.
48    pub object: String,
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
52#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
53pub struct ConversationCreateParams {
54    /// Initial items to include in the conversation context.
55    #[serde(skip_serializing_if = "Option::is_none", default)]
56    pub items: Option<Vec<serde_json::Value>>,
57    /// Set of 16 key-value pairs that can be attached to an object.
58    #[serde(skip_serializing_if = "Option::is_none", default)]
59    pub metadata: Option<serde_json::Value>,
60}
61
62#[derive(Debug, Clone, Serialize, Deserialize)]
63#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
64pub struct ConversationDeletedResource {
65    pub id: String,
66    pub deleted: bool,
67    pub object: String,
68}
69
70#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
71#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
72#[non_exhaustive]
73pub enum ImageGenerationCallStatus {
74    #[serde(rename = "in_progress")]
75    InProgress,
76    #[serde(rename = "completed")]
77    Completed,
78    #[serde(rename = "generating")]
79    Generating,
80    #[serde(rename = "failed")]
81    Failed,
82}
83
84/// An image generation request made by the model.
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
87pub struct ImageGenerationCall {
88    /// The unique ID of the image generation call.
89    pub id: String,
90    /// The generated image encoded in base64.
91    #[serde(skip_serializing_if = "Option::is_none", default)]
92    pub result: Option<String>,
93    /// The status of the image generation call.
94    pub status: ImageGenerationCallStatus,
95    /// The type of the image generation call. Always `image_generation_call`.
96    #[serde(rename = "type")]
97    pub type_: String,
98}
99
100/// Execute a shell command on the server.
101#[derive(Debug, Clone, Serialize, Deserialize)]
102#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
103pub struct LocalShellCallAction {
104    /// The command to run.
105    pub command: Vec<String>,
106    /// Environment variables to set for the command.
107    pub env: std::collections::HashMap<String, String>,
108    /// The type of the local shell action. Always `exec`.
109    #[serde(rename = "type")]
110    pub type_: String,
111    /// Optional timeout in milliseconds for the command.
112    #[serde(skip_serializing_if = "Option::is_none", default)]
113    pub timeout_ms: Option<i64>,
114    /// Optional user to run the command as.
115    #[serde(skip_serializing_if = "Option::is_none", default)]
116    pub user: Option<String>,
117    /// Optional working directory to run the command in.
118    #[serde(skip_serializing_if = "Option::is_none", default)]
119    pub working_directory: Option<String>,
120}
121
122#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
123#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
124#[non_exhaustive]
125pub enum LocalShellCallStatus {
126    #[serde(rename = "in_progress")]
127    InProgress,
128    #[serde(rename = "completed")]
129    Completed,
130    #[serde(rename = "incomplete")]
131    Incomplete,
132}
133
134/// A tool call to run a command on the local shell.
135#[derive(Debug, Clone, Serialize, Deserialize)]
136#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
137pub struct LocalShellCall {
138    /// The unique ID of the local shell call.
139    pub id: String,
140    /// Execute a shell command on the server.
141    pub action: LocalShellCallAction,
142    /// The unique ID of the local shell tool call generated by the model.
143    pub call_id: String,
144    /// The status of the local shell call.
145    pub status: LocalShellCallStatus,
146    /// The type of the local shell call. Always `local_shell_call`.
147    #[serde(rename = "type")]
148    pub type_: String,
149}
150
151#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
152#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
153#[non_exhaustive]
154pub enum LocalShellCallOutputStatus {
155    #[serde(rename = "in_progress")]
156    InProgress,
157    #[serde(rename = "completed")]
158    Completed,
159    #[serde(rename = "incomplete")]
160    Incomplete,
161}
162
163/// The output of a local shell tool call.
164#[derive(Debug, Clone, Serialize, Deserialize)]
165#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
166pub struct LocalShellCallOutput {
167    /// The unique ID of the local shell tool call generated by the model.
168    pub id: String,
169    /// A JSON string of the output of the local shell tool call.
170    pub output: String,
171    /// The type of the local shell tool call output. Always `local_shell_call_output`.
172    #[serde(rename = "type")]
173    pub type_: String,
174    /// The status of the item. One of `in_progress`, `completed`, or `incomplete`.
175    #[serde(skip_serializing_if = "Option::is_none", default)]
176    pub status: Option<LocalShellCallOutputStatus>,
177}
178
179/// A tool available on an MCP server.
180#[derive(Debug, Clone, Serialize, Deserialize)]
181#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
182pub struct McpListToolsTool {
183    /// The JSON schema describing the tool's input.
184    pub input_schema: serde_json::Value,
185    /// The name of the tool.
186    pub name: String,
187    /// Additional annotations about the tool.
188    #[serde(skip_serializing_if = "Option::is_none", default)]
189    pub annotations: Option<serde_json::Value>,
190    /// The description of the tool.
191    #[serde(skip_serializing_if = "Option::is_none", default)]
192    pub description: Option<String>,
193}
194
195/// A list of tools available on an MCP server.
196#[derive(Debug, Clone, Serialize, Deserialize)]
197#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
198pub struct McpListTools {
199    /// The unique ID of the list.
200    pub id: String,
201    /// The label of the MCP server.
202    pub server_label: String,
203    /// The tools available on the server.
204    pub tools: Vec<McpListToolsTool>,
205    /// The type of the item. Always `mcp_list_tools`.
206    #[serde(rename = "type")]
207    pub type_: String,
208    /// Error message if the server could not list tools.
209    #[serde(skip_serializing_if = "Option::is_none", default)]
210    pub error: Option<String>,
211}
212
213/// A request for human approval of a tool invocation.
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
216pub struct McpApprovalRequest {
217    /// The unique ID of the approval request.
218    pub id: String,
219    /// A JSON string of arguments for the tool.
220    pub arguments: String,
221    /// The name of the tool to run.
222    pub name: String,
223    /// The label of the MCP server making the request.
224    pub server_label: String,
225    /// The type of the item. Always `mcp_approval_request`.
226    #[serde(rename = "type")]
227    pub type_: String,
228}
229
230/// A response to an MCP approval request.
231#[derive(Debug, Clone, Serialize, Deserialize)]
232#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
233pub struct McpApprovalResponse {
234    /// The unique ID of the approval response
235    pub id: String,
236    /// The ID of the approval request being answered.
237    pub approval_request_id: String,
238    /// Whether the request was approved.
239    pub approve: bool,
240    /// The type of the item. Always `mcp_approval_response`.
241    #[serde(rename = "type")]
242    pub type_: String,
243    /// Optional reason for the decision.
244    #[serde(skip_serializing_if = "Option::is_none", default)]
245    pub reason: Option<String>,
246}
247
248#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
249#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
250#[non_exhaustive]
251pub enum McpCallStatus {
252    #[serde(rename = "in_progress")]
253    InProgress,
254    #[serde(rename = "completed")]
255    Completed,
256    #[serde(rename = "incomplete")]
257    Incomplete,
258    #[serde(rename = "calling")]
259    Calling,
260    #[serde(rename = "failed")]
261    Failed,
262}
263
264/// An invocation of a tool on an MCP server.
265#[derive(Debug, Clone, Serialize, Deserialize)]
266#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
267pub struct McpCall {
268    /// The unique ID of the tool call.
269    pub id: String,
270    /// A JSON string of the arguments passed to the tool.
271    pub arguments: String,
272    /// The name of the tool that was run.
273    pub name: String,
274    /// The label of the MCP server running the tool.
275    pub server_label: String,
276    /// The type of the item. Always `mcp_call`.
277    #[serde(rename = "type")]
278    pub type_: String,
279    /// Unique identifier for the MCP tool call approval request. Include this value in
280    #[serde(skip_serializing_if = "Option::is_none", default)]
281    pub approval_request_id: Option<String>,
282    /// The error from the tool call, if any.
283    #[serde(skip_serializing_if = "Option::is_none", default)]
284    pub error: Option<String>,
285    /// The output from the tool call.
286    #[serde(skip_serializing_if = "Option::is_none", default)]
287    pub output: Option<String>,
288    /// The status of the tool call.
289    #[serde(skip_serializing_if = "Option::is_none", default)]
290    pub status: Option<McpCallStatus>,
291}
292
293pub type ConversationItem = serde_json::Value;
294
295/// A list of Conversation items.
296#[derive(Debug, Clone, Serialize, Deserialize)]
297#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
298pub struct ConversationItemList {
299    /// A list of conversation items.
300    pub data: Vec<ConversationItem>,
301    /// The ID of the first item in the list.
302    pub first_id: String,
303    /// Whether there are more items available.
304    pub has_more: bool,
305    /// The ID of the last item in the list.
306    pub last_id: String,
307    /// The type of object returned, must be `list`.
308    pub object: String,
309}
310
311#[derive(Debug, Clone, Serialize, Deserialize)]
312#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
313pub struct ConversationUpdateParams {
314    /// Set of 16 key-value pairs that can be attached to an object.
315    pub metadata: Option<serde_json::Value>,
316}
317
318#[derive(Debug, Clone, Serialize, Deserialize)]
319#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
320pub struct ItemCreateParams {
321    /// The items to add to the conversation. You may add up to 20 items at a time.
322    pub items: Vec<serde_json::Value>,
323    /// Additional fields to include in the response.
324    #[serde(skip_serializing_if = "Option::is_none", default)]
325    pub include: Option<Vec<serde_json::Value>>,
326}
327
328#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
329#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
330#[non_exhaustive]
331pub enum ItemListParamsOrder {
332    #[serde(rename = "asc")]
333    Asc,
334    #[serde(rename = "desc")]
335    Desc,
336}
337
338#[derive(Debug, Clone, Serialize, Deserialize)]
339#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
340pub struct ItemListParams {
341    /// An item ID to list items after, used in pagination.
342    #[serde(skip_serializing_if = "Option::is_none", default)]
343    pub after: Option<String>,
344    /// Specify additional output data to include in the model response.
345    #[serde(skip_serializing_if = "Option::is_none", default)]
346    pub include: Option<Vec<serde_json::Value>>,
347    /// A limit on the number of objects to be returned.
348    #[serde(skip_serializing_if = "Option::is_none", default)]
349    pub limit: Option<i64>,
350    /// The order to return the input items in. Default is `desc`.
351    #[serde(skip_serializing_if = "Option::is_none", default)]
352    pub order: Option<ItemListParamsOrder>,
353}
354
355#[derive(Debug, Clone, Serialize, Deserialize)]
356#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
357pub struct ItemRetrieveParams {
358    pub conversation_id: String,
359    /// Additional fields to include in the response.
360    #[serde(skip_serializing_if = "Option::is_none", default)]
361    pub include: Option<Vec<serde_json::Value>>,
362}
363
364/// Reasoning text from the model.
365#[derive(Debug, Clone, Serialize, Deserialize)]
366#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
367pub struct ContentReasoningText {
368    /// The reasoning text from the model.
369    pub text: String,
370    /// The type of the reasoning text. Always `reasoning_text`.
371    #[serde(rename = "type")]
372    pub type_: String,
373}
374
375pub type Content = serde_json::Value;
376
377#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
378#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
379#[non_exhaustive]
380pub enum MessageRole {
381    #[serde(rename = "unknown")]
382    Unknown,
383    #[serde(rename = "user")]
384    User,
385    #[serde(rename = "assistant")]
386    Assistant,
387    #[serde(rename = "system")]
388    System,
389    #[serde(rename = "critic")]
390    Critic,
391    #[serde(rename = "discriminator")]
392    Discriminator,
393    #[serde(rename = "developer")]
394    Developer,
395    #[serde(rename = "tool")]
396    Tool,
397}
398
399#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
400#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
401#[non_exhaustive]
402pub enum MessageStatus {
403    #[serde(rename = "in_progress")]
404    InProgress,
405    #[serde(rename = "completed")]
406    Completed,
407    #[serde(rename = "incomplete")]
408    Incomplete,
409}
410
411/// A message to or from the model.
412#[derive(Debug, Clone, Serialize, Deserialize)]
413#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
414pub struct Message {
415    /// The unique ID of the message.
416    pub id: String,
417    /// The content of the message
418    pub content: Vec<Content>,
419    /// The role of the message.
420    pub role: MessageRole,
421    /// The status of item.
422    pub status: MessageStatus,
423    /// The type of the message. Always set to `message`.
424    #[serde(rename = "type")]
425    pub type_: String,
426}
427
428/// A summary text from the model.
429#[derive(Debug, Clone, Serialize, Deserialize)]
430#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
431pub struct SummaryTextContent {
432    /// A summary of the reasoning output from the model so far.
433    pub text: String,
434    /// The type of the object. Always `summary_text`.
435    #[serde(rename = "type")]
436    pub type_: String,
437}
438
439/// A text content.
440#[derive(Debug, Clone, Serialize, Deserialize)]
441#[cfg_attr(feature = "structured", derive(schemars::JsonSchema))]
442pub struct TextContent {
443    pub text: String,
444    #[serde(rename = "type")]
445    pub type_: String,
446}