class Riffer::StreamEvents::GuardrailTripwire
Emitted when a guardrail blocks execution during streaming.
Attributes
The tripwire containing block details.
Public Class Methods
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 11 def initialize(tripwire, role: :assistant) super(role: role) @tripwire = tripwire end
Calls superclass method
Riffer::StreamEvents::Base::new
Public Instance Methods
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 36 def guardrail tripwire.guardrail end
The guardrail class that triggered the block.
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 28 def phase tripwire.phase end
The phase when blocking occurred (:before or :after).
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 20 def reason tripwire.reason end
The reason for blocking.
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 44 def to_h { role: @role, tripwire: tripwire.to_h } end
Converts the event to a hash.