Class: RubyLLM::Contract::Pipeline::Runner::ExecutionState
- Inherits:
-
Object
- Object
- RubyLLM::Contract::Pipeline::Runner::ExecutionState
- Defined in:
- lib/ruby_llm/contract/pipeline/runner.rb
Overview
Encapsulates mutable state during pipeline execution
Instance Attribute Summary collapse
-
#current_input ⇒ Object
readonly
Returns the value of attribute current_input.
-
#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.
-
#step_traces ⇒ Object
readonly
Returns the value of attribute step_traces.
-
#trace_id ⇒ Object
readonly
Returns the value of attribute trace_id.
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize(input) ⇒ ExecutionState
constructor
A new instance of ExecutionState.
- #mark_limit_failure(status, failed_alias) ⇒ Object
- #record_step(step_alias, result) ⇒ Object
Constructor Details
#initialize(input) ⇒ ExecutionState
Returns a new instance of ExecutionState.
103 104 105 106 107 108 109 110 111 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 103 def initialize(input) @trace_id = SecureRandom.uuid @step_results = [] @step_traces = [] @outputs_by_step = {} @current_input = input @status = :ok @failed_step = nil end |
Instance Attribute Details
#current_input ⇒ Object (readonly)
Returns the value of attribute current_input.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def current_input @current_input end |
#failed_step ⇒ Object (readonly)
Returns the value of attribute failed_step.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def failed_step @failed_step end |
#outputs_by_step ⇒ Object (readonly)
Returns the value of attribute outputs_by_step.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def outputs_by_step @outputs_by_step end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def status @status end |
#step_results ⇒ Object (readonly)
Returns the value of attribute step_results.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def step_results @step_results end |
#step_traces ⇒ Object (readonly)
Returns the value of attribute step_traces.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def step_traces @step_traces end |
#trace_id ⇒ Object (readonly)
Returns the value of attribute trace_id.
100 101 102 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 100 def trace_id @trace_id end |
Instance Method Details
#failed? ⇒ Boolean
132 133 134 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 132 def failed? @status != :ok end |
#mark_limit_failure(status, failed_alias) ⇒ Object
127 128 129 130 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 127 def mark_limit_failure(status, failed_alias) @status = status @failed_step = failed_alias end |
#record_step(step_alias, result) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/ruby_llm/contract/pipeline/runner.rb', line 113 def record_step(step_alias, result) @step_results << { alias: step_alias, result: result } @step_traces << result.trace if result.ok? output = result.parsed_output @outputs_by_step[step_alias] = output @current_input = output else @status = result.status @failed_step = step_alias end end |