Class: Smith::Workflow::AgentResult
- Inherits:
-
Struct
- Object
- Struct
- Smith::Workflow::AgentResult
- Defined in:
- lib/smith/workflow/agent_result.rb
Overview
rubocop:disable Style/RedundantStructKeywordInit
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#input_tokens ⇒ Object
Returns the value of attribute input_tokens.
-
#model_used ⇒ Object
Returns the value of attribute model_used.
-
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content
6 7 8 |
# File 'lib/smith/workflow/agent_result.rb', line 6 def content @content end |
#cost ⇒ Object
Returns the value of attribute cost
6 7 8 |
# File 'lib/smith/workflow/agent_result.rb', line 6 def cost @cost end |
#input_tokens ⇒ Object
Returns the value of attribute input_tokens
6 7 8 |
# File 'lib/smith/workflow/agent_result.rb', line 6 def input_tokens @input_tokens end |
#model_used ⇒ Object
Returns the value of attribute model_used
6 7 8 |
# File 'lib/smith/workflow/agent_result.rb', line 6 def model_used @model_used end |
#output_tokens ⇒ Object
Returns the value of attribute output_tokens
6 7 8 |
# File 'lib/smith/workflow/agent_result.rb', line 6 def output_tokens @output_tokens end |
Class Method Details
.from_response(response, content, model_used: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/smith/workflow/agent_result.rb', line 10 def self.from_response(response, content, model_used: nil) new( content: content, input_tokens: response.respond_to?(:input_tokens) ? response.input_tokens : nil, output_tokens: response.respond_to?(:output_tokens) ? response.output_tokens : nil, cost: nil, model_used: model_used ) end |
Instance Method Details
#usage_known? ⇒ Boolean
20 21 22 |
# File 'lib/smith/workflow/agent_result.rb', line 20 def usage_known? !input_tokens.nil? && !output_tokens.nil? end |