Class: DSPy::Events::Event

Inherits:
T::Struct
  • Object
show all
Defined in:
lib/dspy/events/types.rb

Overview

Base event structure using Sorbet T::Struct

Instance Method Summary collapse

Constructor Details

#initialize(name:, timestamp: Time.now, attributes: {}) ⇒ Event

Returns a new instance of Event.



13
14
15
# File 'lib/dspy/events/types.rb', line 13

def initialize(name:, timestamp: Time.now, attributes: {})
  super(name: name, timestamp: timestamp, attributes: attributes)
end

Instance Method Details

#to_attributesObject



17
18
19
20
21
# File 'lib/dspy/events/types.rb', line 17

def to_attributes
  result = attributes.dup
  result[:timestamp] = timestamp
  result
end