Class: RubyLLM::Contract::Pipeline::Result
- Inherits:
-
Object
- Object
- RubyLLM::Contract::Pipeline::Result
- Defined in:
- lib/ruby_llm/contract/pipeline/result.rb
Constant Summary collapse
- COL1 =
Column widths for pretty_print table
14- COL2 =
step name
10- COL3 =
status
50- TOP_BORDER =
output
"+#{"-" * (COL1 + COL2 + COL3 + 8)}+".freeze
- MID_BORDER =
"+-#{"-" * COL1}-+-#{"-" * COL2}-+-#{"-" * COL3}-+".freeze
Instance Attribute Summary collapse
-
#failed_step ⇒ Object
readonly
Returns the value of attribute failed_step.
-
#outputs_by_step ⇒ Object
readonly
Returns the value of attribute outputs_by_step.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#step_results ⇒ Object
readonly
Returns the value of attribute step_results.
-
#trace ⇒ Object
readonly
Returns the value of attribute trace.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(status:, step_results:, outputs_by_step:, failed_step: nil, trace: Trace.new) ⇒ Result
constructor
A new instance of Result.
- #ok? ⇒ Boolean
- #pretty_print(io = $stdout) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(status:, step_results:, outputs_by_step:, failed_step: nil, trace: Trace.new) ⇒ Result
Returns a new instance of Result.
17 18 19 20 21 22 23 24 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 17 def initialize(status:, step_results:, outputs_by_step:, failed_step: nil, trace: Trace.new) @status = status @step_results = step_results.each(&:freeze).freeze @outputs_by_step = outputs_by_step.freeze @failed_step = failed_step @trace = trace freeze end |
Instance Attribute Details
#failed_step ⇒ Object (readonly)
Returns the value of attribute failed_step.
7 8 9 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 7 def failed_step @failed_step end |
#outputs_by_step ⇒ Object (readonly)
Returns the value of attribute outputs_by_step.
7 8 9 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 7 def outputs_by_step @outputs_by_step end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
7 8 9 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 7 def status @status end |
#step_results ⇒ Object (readonly)
Returns the value of attribute step_results.
7 8 9 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 7 def step_results @step_results end |
#trace ⇒ Object (readonly)
Returns the value of attribute trace.
7 8 9 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 7 def trace @trace end |
Instance Method Details
#failed? ⇒ Boolean
30 31 32 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 30 def failed? @status != :ok end |
#ok? ⇒ Boolean
26 27 28 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 26 def ok? @status == :ok end |
#pretty_print(io = $stdout) ⇒ Object
40 41 42 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 40 def pretty_print(io = $stdout) build_table.each { |line| io.puts line } end |
#to_s ⇒ Object
34 35 36 37 38 |
# File 'lib/ruby_llm/contract/pipeline/result.rb', line 34 def to_s lines = [header_line] @step_results.each { |sr| lines << step_line(sr) } lines.join("\n") end |