#[non_exhaustive]pub enum StreamEvent {
ContentDelta(String),
ReasoningDelta(String),
ReasoningDetailsDelta(Vec<ReasoningDetail>),
Done {
tool_calls: Vec<ToolCall>,
finish_reason: Option<FinishReason>,
usage: Option<ResponseUsage>,
id: String,
model: String,
},
Error(OpenRouterError),
}Expand description
Events emitted by ToolAwareStream.
Content and reasoning deltas are yielded immediately as they arrive.
Tool calls are accumulated internally and emitted as complete objects
only once in the final StreamEvent::Done event.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ContentDelta(String)
A fragment of text content from the assistant’s response.
ReasoningDelta(String)
A fragment of reasoning/chain-of-thought content.
ReasoningDetailsDelta(Vec<ReasoningDetail>)
Structured reasoning detail blocks (e.g., encrypted reasoning).
Done
The stream has finished. Contains all accumulated data.
tool_calls will be empty if the model did not invoke any tools.
usage is typically only present in the final SSE chunk.
Fields
§
finish_reason: Option<FinishReason>The reason the model stopped generating.
§
usage: Option<ResponseUsage>Token usage statistics (if provided by the API).
Error(OpenRouterError)
An error occurred while processing the stream.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for StreamEvent
impl !UnwindSafe for StreamEvent
impl Freeze for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more