Class: Riffer::StreamEvents::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/riffer/stream_events/base.rb

Overview

Base class for all streaming events. Subclasses must implement to_h.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role: :assistant) ⇒ Base

– : (?role: Symbol) -> void



11
12
13
# File 'lib/riffer/stream_events/base.rb', line 11

def initialize(role: :assistant)
  @role = role
end

Instance Attribute Details

#roleObject (readonly)

The message role (typically :assistant).



7
8
9
# File 'lib/riffer/stream_events/base.rb', line 7

def role
  @role
end

Instance Method Details

#to_hObject

Converts the event to a hash. – : () -> Hash[Symbol, untyped]

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/riffer/stream_events/base.rb', line 18

def to_h
  raise NotImplementedError, "Subclasses must implement #to_h"
end