Class: Legion::Extensions::Agentic::Learning::Procedural::Helpers::Production
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Learning::Procedural::Helpers::Production
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/learning/procedural/helpers/production.rb
Constant Summary
Constants included from Constants
Constants::AUTOMATION_THRESHOLD, Constants::COMPILATION_THRESHOLD, Constants::DECAY_RATE, Constants::DEFAULT_PROFICIENCY, Constants::MAX_HISTORY, Constants::MAX_PRODUCTIONS, Constants::MAX_SKILLS, Constants::PRACTICE_GAIN, Constants::PROFICIENCY_CEILING, Constants::PROFICIENCY_FLOOR, Constants::PROFICIENCY_LABELS, Constants::SKILL_STAGES, Constants::STAGE_LABELS, Constants::STALE_THRESHOLD
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#execution_count ⇒ Object
readonly
Returns the value of attribute execution_count.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_executed_at ⇒ Object
readonly
Returns the value of attribute last_executed_at.
-
#skill_id ⇒ Object
readonly
Returns the value of attribute skill_id.
-
#success_count ⇒ Object
readonly
Returns the value of attribute success_count.
Instance Method Summary collapse
- #execute!(success:) ⇒ Object
-
#initialize(condition:, action:, domain:, skill_id:) ⇒ Production
constructor
A new instance of Production.
- #reliable? ⇒ Boolean
- #success_rate ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(condition:, action:, domain:, skill_id:) ⇒ Production
Returns a new instance of Production.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 17 def initialize(condition:, action:, domain:, skill_id:) @id = SecureRandom.uuid @condition = condition @action = action @domain = domain @skill_id = skill_id @execution_count = 0 @success_count = 0 @created_at = Time.now.utc @last_executed_at = @created_at end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def action @action end |
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def condition @condition end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def domain @domain end |
#execution_count ⇒ Object (readonly)
Returns the value of attribute execution_count.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def execution_count @execution_count end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def id @id end |
#last_executed_at ⇒ Object (readonly)
Returns the value of attribute last_executed_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def last_executed_at @last_executed_at end |
#skill_id ⇒ Object (readonly)
Returns the value of attribute skill_id.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def skill_id @skill_id end |
#success_count ⇒ Object (readonly)
Returns the value of attribute success_count.
14 15 16 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 14 def success_count @success_count end |
Instance Method Details
#execute!(success:) ⇒ Object
29 30 31 32 33 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 29 def execute!(success:) @execution_count += 1 @success_count += 1 if success @last_executed_at = Time.now.utc end |
#reliable? ⇒ Boolean
41 42 43 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 41 def reliable? success_rate >= 0.7 && @execution_count >= 3 end |
#success_rate ⇒ Object
35 36 37 38 39 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 35 def success_rate return 0.0 if @execution_count.zero? @success_count.to_f / @execution_count end |
#to_h ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/legion/extensions/agentic/learning/procedural/helpers/production.rb', line 45 def to_h { id: @id, condition: @condition, action: @action, domain: @domain, skill_id: @skill_id, execution_count: @execution_count, success_count: @success_count, success_rate: success_rate, reliable: reliable?, created_at: @created_at, last_executed_at: @last_executed_at } end |