Class: Riffer::StreamEvents::Interrupt
- Defined in:
- lib/riffer/stream_events/interrupt.rb
Overview
Represents an interrupt during streaming, fired when a callback throws :riffer_interrupt.
Instance Attribute Summary collapse
-
#healed_tool_call_ids ⇒ Object
readonly
Call ids of tool_use blocks riffer filled with placeholder results when the interrupt fired (only when history healing is on).
-
#reason ⇒ Object
readonly
The reason provided with the interrupt, if any.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(reason: nil, healed_tool_call_ids: []) ⇒ Interrupt
constructor
– : (?reason: (String | Symbol)?, ?healed_tool_call_ids: Array) -> void.
-
#to_h ⇒ Object
Converts the event to a hash.
Constructor Details
#initialize(reason: nil, healed_tool_call_ids: []) ⇒ Interrupt
– : (?reason: (String | Symbol)?, ?healed_tool_call_ids: Array) -> void
16 17 18 19 20 |
# 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 |
Instance Attribute Details
#healed_tool_call_ids ⇒ Object (readonly)
Call ids of tool_use blocks riffer filled with placeholder results when the interrupt fired (only when history healing is on).
12 13 14 |
# File 'lib/riffer/stream_events/interrupt.rb', line 12 def healed_tool_call_ids @healed_tool_call_ids end |
#reason ⇒ Object (readonly)
The reason provided with the interrupt, if any.
8 9 10 |
# File 'lib/riffer/stream_events/interrupt.rb', line 8 def reason @reason end |
Instance Method Details
#to_h ⇒ Object
Converts the event to a hash. – : () -> Hash[Symbol, untyped]
25 26 27 28 29 30 |
# 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 |