Class: Legion::Extensions::Agentic::Self::SelfTalk::Helpers::DialogueTurn
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Self::SelfTalk::Helpers::DialogueTurn
- Defined in:
- lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb
Constant Summary collapse
- POSITIONS =
%i[support oppose question clarify].freeze
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#dialogue_id ⇒ Object
readonly
Returns the value of attribute dialogue_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#strength ⇒ Object
readonly
Returns the value of attribute strength.
-
#voice_id ⇒ Object
readonly
Returns the value of attribute voice_id.
Instance Method Summary collapse
-
#initialize(dialogue_id:, voice_id:, content:, position: :clarify, strength: 0.5) ⇒ DialogueTurn
constructor
A new instance of DialogueTurn.
- #to_h ⇒ Object
Constructor Details
#initialize(dialogue_id:, voice_id:, content:, position: :clarify, strength: 0.5) ⇒ DialogueTurn
Returns a new instance of DialogueTurn.
16 17 18 19 20 21 22 23 24 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 16 def initialize(dialogue_id:, voice_id:, content:, position: :clarify, strength: 0.5) @id = SecureRandom.uuid @dialogue_id = dialogue_id @voice_id = voice_id @content = content @position = POSITIONS.include?(position) ? position : :clarify @strength = strength.clamp(0.0, 1.0) @created_at = Time.now.utc end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def created_at @created_at end |
#dialogue_id ⇒ Object (readonly)
Returns the value of attribute dialogue_id.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def dialogue_id @dialogue_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def id @id end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def position @position end |
#strength ⇒ Object (readonly)
Returns the value of attribute strength.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def strength @strength end |
#voice_id ⇒ Object (readonly)
Returns the value of attribute voice_id.
14 15 16 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 14 def voice_id @voice_id end |
Instance Method Details
#to_h ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/legion/extensions/agentic/self/self_talk/helpers/dialogue_turn.rb', line 26 def to_h { id: @id, dialogue_id: @dialogue_id, voice_id: @voice_id, content: @content, position: @position, strength: @strength.round(10), created_at: @created_at } end |