pub enum ResponseStreamEvent {
Show 22 variants
ResponseCreated {
sequence_number: Option<u64>,
response: Response,
},
ResponseInProgress {
sequence_number: Option<u64>,
response: Response,
},
ResponseCompleted {
sequence_number: Option<u64>,
response: Response,
},
ResponseIncomplete {
sequence_number: Option<u64>,
response: Response,
},
ResponseFailed {
sequence_number: Option<u64>,
response: Response,
},
Error {
sequence_number: Option<u64>,
message: Option<String>,
code: Option<String>,
param: Option<String>,
},
OutputItemAdded {
sequence_number: Option<u64>,
output_index: Option<u32>,
item: ResponseOutputItem,
},
OutputItemDone {
sequence_number: Option<u64>,
output_index: Option<u32>,
item: ResponseOutputItem,
},
ContentPartAdded {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
content_index: Option<u32>,
part: EventContentPart,
},
ContentPartDone {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
content_index: Option<u32>,
part: EventContentPart,
},
OutputTextDelta {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
content_index: Option<u32>,
delta: String,
},
OutputTextDone {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
content_index: Option<u32>,
text: String,
},
ReasoningTextDelta {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
content_index: Option<u32>,
delta: String,
},
ReasoningTextDone {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
content_index: Option<u32>,
text: String,
},
FunctionCallArgumentsDelta {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
delta: String,
},
FunctionCallArgumentsDone {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
arguments: String,
},
CustomToolCallInputDelta {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
delta: String,
},
CustomToolCallInputDone {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
input: String,
},
WebSearchCallInProgress {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
},
WebSearchCallSearching {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
},
WebSearchCallCompleted {
sequence_number: Option<u64>,
item_id: Option<String>,
output_index: Option<u32>,
},
Other,
}Expand description
One event of a streamed Responses API call.
Use Self::final_response to extract the finished Response from
the terminal response.completed / response.incomplete /
response.failed events.
Variants§
ResponseCreated
First event: the response was created, status in_progress.
ResponseInProgress
The response is being generated.
ResponseCompleted
The response completed normally; final event with the full
response object including usage.
ResponseIncomplete
The response was truncated (e.g. max_output_tokens reached);
final event with the full response object.
ResponseFailed
The response failed; final event with the full response object
including the error details.
Error
An error event emitted mid-stream.
Fields
OutputItemAdded
An output item (reasoning, message, tool call, …) started.
Fields
item: ResponseOutputItemThe item that was added.
OutputItemDone
An output item completed.
Fields
item: ResponseOutputItemThe completed item.
ContentPartAdded
A content part started within an output item.
Fields
part: EventContentPartThe content part that was added.
ContentPartDone
A content part completed.
Fields
part: EventContentPartThe completed content part.
OutputTextDelta
An incremental text delta of an output message.
Fields
OutputTextDone
The full output text of a message content part.
Fields
ReasoningTextDelta
An incremental reasoning (chain-of-thought) text delta.
Fields
ReasoningTextDone
The full reasoning (chain-of-thought) text of a reasoning item.
Fields
FunctionCallArgumentsDelta
An incremental delta of function call arguments.
Fields
FunctionCallArgumentsDone
The full arguments of a function call.
Fields
CustomToolCallInputDelta
An incremental delta of custom tool call input (e.g. the
apply_patch tool).
Fields
CustomToolCallInputDone
The full input of a custom tool call.
Fields
WebSearchCallInProgress
A server-side web search started.
WebSearchCallSearching
A server-side web search is searching.
WebSearchCallCompleted
A server-side web search completed.
Other
Any event type not covered by the variants above.
Implementations§
Source§impl ResponseStreamEvent
impl ResponseStreamEvent
Sourcepub fn final_response(&self) -> Option<&Response>
pub fn final_response(&self) -> Option<&Response>
Returns the final response object if this is one of the terminal
events (response.completed, response.incomplete,
response.failed).
Trait Implementations§
Source§impl Clone for ResponseStreamEvent
impl Clone for ResponseStreamEvent
Source§fn clone(&self) -> ResponseStreamEvent
fn clone(&self) -> ResponseStreamEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more