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