class Riffer::StreamEvents::GuardrailModification
Emitted when a guardrail transforms data during streaming.
Attributes
The modification record.
Public Class Methods
Source
# File lib/riffer/stream_events/guardrail_modification.rb, line 11 def initialize(modification, role: :assistant) super(role: role) @modification = modification end
Calls superclass method
Riffer::StreamEvents::Base::new
Public Instance Methods
Source
# File lib/riffer/stream_events/guardrail_modification.rb, line 20 def guardrail = modification.guardrail # The phase when the transformation occurred. # #-- #: () -> Symbol def phase = modification.phase # The indices of messages that were changed. # #-- #: () -> Array[Integer] def message_indices = modification.message_indices # Converts the event to a hash. # #-- #: () -> Hash[Symbol, untyped] def to_h {role: @role, modification: modification.to_h}
The guardrail class that made the transformation.
Source
# File lib/riffer/stream_events/guardrail_modification.rb, line 32 def message_indices = modification.message_indices # Converts the event to a hash. # #-- #: () -> Hash[Symbol, untyped] def to_h {role: @role, modification: modification.to_h} end end
The indices of messages that were changed.
Source
# File lib/riffer/stream_events/guardrail_modification.rb, line 26 def phase = modification.phase # The indices of messages that were changed. # #-- #: () -> Array[Integer] def message_indices = modification.message_indices # Converts the event to a hash. # #-- #: () -> Hash[Symbol, untyped] def to_h {role: @role, modification: modification.to_h} end
The phase when the transformation occurred.
Source
# File lib/riffer/stream_events/guardrail_modification.rb, line 38 def to_h {role: @role, modification: modification.to_h} end
Converts the event to a hash.