Class: Legion::Extensions::Agentic::Inference::Debugging::Helpers::Correction
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Inference::Debugging::Helpers::Correction
- Defined in:
- lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb
Instance Attribute Summary collapse
-
#applied ⇒ Object
readonly
Returns the value of attribute applied.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#effectiveness ⇒ Object
readonly
Returns the value of attribute effectiveness.
-
#error_id ⇒ Object
readonly
Returns the value of attribute error_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
Instance Method Summary collapse
- #apply! ⇒ Object
- #effective? ⇒ Boolean
-
#initialize(error_id:, strategy:, description:) ⇒ Correction
constructor
A new instance of Correction.
- #measure_effectiveness!(score) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(error_id:, strategy:, description:) ⇒ Correction
Returns a new instance of Correction.
14 15 16 17 18 19 20 21 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 14 def initialize(error_id:, strategy:, description:) @id = SecureRandom.uuid @error_id = error_id @strategy = strategy @description = description @applied = false @effectiveness = nil end |
Instance Attribute Details
#applied ⇒ Object (readonly)
Returns the value of attribute applied.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 12 def applied @applied end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 12 def description @description end |
#effectiveness ⇒ Object (readonly)
Returns the value of attribute effectiveness.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 12 def effectiveness @effectiveness end |
#error_id ⇒ Object (readonly)
Returns the value of attribute error_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 12 def error_id @error_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 12 def id @id end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 12 def strategy @strategy end |
Instance Method Details
#apply! ⇒ Object
23 24 25 26 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 23 def apply! @applied = true self end |
#effective? ⇒ Boolean
33 34 35 36 37 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 33 def effective? return false if @effectiveness.nil? @effectiveness >= 0.6 end |
#measure_effectiveness!(score) ⇒ Object
28 29 30 31 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 28 def measure_effectiveness!(score) @effectiveness = score.clamp(0.0, 1.0).round(10) self end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/correction.rb', line 39 def to_h { id: @id, error_id: @error_id, strategy: @strategy, description: @description, applied: @applied, effectiveness: @effectiveness, effective: effective? } end |