Class: Riffer::StreamEvents::GuardrailTripwire
- Defined in:
- lib/riffer/stream_events/guardrail_tripwire.rb
Overview
Emitted when a guardrail blocks execution during streaming.
Instance Attribute Summary collapse
-
#tripwire ⇒ Object
readonly
The tripwire containing block details.
Attributes inherited from Base
Instance Method Summary collapse
-
#guardrail ⇒ Object
The guardrail class that triggered the block.
-
#initialize(tripwire, role: :assistant) ⇒ GuardrailTripwire
constructor
– : (Riffer::Guardrails::Tripwire, ?role: Symbol) -> void.
-
#phase ⇒ Object
The phase when blocking occurred (:before or :after).
-
#reason ⇒ Object
The reason for blocking.
-
#to_h ⇒ Object
Converts the event to a hash.
Constructor Details
#initialize(tripwire, role: :assistant) ⇒ GuardrailTripwire
– : (Riffer::Guardrails::Tripwire, ?role: Symbol) -> void
11 12 13 14 |
# File 'lib/riffer/stream_events/guardrail_tripwire.rb', line 11 def initialize(tripwire, role: :assistant) super(role: role) @tripwire = tripwire end |
Instance Attribute Details
#tripwire ⇒ Object (readonly)
The tripwire containing block details.
7 8 9 |
# File 'lib/riffer/stream_events/guardrail_tripwire.rb', line 7 def tripwire @tripwire end |
Instance Method Details
#guardrail ⇒ Object
The guardrail class that triggered the block.
– : () -> singleton(Riffer::Guardrail)
36 37 38 |
# File 'lib/riffer/stream_events/guardrail_tripwire.rb', line 36 def guardrail tripwire.guardrail end |
#phase ⇒ Object
The phase when blocking occurred (:before or :after).
– : () -> Symbol
28 29 30 |
# File 'lib/riffer/stream_events/guardrail_tripwire.rb', line 28 def phase tripwire.phase end |
#reason ⇒ Object
The reason for blocking.
– : () -> String
20 21 22 |
# File 'lib/riffer/stream_events/guardrail_tripwire.rb', line 20 def reason tripwire.reason end |
#to_h ⇒ Object
Converts the event to a hash.
– : () -> Hash[Symbol, untyped]
44 45 46 47 48 49 |
# File 'lib/riffer/stream_events/guardrail_tripwire.rb', line 44 def to_h { role: @role, tripwire: tripwire.to_h } end |