Class: Smith::Workflow::RunResult
- Inherits:
-
Struct
- Object
- Struct
- Smith::Workflow::RunResult
- Defined in:
- lib/smith/workflow/run_result.rb
Overview
rubocop:disable Style/RedundantStructKeywordInit
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#outcome ⇒ Object
Returns the value of attribute outcome.
-
#output ⇒ Object
Returns the value of attribute output.
-
#session_messages ⇒ Object
Returns the value of attribute session_messages.
-
#state ⇒ Object
Returns the value of attribute state.
-
#steps ⇒ Object
Returns the value of attribute steps.
-
#tool_results ⇒ Object
Returns the value of attribute tool_results.
-
#total_cost ⇒ Object
Returns the value of attribute total_cost.
-
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
-
#usage_entries ⇒ Object
Returns the value of attribute usage_entries.
Instance Method Summary collapse
- #done? ⇒ Boolean
- #failed? ⇒ Boolean
- #failed_transition ⇒ Object
- #failure_detail ⇒ Object
- #last_error ⇒ Object
- #outcome_kind ⇒ Object
- #outcome_payload ⇒ Object
- #state_named?(name) ⇒ Boolean
- #terminal_output ⇒ Object
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def context @context end |
#outcome ⇒ Object
Returns the value of attribute outcome
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def outcome @outcome end |
#output ⇒ Object
Returns the value of attribute output
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def output @output end |
#session_messages ⇒ Object
Returns the value of attribute session_messages
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def @session_messages end |
#state ⇒ Object
Returns the value of attribute state
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def state @state end |
#steps ⇒ Object
Returns the value of attribute steps
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def steps @steps end |
#tool_results ⇒ Object
Returns the value of attribute tool_results
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def tool_results @tool_results end |
#total_cost ⇒ Object
Returns the value of attribute total_cost
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def total_cost @total_cost end |
#total_tokens ⇒ Object
Returns the value of attribute total_tokens
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def total_tokens @total_tokens end |
#usage_entries ⇒ Object
Returns the value of attribute usage_entries
6 7 8 |
# File 'lib/smith/workflow/run_result.rb', line 6 def usage_entries @usage_entries end |
Instance Method Details
#done? ⇒ Boolean
8 9 10 |
# File 'lib/smith/workflow/run_result.rb', line 8 def done? state_named?(:done) end |
#failed? ⇒ Boolean
12 13 14 |
# File 'lib/smith/workflow/run_result.rb', line 12 def failed? state_named?(:failed) end |
#failed_transition ⇒ Object
36 37 38 |
# File 'lib/smith/workflow/run_result.rb', line 36 def failed_transition failure_detail&.fetch(:transition) end |
#failure_detail ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/smith/workflow/run_result.rb', line 40 def failure_detail failed_step = steps.reverse.find { |step| step[:error] } return nil unless failed_step { transition: failed_step[:transition], from: failed_step[:from], to: failed_step[:to], error: failed_step[:error] } end |
#last_error ⇒ Object
32 33 34 |
# File 'lib/smith/workflow/run_result.rb', line 32 def last_error steps.reverse.map { |step| step[:error] }.compact.first end |
#outcome_kind ⇒ Object
24 25 26 |
# File 'lib/smith/workflow/run_result.rb', line 24 def outcome_kind outcome&.dig(:kind) end |
#outcome_payload ⇒ Object
28 29 30 |
# File 'lib/smith/workflow/run_result.rb', line 28 def outcome_payload outcome&.dig(:payload) end |
#state_named?(name) ⇒ Boolean
16 17 18 |
# File 'lib/smith/workflow/run_result.rb', line 16 def state_named?(name) state == name || state.to_s == name.to_s end |
#terminal_output ⇒ Object
20 21 22 |
# File 'lib/smith/workflow/run_result.rb', line 20 def terminal_output output end |