Class: Legion::LLM::Router::EscalationChain
- Inherits:
-
Object
- Object
- Legion::LLM::Router::EscalationChain
- Includes:
- Enumerable
- Defined in:
- lib/legion/llm/router/escalation_chain.rb
Instance Attribute Summary collapse
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
Instance Method Summary collapse
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(resolutions:, max_attempts: 3) ⇒ EscalationChain
constructor
A new instance of EscalationChain.
- #primary ⇒ Object
- #size ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(resolutions:, max_attempts: 3) ⇒ EscalationChain
Returns a new instance of EscalationChain.
11 12 13 14 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 11 def initialize(resolutions:, max_attempts: 3) @resolutions = resolutions.dup.freeze @max_attempts = max_attempts end |
Instance Attribute Details
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
9 10 11 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 9 def max_attempts @max_attempts end |
Instance Method Details
#each ⇒ Object
20 21 22 23 24 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 20 def each(&) return enum_for(:each) unless block_given? padded_resolutions.each(&) end |
#empty? ⇒ Boolean
30 31 32 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 30 def empty? @resolutions.empty? end |
#primary ⇒ Object
16 17 18 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 16 def primary @resolutions.first end |
#size ⇒ Object
26 27 28 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 26 def size @resolutions.size end |
#to_a ⇒ Object
34 35 36 |
# File 'lib/legion/llm/router/escalation_chain.rb', line 34 def to_a @resolutions.dup end |