Module: Legion::Extensions::Agentic::Self::SelfModel::Runners::SelfModel
- Includes:
- Helpers::Constants, Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/self/self_model/runners/self_model.rb
Constant Summary
Helpers::Constants::CALIBRATION_ALPHA, Helpers::Constants::CALIBRATION_LABELS, Helpers::Constants::CAPABILITY_STATES, Helpers::Constants::COMPETENCE_CEILING, Helpers::Constants::COMPETENCE_FLOOR, Helpers::Constants::CONFIDENCE_LABELS, Helpers::Constants::DEFAULT_COMPETENCE, Helpers::Constants::KNOWLEDGE_STATES, Helpers::Constants::MAX_CAPABILITIES, Helpers::Constants::MAX_HISTORY, Helpers::Constants::MAX_KNOWLEDGE_DOMAINS, Helpers::Constants::OVERCONFIDENCE_THRESHOLD, Helpers::Constants::UNDERCONFIDENCE_THRESHOLD
Instance Method Summary
collapse
Instance Method Details
#add_self_capability(name:, domain: :general, competence: DEFAULT_COMPETENCE) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 13
def add_self_capability(name:, domain: :general, competence: DEFAULT_COMPETENCE, **)
cap = model.add_capability(name: name, domain: domain, competence: competence)
return { success: false, reason: :limit_reached } unless cap
{ success: true, capability_id: cap.id, competence: cap.competence.round(4), state: cap.state }
end
|
#add_self_knowledge(name:, depth: 0.0, breadth: 0.0) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 20
def add_self_knowledge(name:, depth: 0.0, breadth: 0.0, **)
dom = model.add_knowledge_domain(name: name, depth: depth, breadth: breadth)
return { success: false, reason: :limit_reached } unless dom
{ success: true, domain_id: dom.id, depth: dom.depth.round(4), breadth: dom.breadth.round(4),
state: dom.state }
end
|
#predict_own_success(capability_id:) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 28
def predict_own_success(capability_id:, **)
prediction = model.predict_success(capability_id: capability_id)
return { success: false, reason: :not_found } unless prediction
{ success: true }.merge(prediction)
end
|
#record_self_outcome(capability_id:, predicted:, actual:) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 35
def record_self_outcome(capability_id:, predicted:, actual:, **)
event = model.record_outcome(capability_id: capability_id, predicted: predicted, actual: actual)
return { success: false, reason: :not_found } unless event
cap = model.capabilities[capability_id]
{ success: true, capability_id: capability_id, competence: cap.competence.round(4),
calibration_error: cap.calibration_error.round(4) }
end
|
#self_blind_spots ⇒ Object
58
59
60
61
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 58
def self_blind_spots(**)
blind_spots = model.blind_spots.map(&:to_h)
{ success: true, blind_spots: blind_spots, count: blind_spots.size }
end
|
#self_calibration_report ⇒ Object
63
64
65
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 63
def self_calibration_report(**)
{ success: true }.merge(model.calibration_report)
end
|
#self_introspection ⇒ Object
44
45
46
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 44
def self_introspection(**)
{ success: true }.merge(model.introspect)
end
|
#self_model_stats ⇒ Object
67
68
69
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 67
def self_model_stats(**)
{ success: true }.merge(model.to_h)
end
|
#self_strengths ⇒ Object
48
49
50
51
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 48
def self_strengths(**)
strengths = model.strengths.map(&:to_h)
{ success: true, strengths: strengths, count: strengths.size }
end
|
#self_weaknesses ⇒ Object
53
54
55
56
|
# File 'lib/legion/extensions/agentic/self/self_model/runners/self_model.rb', line 53
def self_weaknesses(**)
weaknesses = model.weaknesses.map(&:to_h)
{ success: true, weaknesses: weaknesses, count: weaknesses.size }
end
|