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 17 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).
: (Riffer::Guardrails::Tripwire, ?role: Symbol) -> void
Calls superclass method
Riffer::StreamEvents::Base::new
Public Instance Methods
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 39 def guardrail tripwire.guardrail end
The guardrail class that triggered the block.
: () -> singleton(Riffer::Guardrail)
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 32 def phase tripwire.phase end
The phase when blocking occurred (:before or :after).
: () -> Symbol
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 25 def reason tripwire.reason end
The reason for blocking.
: () -> String
Source
# File lib/riffer/stream_events/guardrail_tripwire.rb, line 46 def to_h { role: @role, tripwire: tripwire.to_h } end
Converts the event to a hash.
: () -> Hash[Symbol, untyped]