api_openai/components/
responses.rs

1// src/components/responses.rs
2//! This module defines the data structures for requests and responses related to the `OpenAI` Responses API.
3//! It includes the main `CreateResponseRequest` for generating model responses,
4//! the `ResponseObject` object representing a generated response, and various
5//! stream event structures for real-time response generation.
6//!
7//! For more details, refer to the [`OpenAI` Responses API documentation](https://platform.openai.com/docs/api-reference/responses).
8
9/// Define a private namespace for all its items.
10mod private
11{
12  // Use crate root for base access
13  use crate::components;
14  // Grouped imports relative to crate root
15  use crate::components::common::{ ResponseError, ResponseUsage, Metadata, Reasoning, TextResponseFormatConfigurationOptions, Includable };
16  use crate::components::input::{ InputItem, ListedInputItem };
17  use crate::components::output::{ OutputItem, OutputContentPart, Annotation };
18  use crate::components::tools::{ Tool, ToolChoice };
19
20  // Serde and Former imports
21  use serde::{ Serialize, Deserialize };
22  use former::Former;
23
24  // --- Request Structs ---
25
26  /// Represents the input for the Create Response request.
27  /// Can be a simple string or a list of input items (messages, etc.).
28  ///
29  /// # Used By
30  /// - `CreateResponseRequest`
31  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize/Deserialize
32  #[ serde( untagged ) ] // Allows serialization as string or array
33  #[ non_exhaustive ]
34  pub enum ResponseInput
35  {
36    /// A list of input items.
37    Items( Vec< InputItem > ),
38    /// A single string input.
39    String( String ),
40  }
41
42  /// Represents the request body for creating a model response.
43  /// Corresponds to the request body of `POST /responses`.
44  ///
45  /// # Used By
46  /// - `api::responses::Responses::create`
47  #[ derive( Debug, Serialize, Clone, PartialEq, Former ) ] // REMOVED Default
48  // Add #[ former( init ) ] if you need a constructor-like builder initialization
49  #[ non_exhaustive ]
50  pub struct CreateResponseRequest
51  {
52    /// Text, image, or file inputs to the model.
53    pub input : ResponseInput,
54    /// Additional output data to include (e.g., "`file_search_call.results`").
55    #[ serde( skip_serializing_if = "Option::is_none" ) ]
56    pub include : Option< Vec< Includable > >,
57    /// System instructions for the model.
58    #[ serde( skip_serializing_if = "Option::is_none" ) ]
59    pub instructions : Option< String >,
60    /// Maximum output tokens allowed.
61    #[ serde( skip_serializing_if = "Option::is_none" ) ]
62    pub max_output_tokens : Option< i32 >,
63    /// Metadata associated with the request.
64    #[ serde( skip_serializing_if = "Option::is_none" ) ]
65    pub metadata : Option< Metadata >,
66    /// Model ID used to generate the response.
67    // Use the wrapper type for requests to allow From< String > via derive
68    pub model : components::common::ModelIdsResponses,
69    /// Whether to allow parallel tool calls. Defaults to true.
70    #[ serde( default = "default_parallel_tool_calls" ) ] // Add default
71    pub parallel_tool_calls : bool,
72    /// ID of the previous response in the conversation.
73    #[ serde( skip_serializing_if = "Option::is_none" ) ]
74    pub previous_response_id : Option< String >,
75    /// Reasoning configuration.
76    #[ serde( skip_serializing_if = "Option::is_none" ) ]
77    pub reasoning : Option< Reasoning >,
78    /// Whether to store the generated response. Defaults to true.
79    #[ serde( skip_serializing_if = "Option::is_none" ) ]
80    pub store : Option< bool >,
81    /// Whether to stream the response. Defaults to false.
82    #[ serde( skip_serializing_if = "Option::is_none" ) ]
83    pub stream : Option< bool >,
84    /// Sampling temperature.
85    #[ serde( skip_serializing_if = "Option::is_none" ) ]
86    pub temperature : Option< f32 >,
87    /// Text response format configuration.
88    #[ serde( skip_serializing_if = "Option::is_none" ) ]
89    pub text : Option< TextResponseFormatConfigurationOptions >,
90    /// Strategy for choosing tools.
91    #[ serde( skip_serializing_if = "Option::is_none" ) ]
92    pub tool_choice : Option< ToolChoice >,
93    /// List of available tools.
94    #[ serde( skip_serializing_if = "Option::is_none" ) ]
95    pub tools : Option< Vec< Tool > >,
96    /// Nucleus sampling probability.
97    #[ serde( skip_serializing_if = "Option::is_none" ) ]
98    pub top_p : Option< f32 >,
99    /// Truncation strategy ("auto" or "disabled").
100    #[ serde( skip_serializing_if = "Option::is_none" ) ]
101    pub truncation : Option< String >,
102    /// End-user identifier.
103    #[ serde( skip_serializing_if = "Option::is_none" ) ]
104    pub user : Option< String >,
105  }
106
107  /// Helper function for default value of `parallel_tool_calls`
108  fn default_parallel_tool_calls() -> bool { true }
109
110  // --- Response Structs ---
111
112  /// Represents an output message from the model within a Response.
113  /// Corresponds to the `OutputMessage` schema in the `OpenAPI` spec.
114  ///
115  /// # Used By
116  /// - `OutputItem::Message` (within `output.rs`)
117  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
118  #[ non_exhaustive ]
119  pub struct OutputMessage
120  {
121    /// The content parts of the message (e.g., text, refusal).
122    pub content : Vec< OutputContentPart >, // Uses OutputContentPart from output.rs
123    /// The unique ID of the output message.
124    pub id : String,
125    /// The role of the output message, always "assistant".
126    pub role : String,
127    /// The status of the message (`in_progress`, `completed`, `incomplete`).
128    pub status : String,
129  }
130
131
132  /// Represents a response generated by the model via the Responses API.
133  /// Corresponds to the `Response` schema in the `OpenAPI` spec.
134  ///
135  /// # Used By
136  /// - `/responses` (POST response)
137  /// - `/responses/{response_id}` (GET response)
138  /// - `RealtimeServerEventResponseCreated` (within `realtime_shared.rs`)
139  /// - `RealtimeServerEventResponseDone` (within `realtime_shared.rs`)
140  /// - `RealtimeServerEventResponseFailed` (within `realtime_shared.rs`)
141  /// - `RealtimeServerEventResponseIncomplete` (within `realtime_shared.rs`)
142  /// - `RealtimeServerEventResponseInProgress` (within `realtime_shared.rs`)
143  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, Former ) ] // Added Former
144  #[ non_exhaustive ]
145  pub struct ResponseObject // Renamed from Response
146  {
147    /// Unix timestamp (in seconds) of when this Response was created.
148    pub created_at : i64, // Changed from number to i64 for timestamp
149    /// The error object if the response status is `failed`. Null otherwise.
150    #[ serde( skip_serializing_if = "Option::is_none" ) ]
151    pub error : Option< ResponseError >, // Use relative path common::ResponseError
152    /// Unique identifier for this Response.
153    pub id : String,
154    /// Details about why the response is incomplete, if applicable. Null otherwise.
155    #[ serde( skip_serializing_if = "Option::is_none" ) ]
156    pub incomplete_details : Option< ResponseIncompleteDetails >, // Needs definition
157    /// System instructions provided.
158    #[ serde( skip_serializing_if = "Option::is_none" ) ]
159    pub instructions : Option< String >,
160    /// Maximum output tokens allowed.
161    #[ serde( skip_serializing_if = "Option::is_none" ) ]
162    pub max_output_tokens : Option< i32 >,
163    /// Metadata associated with the response.
164    #[ serde( skip_serializing_if = "Option::is_none" ) ]
165    pub metadata : Option< Metadata >, // Use relative path common::Metadata
166    /// Model ID used for the response. *** CHANGED TO String ***
167    pub model : String,
168    /// The object type, always "response".
169    pub object : String,
170    /// An array of content items generated by the model.
171    pub output : Vec< OutputItem >, // Needs definition
172    /// Whether parallel tool calls were enabled.
173    #[ serde( default = "default_parallel_tool_calls" ) ] // Add default
174    pub parallel_tool_calls : bool,
175    /// ID of the previous response in the conversation.
176    #[ serde( skip_serializing_if = "Option::is_none" ) ]
177    pub previous_response_id : Option< String >,
178    /// Reasoning configuration used.
179    #[ serde( skip_serializing_if = "Option::is_none" ) ]
180    pub reasoning : Option< Reasoning >, // Use relative path common::Reasoning
181    /// The status of the response generation (`completed`, `failed`, `in_progress`, `incomplete`).
182    pub status : String,
183    /// Whether to stream the response. Defaults to false.
184    #[ serde( skip_serializing_if = "Option::is_none" ) ]
185    pub stream : Option< bool >,
186    /// Sampling temperature.
187    #[ serde( skip_serializing_if = "Option::is_none" ) ]
188    pub temperature : Option< f32 >,
189    /// Text response format configuration.
190    #[ serde( skip_serializing_if = "Option::is_none" ) ]
191    pub text : Option< TextResponseFormatConfigurationOptions >, // Use relative path common::TextResponseFormatConfigurationOptions
192    /// Tool choice strategy used.
193    #[ serde( skip_serializing_if = "Option::is_none" ) ]
194    pub tool_choice : Option< ToolChoice >, // Use relative path tools::ToolChoice
195    /// Tools available to the model.
196    #[ serde( skip_serializing_if = "Option::is_none" ) ]
197    pub tools : Option< Vec< Tool > >, // Use relative path tools::Tool
198    /// Nucleus sampling probability.
199    #[ serde( skip_serializing_if = "Option::is_none" ) ]
200    pub top_p : Option< f32 >,
201    /// Truncation strategy ("auto" or "disabled").
202    #[ serde( skip_serializing_if = "Option::is_none" ) ]
203    pub truncation : Option< String >, // Enum : auto, disabled
204    /// Usage statistics for the request. Null if status is not `completed`.
205    #[ serde( skip_serializing_if = "Option::is_none" ) ]
206    pub usage : Option< ResponseUsage >, // Use relative path common::ResponseUsage
207    /// End-user identifier.
208    #[ serde( skip_serializing_if = "Option::is_none" ) ]
209    pub user : Option< String >,
210  }
211
212  /// Details on why a response is incomplete.
213  /// Corresponds to the nested `incomplete_details` schema within `Response`.
214  ///
215  /// # Used By
216  /// - `ResponseObject`
217  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, Former ) ] // Added Serialize, Former
218  #[ non_exhaustive ]
219  pub struct ResponseIncompleteDetails
220  {
221    /// The reason why the response is incomplete (e.g., `max_output_tokens`, `content_filter`).
222    pub reason : String,
223  }
224
225  /// Represents a list of Response items, typically used for input items list.
226  /// Corresponds to the `ResponseItemList` schema in the `OpenAPI` spec.
227  ///
228  /// # Used By
229  /// - `/responses/{response_id}/input_items` (GET)
230  #[ derive( Debug, Deserialize, Clone, PartialEq ) ] // Only Deserialize needed for list response
231  #[ non_exhaustive ]
232  pub struct ResponseItemList
233  {
234    /// A list of input items (messages) associated with the response.
235    pub data : Vec< ListedInputItem >, // Use relative path input::ListedInputItem
236    /// The identifier of the first item in the data array.
237    pub first_id : Option< String >,
238    /// Indicates whether there are more items available.
239    pub has_more : bool,
240    /// The identifier of the last item in the data array.
241    pub last_id : Option< String >,
242    /// The object type, always "list".
243    pub object : String,
244  }
245
246  /// Event data for `response.content_part.added`.
247  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
248  #[ non_exhaustive ]
249  pub struct ResponseContentPartAddedEvent
250  {
251    /// The index of the content part that was added.
252    pub content_index : u32,
253    /// The ID of the output item that the content part was added to.
254    pub item_id : String,
255    /// The index of the output item that the content part was added to.
256    pub output_index : u32,
257    /// The content part that was added.
258    pub part : OutputContentPart,
259  }
260
261  /// Event data for `response.content_part.done`.
262  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
263  #[ non_exhaustive ]
264  pub struct ResponseContentPartDoneEvent
265  {
266    /// The index of the content part that is done.
267    pub content_index : u32,
268    /// The ID of the output item that the content part was added to.
269    pub item_id : String,
270    /// The index of the output item that the content part was added to.
271    pub output_index : u32,
272    /// The content part that is done.
273    pub part : OutputContentPart,
274  }
275
276  /// Event data for `response.created`.
277  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
278  #[ non_exhaustive ]
279  pub struct ResponseCreatedEvent
280  {
281    /// The response that was created.
282    pub response : ResponseObject, // Changed from Response
283  }
284
285  /// Event data for `error`.
286  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
287  #[ non_exhaustive ]
288  pub struct ResponseErrorEvent
289  {
290    /// The error code.
291    #[ serde( skip_serializing_if = "Option::is_none" ) ]
292    pub code : Option< String >,
293    /// The error message.
294    pub message : String,
295    /// The error parameter.
296    #[ serde( skip_serializing_if = "Option::is_none" ) ]
297    pub param : Option< String >,
298  }
299
300  /// Event data for `response.failed`.
301  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
302  #[ non_exhaustive ]
303  pub struct ResponseFailedEvent
304  {
305    /// The response that failed.
306    pub response : ResponseObject, // Changed from Response
307  }
308
309  /// Event data for `response.file_search_call.completed`.
310  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
311  #[ non_exhaustive ]
312  pub struct ResponseFileSearchCallCompletedEvent
313  {
314    /// The ID of the output item that the file search call is initiated.
315    pub item_id : String,
316    /// The index of the output item that the file search call is initiated.
317    pub output_index : u32,
318  }
319
320  /// Event data for `response.file_search_call.in_progress`.
321  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
322  #[ non_exhaustive ]
323  pub struct ResponseFileSearchCallInProgressEvent
324  {
325    /// The ID of the output item that the file search call is initiated.
326    pub item_id : String,
327    /// The index of the output item that the file search call is initiated.
328    pub output_index : u32,
329  }
330
331  /// Event data for `response.file_search_call.searching`.
332  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
333  #[ non_exhaustive ]
334  pub struct ResponseFileSearchCallSearchingEvent
335  {
336    /// The ID of the output item that the file search call is initiated.
337    pub item_id : String,
338    /// The index of the output item that the file search call is searching.
339    pub output_index : u32,
340  }
341
342  /// Event data for `response.function_call_arguments.delta`.
343  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
344  #[ non_exhaustive ]
345  pub struct ResponseFunctionCallArgumentsDeltaEvent
346  {
347    /// The function-call arguments delta that is added.
348    pub delta : String,
349    /// The ID of the output item that the function-call arguments delta is added to.
350    pub item_id : String,
351    /// The index of the output item that the function-call arguments delta is added to.
352    pub output_index : u32,
353    /// The call ID of the function.
354    pub call_id : String,
355  }
356
357  /// Event data for `response.function_call_arguments.done`.
358  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
359  #[ non_exhaustive ]
360  pub struct ResponseFunctionCallArgumentsDoneEvent
361  {
362    /// The function-call arguments that are finalized.
363    pub arguments : String,
364    /// The call ID of the function.
365    pub call_id : String,
366    /// The ID of the output item that the function-call arguments are finalized.
367    pub item_id : String,
368    /// The index of the output item that the function-call arguments are finalized.
369    pub output_index : u32,
370  }
371
372  /// Event data for `response.incomplete`.
373  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
374  #[ non_exhaustive ]
375  pub struct ResponseIncompleteEvent
376  {
377    /// The response that was incomplete.
378    pub response : ResponseObject, // Changed from Response
379  }
380
381  /// Event data for `response.in_progress`.
382  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
383  #[ non_exhaustive ]
384  pub struct ResponseInProgressEvent
385  {
386    /// The response that is in progress.
387    pub response : ResponseObject, // Changed from Response
388  }
389
390  /// Event data for `response.output_item.added`.
391  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
392  #[ non_exhaustive ]
393  pub struct ResponseOutputItemAddedEvent
394  {
395    /// The output item that was added.
396    pub item : OutputItem,
397    /// The index of the output item that was added.
398    pub output_index : u32,
399  }
400
401  /// Event data for `response.output_item.done`.
402  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
403  #[ non_exhaustive ]
404  pub struct ResponseOutputItemDoneEvent
405  {
406    /// The output item that was marked done.
407    pub item : OutputItem,
408    /// The index of the output item that was marked done.
409    pub output_index : u32,
410  }
411
412  /// Event data for `response.refusal.delta`.
413  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
414  #[ non_exhaustive ]
415  pub struct ResponseRefusalDeltaEvent
416  {
417    /// The index of the content part that the refusal text is added to.
418    pub content_index : u32,
419    /// The refusal text that is added.
420    pub delta : String,
421    /// The ID of the output item that the refusal text is added to.
422    pub item_id : String,
423    /// The index of the output item that the refusal text is added to.
424    pub output_index : u32,
425  }
426
427  /// Event data for `response.refusal.done`.
428  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
429  #[ non_exhaustive ]
430  pub struct ResponseRefusalDoneEvent
431  {
432    /// The index of the content part that the refusal text is finalized.
433    pub content_index : u32,
434    /// The ID of the output item that the refusal text is finalized.
435    pub item_id : String,
436    /// The index of the output item that the refusal text is finalized.
437    pub output_index : u32,
438    /// The refusal text that is finalized.
439    pub refusal : String,
440  }
441
442  /// Event data for `response.output_text.annotation.added`.
443  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
444  #[ non_exhaustive ]
445  pub struct ResponseTextAnnotationDeltaEvent
446  {
447    /// The annotation that was added.
448    pub annotation : Annotation,
449    /// The index of the annotation that was added.
450    pub annotation_index : u32,
451    /// The index of the content part that the text annotation was added to.
452    pub content_index : u32,
453    /// The ID of the output item that the text annotation was added to.
454    pub item_id : String,
455    /// The index of the output item that the text annotation was added to.
456    pub output_index : u32,
457  }
458
459  /// Event data for `response.output_text.delta`.
460  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
461  #[ non_exhaustive ]
462  pub struct ResponseTextDeltaEvent
463  {
464    /// The index of the content part that the text delta was added to.
465    pub content_index : u32,
466    /// The text delta that was added.
467    pub delta : String,
468    /// The ID of the output item that the text delta was added to.
469    pub item_id : String,
470    /// The index of the output item that the text delta was added to.
471    pub output_index : u32,
472  }
473
474  /// Event data for `response.output_text.done`.
475  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
476  #[ non_exhaustive ]
477  pub struct ResponseTextDoneEvent
478  {
479    /// The index of the content part that the text content is finalized.
480    pub content_index : u32,
481    /// The ID of the output item that the text content is finalized.
482    pub item_id : String,
483    /// The index of the output item that the text content is finalized.
484    pub output_index : u32,
485    /// The text content that is finalized.
486    pub text : String,
487  }
488
489  /// Event data for `response.web_search_call.completed`.
490  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
491  #[ non_exhaustive ]
492  pub struct ResponseWebSearchCallCompletedEvent
493  {
494    /// Unique ID for the output item associated with the web search call.
495    pub item_id : String,
496    /// The index of the output item that the web search call is associated with.
497    pub output_index : u32,
498  }
499
500  /// Event data for `response.web_search_call.in_progress`.
501  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
502  #[ non_exhaustive ]
503  pub struct ResponseWebSearchCallInProgressEvent
504  {
505    /// Unique ID for the output item associated with the web search call.
506    pub item_id : String,
507    /// The index of the output item that the web search call is associated with.
508    pub output_index : u32,
509  }
510
511  /// Event data for `response.web_search_call.searching`.
512  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
513  #[ non_exhaustive ]
514  pub struct ResponseWebSearchCallSearchingEvent
515  {
516    /// Unique ID for the output item associated with the web search call.
517    pub item_id : String,
518    /// The index of the output item that the web search call is associated with.
519    pub output_index : u32,
520  }
521
522  /// Event data for `response.completed`.
523  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
524  #[ non_exhaustive ]
525  pub struct ResponseCompletedEvent
526  {
527    /// The response that was completed.
528    pub response : ResponseObject,
529    /// The sequence number of this event in the stream.
530    #[ serde( skip_serializing_if = "Option::is_none" ) ]
531    pub sequence_number : Option< u32 >,
532  }
533
534  /// Represents an event emitted when streaming a Response.
535  /// Corresponds to the `ResponseStreamEvent` schema in the `OpenAPI` spec.
536  ///
537  /// # Used By
538  /// - `api::responses::Responses::create_stream`
539  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
540  #[ serde( tag = "type" ) ]
541  #[ non_exhaustive ]
542  pub enum ResponseStreamEvent
543  {
544    /// Emitted when a new content part is added.
545    #[ serde( rename = "response.content_part.added" ) ]
546    ResponseContentPartAdded( ResponseContentPartAddedEvent ),
547    /// Emitted when a content part is done.
548    #[ serde( rename = "response.content_part.done" ) ]
549    ResponseContentPartDone( ResponseContentPartDoneEvent ),
550    /// Emitted when a response is created.
551    #[ serde( rename = "response.created" ) ]
552    ResponseCreated( ResponseCreatedEvent ),
553    /// Emitted when an error occurs.
554    #[ serde( rename = "error" ) ]
555    ResponseErrorEvent( ResponseErrorEvent ),
556    /// Emitted when a response fails.
557    #[ serde( rename = "response.failed" ) ]
558    ResponseFailed( ResponseFailedEvent ),
559    /// Emitted when a file search call is completed (results found).
560    #[ serde( rename = "response.file_search_call.completed" ) ]
561    ResponseFileSearchCallCompleted( ResponseFileSearchCallCompletedEvent ),
562    /// Emitted when a file search call is initiated.
563    #[ serde( rename = "response.file_search_call.in_progress" ) ]
564    ResponseFileSearchCallInProgress( ResponseFileSearchCallInProgressEvent ),
565    /// Emitted when a file search is currently searching.
566    #[ serde( rename = "response.file_search_call.searching" ) ]
567    ResponseFileSearchCallSearching( ResponseFileSearchCallSearchingEvent ),
568    /// Emitted when function-call arguments are finalized.
569    #[ serde( rename = "response.function_call_arguments.done" ) ]
570    ResponseFunctionCallArgumentsDone( ResponseFunctionCallArgumentsDoneEvent ),
571    /// Emitted when there is a partial function-call arguments delta.
572    #[ serde( rename = "response.function_call_arguments.delta" ) ]
573    ResponseFunctionCallArgumentsDelta( ResponseFunctionCallArgumentsDeltaEvent ),
574    /// Emitted when a response finishes as incomplete.
575    #[ serde( rename = "response.incomplete" ) ]
576    ResponseIncomplete( ResponseIncompleteEvent ),
577    /// Emitted when the response is in analysis.
578    #[ serde( rename = "response.in_analysis" ) ]
579    ResponseInAnalysis( ResponseInProgressEvent ),
580    /// Emitted when the response is in progress.
581    #[ serde( rename = "response.in_progress" ) ]
582    ResponseInProgress( ResponseInProgressEvent ),
583    /// Emitted when a new output item is added.
584    #[ serde( rename = "response.output_item.added" ) ]
585    ResponseOutputItemAdded( ResponseOutputItemAddedEvent ),
586    /// Emitted when an output item is marked done.
587    #[ serde( rename = "response.output_item.done" ) ]
588    ResponseOutputItemDone( ResponseOutputItemDoneEvent ),
589    /// Emitted when refusal text is finalized.
590    #[ serde( rename = "response.refusal.done" ) ]
591    ResponseRefusalDone( ResponseRefusalDoneEvent ),
592    /// Emitted when there is a partial refusal text.
593    #[ serde( rename = "response.refusal.delta" ) ]
594    ResponseRefusalDelta( ResponseRefusalDeltaEvent ),
595    /// Emitted when text annotation is added.
596    #[ serde( rename = "response.output_text.annotation.added" ) ]
597    ResponseTextAnnotationDelta( ResponseTextAnnotationDeltaEvent ),
598    /// Emitted when there is an additional text delta.
599    #[ serde( rename = "response.output_text.delta" ) ]
600    ResponseTextDelta( ResponseTextDeltaEvent ),
601    /// Emitted when text content is finalized.
602    #[ serde( rename = "response.output_text.done" ) ]
603    ResponseTextDone( ResponseTextDoneEvent ),
604    /// Emitted when a web search call is completed.
605    #[ serde( rename = "response.web_search_call.completed" ) ]
606    ResponseWebSearchCallCompleted( ResponseWebSearchCallCompletedEvent ),
607    /// Emitted when a web search call is initiated.
608    #[ serde( rename = "response.web_search_call.in_progress" ) ]
609    ResponseWebSearchCallInProgress( ResponseWebSearchCallInProgressEvent ),
610    /// Emitted when a web search call is executing.
611    #[ serde( rename = "response.web_search_call.searching" ) ]
612    ResponseWebSearchCallSearching( ResponseWebSearchCallSearchingEvent ),
613    /// Emitted when the model response is complete.
614    #[ serde( rename = "response.completed" ) ]
615    ResponseCompleted( ResponseCompletedEvent ),
616  }
617} // end mod private
618
619crate ::mod_interface!
620{
621  // Expose all structs defined in this module
622  exposed use
623  {
624    ResponseInput,
625    CreateResponseRequest,
626    ResponseObject,
627    ResponseIncompleteDetails,
628    ResponseItemList,
629    OutputMessage,
630    ResponseStreamEvent,
631    ResponseCreatedEvent,
632    ResponseInProgressEvent,
633    ResponseFailedEvent,
634    ResponseIncompleteEvent,
635    ResponseOutputItemAddedEvent,
636    ResponseOutputItemDoneEvent,
637    ResponseContentPartAddedEvent,
638    ResponseContentPartDoneEvent,
639    ResponseTextDeltaEvent,
640    ResponseTextAnnotationDeltaEvent,
641    ResponseTextDoneEvent,
642    ResponseRefusalDeltaEvent,
643    ResponseRefusalDoneEvent,
644    ResponseFunctionCallArgumentsDeltaEvent,
645    ResponseFunctionCallArgumentsDoneEvent,
646    ResponseFileSearchCallInProgressEvent,
647    ResponseFileSearchCallSearchingEvent,
648    ResponseFileSearchCallCompletedEvent,
649    ResponseWebSearchCallInProgressEvent,
650    ResponseWebSearchCallSearchingEvent,
651    ResponseWebSearchCallCompletedEvent,
652    ResponseCompletedEvent,
653    ResponseErrorEvent,
654  };
655  // Re-export types used by the exposed structs
656  own use crate::components::
657  {
658    common ::
659    {
660      ResponseError,
661      ResponseUsage,
662      Metadata,
663      Reasoning,
664      TextResponseFormatConfigurationOptions,
665      Includable,
666      ListQuery, // Correctly placed ListQuery
667    },
668    input ::{ InputItem, ListedInputItem },
669    output ::{ OutputItem, OutputContentPart, Annotation, FileSearchResultItem, ComputerScreenshotImage },
670    tools ::{ Tool, ToolChoice },
671  };
672}