Class: Legion::Extensions::Agentic::Language::FrameSemantics::Helpers::FrameInstance
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Language::FrameSemantics::Helpers::FrameInstance
- Defined in:
- lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#frame_id ⇒ Object
readonly
Returns the value of attribute frame_id.
-
#frame_name ⇒ Object
readonly
Returns the value of attribute frame_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#slot_fillers ⇒ Object
readonly
Returns the value of attribute slot_fillers.
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #filled_count ⇒ Object
-
#initialize(frame_id:, frame_name:, slot_fillers:, context:, confidence: 0.7) ⇒ FrameInstance
constructor
A new instance of FrameInstance.
- #to_h ⇒ Object
Constructor Details
#initialize(frame_id:, frame_name:, slot_fillers:, context:, confidence: 0.7) ⇒ FrameInstance
Returns a new instance of FrameInstance.
14 15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 14 def initialize(frame_id:, frame_name:, slot_fillers:, context:, confidence: 0.7) @id = SecureRandom.uuid @frame_id = frame_id @frame_name = frame_name @slot_fillers = slot_fillers.dup @context = context @confidence = confidence @created_at = Time.now.utc end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def confidence @confidence end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def context @context end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def created_at @created_at end |
#frame_id ⇒ Object (readonly)
Returns the value of attribute frame_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def frame_id @frame_id end |
#frame_name ⇒ Object (readonly)
Returns the value of attribute frame_name.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def frame_name @frame_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def id @id end |
#slot_fillers ⇒ Object (readonly)
Returns the value of attribute slot_fillers.
12 13 14 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 12 def slot_fillers @slot_fillers end |
Instance Method Details
#complete? ⇒ Boolean
24 25 26 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 24 def complete? filled_count.positive? end |
#filled_count ⇒ Object
28 29 30 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 28 def filled_count @slot_fillers.count { |_k, v| !v.nil? } end |
#to_h ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/legion/extensions/agentic/language/frame_semantics/helpers/frame_instance.rb', line 32 def to_h { id: @id, frame_id: @frame_id, frame_name: @frame_name, slot_fillers: @slot_fillers, context: @context, confidence: @confidence, filled_count: filled_count, complete: complete?, created_at: @created_at } end |