class Riffer::StreamEvents::Interrupt
Represents an interrupt during streaming, fired when a callback throws :riffer_interrupt.
Attributes
Call ids of tool_use blocks riffer filled with placeholder results when the interrupt fired (only when history healing is on).
The reason provided with the interrupt, if any.
Public Class Methods
Source
# File lib/riffer/stream_events/interrupt.rb, line 16 def initialize(reason: nil, healed_tool_call_ids: []) super(role: :system) @reason = reason @healed_tool_call_ids = healed_tool_call_ids end
Calls superclass method
Riffer::StreamEvents::Base::new
Public Instance Methods
Source
# File lib/riffer/stream_events/interrupt.rb, line 25 def to_h h = {role: @role, interrupt: true} #: Hash[Symbol, untyped] h[:reason] = @reason if @reason h[:healed_tool_call_ids] = @healed_tool_call_ids unless @healed_tool_call_ids.empty? h end
Converts the event to a hash.