Class: Rubyagents::RunResult
- Inherits:
-
Data
- Object
- Data
- Rubyagents::RunResult
- Defined in:
- lib/rubyagents/model.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#timing ⇒ Object
readonly
Returns the value of attribute timing.
-
#token_usage ⇒ Object
readonly
Returns the value of attribute token_usage.
Instance Method Summary collapse
-
#initialize(output:, state:, steps: [], token_usage: nil, timing: nil) ⇒ RunResult
constructor
A new instance of RunResult.
- #success? ⇒ Boolean
- #to_h ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(output:, state:, steps: [], token_usage: nil, timing: nil) ⇒ RunResult
Returns a new instance of RunResult.
42 43 44 |
# File 'lib/rubyagents/model.rb', line 42 def initialize(output:, state:, steps: [], token_usage: nil, timing: nil) super end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output
41 42 43 |
# File 'lib/rubyagents/model.rb', line 41 def output @output end |
#state ⇒ Object (readonly)
Returns the value of attribute state
41 42 43 |
# File 'lib/rubyagents/model.rb', line 41 def state @state end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps
41 42 43 |
# File 'lib/rubyagents/model.rb', line 41 def steps @steps end |
#timing ⇒ Object (readonly)
Returns the value of attribute timing
41 42 43 |
# File 'lib/rubyagents/model.rb', line 41 def timing @timing end |
#token_usage ⇒ Object (readonly)
Returns the value of attribute token_usage
41 42 43 |
# File 'lib/rubyagents/model.rb', line 41 def token_usage @token_usage end |
Instance Method Details
#success? ⇒ Boolean
46 |
# File 'lib/rubyagents/model.rb', line 46 def success? = state == "success" |
#to_h ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/rubyagents/model.rb', line 48 def to_h { output: output, state: state, steps: steps.map(&:to_h), token_usage: token_usage&.to_h, timing: timing } end |
#to_json(*args) ⇒ Object
58 59 60 61 |
# File 'lib/rubyagents/model.rb', line 58 def to_json(*args) require "json" to_h.to_json(*args) end |