pub struct ResponsesStreamEvent {
pub kind: String,
pub sequence_number: u64,
pub response: Option<ResponsesResponse>,
pub output_index: Option<u32>,
pub item_id: Option<String>,
pub content_index: Option<u32>,
pub item: Option<ResponseItem>,
pub part: Option<ResponseContentPart>,
pub delta: Option<String>,
pub text: Option<String>,
pub arguments: Option<String>,
pub message: Option<String>,
}Expand description
One streaming SSE event. Unlike chat streaming there is NO data: [DONE] sentinel: the
stream ends after the terminal response.completed / response.incomplete /
response.failed event. This is a flat superset of every event’s fields — kind says
which are meaningful; see the accessor helpers.
Fields§
§kind: StringThe event type, e.g. "response.created", "response.output_text.delta", "error".
sequence_number: u64§response: Option<ResponsesResponse>Present on response.created / response.in_progress / the terminal events.
output_index: Option<u32>§item_id: Option<String>§content_index: Option<u32>§item: Option<ResponseItem>Present on response.output_item.added / .done.
part: Option<ResponseContentPart>Present on response.content_part.added / .done.
delta: Option<String>Present on *.delta events (text / reasoning / arguments).
text: Option<String>Present on response.output_text.done / response.reasoning_text.done.
arguments: Option<String>Present on response.function_call_arguments.done.
message: Option<String>Present on the "error" event.
Implementations§
Source§impl ResponsesStreamEvent
impl ResponsesStreamEvent
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Whether this is a terminal event (response.completed / .incomplete / .failed),
after which the stream ends.
Sourcepub fn output_text_delta(&self) -> Option<&str>
pub fn output_text_delta(&self) -> Option<&str>
The incremental output text of a response.output_text.delta event; None otherwise.
Accumulate these for the assembled text.
Sourcepub fn terminal_response(&self) -> Option<&ResponsesResponse>
pub fn terminal_response(&self) -> Option<&ResponsesResponse>
The terminal response snapshot (with the full output and usage), if this is a
terminal event carrying one.
Trait Implementations§
Source§impl Clone for ResponsesStreamEvent
impl Clone for ResponsesStreamEvent
Source§fn clone(&self) -> ResponsesStreamEvent
fn clone(&self) -> ResponsesStreamEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more