Class: Legion::Extensions::Agentic::Executive::DualProcess::Helpers::Decision

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query:, domain:, system_used:, confidence:, complexity:, **opts) ⇒ Decision

Returns a new instance of Decision.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 15

def initialize(query:, domain:, system_used:, confidence:, complexity:, **opts)
  @id                 = SecureRandom.uuid
  @query              = query
  @domain             = domain
  @system_used        = system_used
  @confidence         = confidence.clamp(Constants::CONFIDENCE_FLOOR, Constants::CONFIDENCE_CEILING)
  @complexity         = complexity.clamp(0.0, 1.0)
  @heuristic_id       = opts.fetch(:heuristic_id, nil)
  @outcome            = nil
  @effort_cost        = opts.fetch(:effort_cost, 0.0)
  @processing_time_ms = opts.fetch(:processing_time_ms, 0)
  @created_at         = Time.now.utc
end

Instance Attribute Details

#complexityObject (readonly)

Returns the value of attribute complexity.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def complexity
  @complexity
end

#confidenceObject (readonly)

Returns the value of attribute confidence.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def confidence
  @confidence
end

#created_atObject (readonly)

Returns the value of attribute created_at.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def created_at
  @created_at
end

#domainObject (readonly)

Returns the value of attribute domain.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def domain
  @domain
end

#effort_costObject (readonly)

Returns the value of attribute effort_cost.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def effort_cost
  @effort_cost
end

#heuristic_idObject (readonly)

Returns the value of attribute heuristic_id.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def heuristic_id
  @heuristic_id
end

#idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def id
  @id
end

#outcomeObject

Returns the value of attribute outcome.



12
13
14
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 12

def outcome
  @outcome
end

#processing_time_msObject (readonly)

Returns the value of attribute processing_time_ms.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def processing_time_ms
  @processing_time_ms
end

#queryObject (readonly)

Returns the value of attribute query.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def query
  @query
end

#system_usedObject (readonly)

Returns the value of attribute system_used.



13
14
15
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 13

def system_used
  @system_used
end

Instance Method Details

#to_hObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/legion/extensions/agentic/executive/dual_process/helpers/decision.rb', line 29

def to_h
  {
    id:                 @id,
    query:              @query,
    domain:             @domain,
    system_used:        @system_used,
    confidence:         @confidence,
    complexity:         @complexity,
    heuristic_id:       @heuristic_id,
    outcome:            @outcome,
    effort_cost:        @effort_cost,
    processing_time_ms: @processing_time_ms,
    created_at:         @created_at
  }
end