Class: Miniswen::Agent::Result
- Inherits:
-
Data
- Object
- Data
- Miniswen::Agent::Result
- Defined in:
- lib/miniswen/agent.rb
Instance Attribute Summary collapse
-
#cached_tokens ⇒ Object
readonly
Returns the value of attribute cached_tokens.
-
#cost_source ⇒ Object
readonly
Returns the value of attribute cost_source.
-
#cost_usd ⇒ Object
readonly
Returns the value of attribute cost_usd.
-
#input_tokens ⇒ Object
readonly
Returns the value of attribute input_tokens.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#output_tokens ⇒ Object
readonly
Returns the value of attribute output_tokens.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#submission ⇒ Object
readonly
Returns the value of attribute submission.
-
#thinking_tokens ⇒ Object
readonly
Returns the value of attribute thinking_tokens.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cached_tokens ⇒ Object (readonly)
Returns the value of attribute cached_tokens
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def cached_tokens @cached_tokens end |
#cost_source ⇒ Object (readonly)
Returns the value of attribute cost_source
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def cost_source @cost_source end |
#cost_usd ⇒ Object (readonly)
Returns the value of attribute cost_usd
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def cost_usd @cost_usd end |
#input_tokens ⇒ Object (readonly)
Returns the value of attribute input_tokens
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def input_tokens @input_tokens end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def @messages end |
#output_tokens ⇒ Object (readonly)
Returns the value of attribute output_tokens
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def output_tokens @output_tokens end |
#status ⇒ Object (readonly)
Returns the value of attribute status
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def status @status end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def steps @steps end |
#submission ⇒ Object (readonly)
Returns the value of attribute submission
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def submission @submission end |
#thinking_tokens ⇒ Object (readonly)
Returns the value of attribute thinking_tokens
168 169 170 |
# File 'lib/miniswen/agent.rb', line 168 def thinking_tokens @thinking_tokens end |
Class Method Details
.deep_symbolize(value) ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/miniswen/agent.rb', line 190 def self.deep_symbolize(value) case value when Hash value.to_h do |key, item| key = key.to_sym # Tool-call arguments keep their provider-style string keys ("command"). [key, key == :arguments ? item : deep_symbolize(item)] end when Array then value.map { deep_symbolize(_1) } else value end end |
.from_h(payload) ⇒ Object
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/miniswen/agent.rb', line 174 def self.from_h(payload) data = deep_symbolize(payload) source = data[:cost_source] new( status: data[:status]&.to_sym, submission: data[:submission], messages: data[:messages] || [], steps: data[:steps], cost_source: source && CostSource.new(name: source[:name]&.to_sym, model: source[:model], priced_as: source[:priced_as], registry: source[:registry]), input_tokens: data[:input_tokens], output_tokens: data[:output_tokens], cached_tokens: data[:cached_tokens], thinking_tokens: data[:thinking_tokens], cost_usd: data[:cost_usd] ) end |