Class: Legion::Extensions::Agentic::Inference::Debugging::Helpers::ReasoningError
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Inference::Debugging::Helpers::ReasoningError
- Defined in:
- lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb
Instance Attribute Summary collapse
-
#confidence_at_detection ⇒ Object
readonly
Returns the value of attribute confidence_at_detection.
-
#correction_ids ⇒ Object
readonly
Returns the value of attribute correction_ids.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#error_type ⇒ Object
readonly
Returns the value of attribute error_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#resolved_at ⇒ Object
readonly
Returns the value of attribute resolved_at.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#source_phase ⇒ Object
readonly
Returns the value of attribute source_phase.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#trace_ids ⇒ Object
readonly
Returns the value of attribute trace_ids.
Instance Method Summary collapse
- #active? ⇒ Boolean
- #correct!(correction_id) ⇒ Object
- #detect! ⇒ Object
-
#initialize(error_type:, description:, severity:, source_phase:, confidence_at_detection:) ⇒ ReasoningError
constructor
A new instance of ReasoningError.
- #mark_unresolvable! ⇒ Object
- #resolve! ⇒ Object
- #resolved? ⇒ Boolean
- #severe? ⇒ Boolean
- #severity_label ⇒ Object
- #to_h ⇒ Object
- #trace!(trace_id) ⇒ Object
Constructor Details
#initialize(error_type:, description:, severity:, source_phase:, confidence_at_detection:) ⇒ ReasoningError
Returns a new instance of ReasoningError.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 16 def initialize(error_type:, description:, severity:, source_phase:, confidence_at_detection:) @id = SecureRandom.uuid @error_type = error_type @description = description @severity = severity.clamp(0.0, 1.0).round(10) @source_phase = source_phase @confidence_at_detection = confidence_at_detection.clamp(0.0, 1.0).round(10) @status = :detected @trace_ids = [] @correction_ids = [] @created_at = Time.now.utc @resolved_at = nil end |
Instance Attribute Details
#confidence_at_detection ⇒ Object (readonly)
Returns the value of attribute confidence_at_detection.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def confidence_at_detection @confidence_at_detection end |
#correction_ids ⇒ Object (readonly)
Returns the value of attribute correction_ids.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def correction_ids @correction_ids end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def description @description end |
#error_type ⇒ Object (readonly)
Returns the value of attribute error_type.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def error_type @error_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def id @id end |
#resolved_at ⇒ Object (readonly)
Returns the value of attribute resolved_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def resolved_at @resolved_at end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def severity @severity end |
#source_phase ⇒ Object (readonly)
Returns the value of attribute source_phase.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def source_phase @source_phase end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def status @status end |
#trace_ids ⇒ Object (readonly)
Returns the value of attribute trace_ids.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 12 def trace_ids @trace_ids end |
Instance Method Details
#active? ⇒ Boolean
67 68 69 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 67 def active? !%i[resolved unresolvable].include?(@status) end |
#correct!(correction_id) ⇒ Object
41 42 43 44 45 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 41 def correct!(correction_id) @correction_ids << correction_id @status = :correcting self end |
#detect! ⇒ Object
30 31 32 33 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 30 def detect! @status = :detected self end |
#mark_unresolvable! ⇒ Object
53 54 55 56 57 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 53 def mark_unresolvable! @status = :unresolvable @resolved_at = Time.now.utc self end |
#resolve! ⇒ Object
47 48 49 50 51 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 47 def resolve! @status = :resolved @resolved_at = Time.now.utc self end |
#resolved? ⇒ Boolean
63 64 65 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 63 def resolved? @status == :resolved end |
#severe? ⇒ Boolean
59 60 61 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 59 def severe? @severity >= 0.7 end |
#severity_label ⇒ Object
71 72 73 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 71 def severity_label Constants.severity_label(@severity) end |
#to_h ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 75 def to_h { id: @id, error_type: @error_type, description: @description, severity: @severity, severity_label: severity_label, source_phase: @source_phase, confidence_at_detection: @confidence_at_detection, status: @status, trace_ids: @trace_ids.dup, correction_ids: @correction_ids.dup, created_at: @created_at, resolved_at: @resolved_at } end |
#trace!(trace_id) ⇒ Object
35 36 37 38 39 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/reasoning_error.rb', line 35 def trace!(trace_id) @trace_ids << trace_id @status = :traced self end |