Class: Legion::Extensions::Agentic::Inference::Debugging::Helpers::CausalTrace
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Inference::Debugging::Helpers::CausalTrace
- Defined in:
- lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#error_id ⇒ Object
readonly
Returns the value of attribute error_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#root_cause ⇒ Object
readonly
Returns the value of attribute root_cause.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
Instance Method Summary collapse
- #add_step!(phase:, description:) ⇒ Object
- #depth ⇒ Object
-
#initialize(error_id:, root_cause:, confidence:) ⇒ CausalTrace
constructor
A new instance of CausalTrace.
- #to_h ⇒ Object
Constructor Details
#initialize(error_id:, root_cause:, confidence:) ⇒ CausalTrace
Returns a new instance of CausalTrace.
14 15 16 17 18 19 20 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 14 def initialize(error_id:, root_cause:, confidence:) @id = SecureRandom.uuid @error_id = error_id @root_cause = root_cause @confidence = confidence.clamp(0.0, 1.0).round(10) @steps = [] end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 12 def confidence @confidence end |
#error_id ⇒ Object (readonly)
Returns the value of attribute error_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.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/causal_trace.rb', line 12 def id @id end |
#root_cause ⇒ Object (readonly)
Returns the value of attribute root_cause.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 12 def root_cause @root_cause end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 12 def steps @steps end |
Instance Method Details
#add_step!(phase:, description:) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 22 def add_step!(phase:, description:) @steps << { phase: phase, description: description, timestamp: Time.now.utc } self end |
#depth ⇒ Object
31 32 33 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 31 def depth @steps.size end |
#to_h ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/legion/extensions/agentic/inference/debugging/helpers/causal_trace.rb', line 35 def to_h { id: @id, error_id: @error_id, steps: @steps.map(&:dup), root_cause: @root_cause, confidence: @confidence, depth: depth } end |