Module: Legion::Extensions::Agentic::Attention::Arousal::Runners::Arousal
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb
Instance Method Summary collapse
- #arousal_guidance(task_complexity: :moderate) ⇒ Object
- #arousal_status ⇒ Object
- #calm(amount: nil) ⇒ Object
- #check_performance(task_complexity: :moderate) ⇒ Object
- #stimulate(amount: nil, source: :unknown) ⇒ Object
- #update_arousal ⇒ Object
Instance Method Details
#arousal_guidance(task_complexity: :moderate) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb', line 80 def arousal_guidance(task_complexity: :moderate, **) model = arousal_model current = model.arousal optimal = model.optimal_for(task_complexity) perf = model.performance(task_complexity: task_complexity) guidance = compute_guidance(current, optimal) log.debug("[arousal] guidance: complexity=#{task_complexity} current=#{current.round(3)} optimal=#{optimal} guidance=#{guidance}") { success: true, guidance: guidance, arousal: current, optimal_arousal: optimal, performance: perf, task_complexity: task_complexity } end |
#arousal_status ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb', line 67 def arousal_status(**) model = arousal_model perf = model.performance log.debug("[arousal] status: level=#{model.arousal.round(3)} label=#{model.arousal_label}") { success: true, arousal: model.arousal, label: model.arousal_label, performance: perf, history_size: model.arousal_history.size } end |
#calm(amount: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb', line 26 def calm(amount: nil, **) model = arousal_model amount ||= Helpers::Constants::CALM_FACTOR new_level = model.calm(amount: amount) log.debug("[arousal] calm: amount=#{amount.round(2)} level=#{new_level.round(3)}") { success: true, arousal: new_level, label: model.arousal_label } end |
#check_performance(task_complexity: :moderate) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb', line 51 def check_performance(task_complexity: :moderate, **) model = arousal_model perf = model.performance(task_complexity: task_complexity) optimal = model.optimal_for(task_complexity) msg = "[arousal] performance: complexity=#{task_complexity} " \ "arousal=#{model.arousal.round(3)} optimal=#{optimal} perf=#{perf.round(3)}" log.debug(msg) { success: true, performance: perf, arousal: model.arousal, optimal_arousal: optimal, task_complexity: task_complexity } end |
#stimulate(amount: nil, source: :unknown) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb', line 13 def stimulate(amount: nil, source: :unknown, **) model = arousal_model amount ||= Helpers::Constants::BOOST_FACTOR new_level = model.stimulate(amount: amount, source: source) log.debug("[arousal] stimulate: source=#{source} amount=#{amount.round(2)} level=#{new_level.round(3)}") { success: true, arousal: new_level, label: model.arousal_label, source: source } end |
#update_arousal ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/legion/extensions/agentic/attention/arousal/runners/arousal.rb', line 38 def update_arousal(**) model = arousal_model model.decay perf = model.performance log.debug("[arousal] update: level=#{model.arousal.round(3)} label=#{model.arousal_label} perf=#{perf.round(3)}") { success: true, arousal: model.arousal, label: model.arousal_label, performance: perf } end |