Class: RubyLLM::Contract::Eval::RetryOptimizer::Result
- Inherits:
-
Struct
- Object
- Struct
- RubyLLM::Contract::Eval::RetryOptimizer::Result
- Defined in:
- lib/ruby_llm/contract/eval/retry_optimizer.rb
Instance Attribute Summary collapse
-
#candidate_labels ⇒ Object
Returns the value of attribute candidate_labels.
-
#chain ⇒ Object
Returns the value of attribute chain.
-
#chain_details ⇒ Object
Returns the value of attribute chain_details.
-
#constraining_eval ⇒ Object
Returns the value of attribute constraining_eval.
-
#eval_names ⇒ Object
Returns the value of attribute eval_names.
-
#score_matrix ⇒ Object
Returns the value of attribute score_matrix.
-
#step_name ⇒ Object
Returns the value of attribute step_name.
Instance Method Summary collapse
Instance Attribute Details
#candidate_labels ⇒ Object
Returns the value of attribute candidate_labels
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def candidate_labels @candidate_labels end |
#chain ⇒ Object
Returns the value of attribute chain
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def chain @chain end |
#chain_details ⇒ Object
Returns the value of attribute chain_details
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def chain_details @chain_details end |
#constraining_eval ⇒ Object
Returns the value of attribute constraining_eval
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def constraining_eval @constraining_eval end |
#eval_names ⇒ Object
Returns the value of attribute eval_names
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def eval_names @eval_names end |
#score_matrix ⇒ Object
Returns the value of attribute score_matrix
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def score_matrix @score_matrix end |
#step_name ⇒ Object
Returns the value of attribute step_name
16 17 18 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 16 def step_name @step_name end |
Instance Method Details
#print_summary(io = $stdout) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 18 def print_summary(io = $stdout) io.puts "#{step_name} — retry chain optimization" io.puts print_table(io) io.puts print_chain(io) io.puts print_dsl(io) end |
#to_dsl ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ruby_llm/contract/eval/retry_optimizer.rb', line 28 def to_dsl return "# No viable chain — no candidate passes all evals" if chain.empty? if chain.all? { |c| c.keys == [:model] } models_str = chain.map { |c| c[:model] }.join(" ") "retry_policy models: %w[#{models_str}]" else args = chain.map { |c| config_to_ruby(c) }.join(",\n ") "retry_policy do\n escalate(\n #{args}\n )\nend" end end |