Class: Riffer::StreamEvents::Base
- Inherits:
-
Object
- Object
- Riffer::StreamEvents::Base
- Defined in:
- lib/riffer/stream_events/base.rb
Overview
Base class for all streaming events in the Riffer framework.
Subclasses must implement the to_h method.
Direct Known Subclasses
GuardrailModification, GuardrailTripwire, Interrupt, ReasoningDelta, ReasoningDone, SkillActivation, TextDelta, TextDone, TokenUsageDone, ToolCallDelta, ToolCallDone, WebSearchDone, WebSearchStatus
Instance Attribute Summary collapse
-
#role ⇒ Object
readonly
The message role (typically :assistant).
Instance Method Summary collapse
-
#initialize(role: :assistant) ⇒ Base
constructor
– : (?role: Symbol) -> void.
-
#to_h ⇒ Object
Converts the event to a hash.
Constructor Details
#initialize(role: :assistant) ⇒ Base
– : (?role: Symbol) -> void
13 14 15 |
# File 'lib/riffer/stream_events/base.rb', line 13 def initialize(role: :assistant) @role = role end |
Instance Attribute Details
#role ⇒ Object (readonly)
The message role (typically :assistant).
9 10 11 |
# File 'lib/riffer/stream_events/base.rb', line 9 def role @role end |
Instance Method Details
#to_h ⇒ Object
Converts the event to a hash.
Raises NotImplementedError if not implemented by subclass.
– : () -> Hash[Symbol, untyped]
23 24 25 |
# File 'lib/riffer/stream_events/base.rb', line 23 def to_h raise NotImplementedError, "Subclasses must implement #to_h" end |