ReqLLM. StreamEvent
(ReqLLM v1.19.0)
View Source
A tagged, provider-neutral projection of one streaming event.
Events are computed from the existing ReqLLM.StreamChunk stream. They do
not replace chunks in ReqLLM 1.x and are not stored on
ReqLLM.StreamResponse.
The event stream begins with :start and ends with exactly one of
:finish, :cancelled, or :error when it is consumed to completion.
Output deltas retain their arrival order. Provider-specific metadata is
exposed through :provider_event and event metadata without treating raw
provider frames as part of the canonical contract.
Event types
:startcarries the resolved provider and model identity.:text_deltaand:reasoning_deltacarry string deltas.:tool_call_startand:tool_call_deltacarry incremental tool input;:tool_callcarries the assembled call before the terminal event.:tool_resultcarries a result already present in provider metadata. It does not execute a tool or continue a model loop.:source,:file, and:output_itemcarryReqLLM.Response.OutputItemprojections.:usagecarries the final usage map and:warningcarries one warning.:finish,:cancelled, and:errorare mutually exclusive terminal events.:provider_eventcarries sanitized extension metadata that has no provider-neutral event type.
Summary
Functions
Builds a canonical stream event.
Returns whether an event carries model output or an output delta.
Returns the Zoi schema for canonical stream events.
Returns whether an event is the terminal event for a consumed stream.
Returns all stable stream event types.
Types
@type event_type() ::
:start
| :text_delta
| :reasoning_delta
| :tool_call_start
| :tool_call_delta
| :tool_call
| :tool_result
| :source
| :file
| :output_item
| :usage
| :warning
| :finish
| :cancelled
| :error
| :provider_event
@type t() :: %ReqLLM.StreamEvent{data: term(), metadata: map(), type: event_type()}
Functions
@spec new(event_type(), term(), map()) :: t()
Builds a canonical stream event.
Returns whether an event carries model output or an output delta.
Returns the Zoi schema for canonical stream events.
Returns whether an event is the terminal event for a consumed stream.
@spec types() :: [event_type()]
Returns all stable stream event types.