Class: Legion::Extensions::Agentic::Language::NarrativeReasoning::Helpers::NarrativeEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content:, event_type:, characters: [], causes: [], domain: nil, id: nil, timestamp: nil) ⇒ NarrativeEvent

Returns a new instance of NarrativeEvent.



14
15
16
17
18
19
20
21
22
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 14

def initialize(content:, event_type:, characters: [], causes: [], domain: nil, id: nil, timestamp: nil)
  @id         = id || SecureRandom.uuid
  @content    = content
  @event_type = event_type
  @characters = Array(characters).dup
  @causes     = Array(causes).dup
  @domain     = domain
  @timestamp  = timestamp || Time.now.utc
end

Instance Attribute Details

#causesObject (readonly)

Returns the value of attribute causes.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def causes
  @causes
end

#charactersObject (readonly)

Returns the value of attribute characters.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def characters
  @characters
end

#contentObject (readonly)

Returns the value of attribute content.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def content
  @content
end

#domainObject (readonly)

Returns the value of attribute domain.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def domain
  @domain
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def event_type
  @event_type
end

#idObject (readonly)

Returns the value of attribute id.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def id
  @id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



12
13
14
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 12

def timestamp
  @timestamp
end

Instance Method Details

#to_hObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/legion/extensions/agentic/language/narrative_reasoning/helpers/narrative_event.rb', line 24

def to_h
  {
    id:         @id,
    content:    @content,
    event_type: @event_type,
    characters: @characters,
    causes:     @causes,
    domain:     @domain,
    timestamp:  @timestamp
  }
end