Normandy.Components.StreamEvent
(normandy v0.6.2)
View Source
Represents a Server-Sent Event (SSE) from a streaming LLM response.
Stream events are emitted incrementally as the LLM generates content, allowing for real-time display and processing.
Event Types
:message_start- Stream begins, contains initial metadata:content_block_start- New content block begins (text, tool_use, thinking):content_block_delta- Incremental content update:content_block_stop- Content block complete:message_delta- Message-level update (stop_reason, usage):message_stop- Stream complete:ping- Keep-alive ping:error- Error occurred
Delta Types
text_delta- Incremental text contentinput_json_delta- Incremental tool input JSONthinking_delta- Extended thinking content
Example
# Text delta event
%StreamEvent{
type: :content_block_delta,
index: 0,
delta: %{type: "text_delta", text: "Hello"}
}
# Tool use delta
%StreamEvent{
type: :content_block_delta,
index: 1,
delta: %{type: "input_json_delta", partial_json: "{\"location\":"}
}
Summary
Types
@type delta_type() :: :text_delta | :input_json_delta | :thinking_delta
@type event_type() ::
:message_start
| :content_block_start
| :content_block_delta
| :content_block_stop
| :message_delta
| :message_stop
| :ping
| :error