Class: Smith::Workflow::Composite::Effects
- Inherits:
-
Payload
- Object
- Dry::Struct
- Payload
- Smith::Workflow::Composite::Effects
- Defined in:
- lib/smith/workflow/composite/effects.rb
Constant Summary
Constants inherited from Payload
Instance Attribute Summary collapse
-
#total_cost ⇒ Object
readonly
Returns the value of attribute total_cost.
-
#total_tokens ⇒ Object
readonly
Returns the value of attribute total_tokens.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Effects
constructor
A new instance of Effects.
Constructor Details
#initialize(attributes) ⇒ Effects
Returns a new instance of Effects.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/smith/workflow/composite/effects.rb', line 25 def initialize(attributes) owned = self.class.normalize_attributes(attributes) normalized = MessageValueNormalizer.new(owned, label: "composite effects").call usage_entries = normalized.fetch("usage_entries") tool_results = normalized.fetch("tool_results") budget_consumed = normalized.fetch("budget_consumed") @total_tokens, @total_cost = validate_usage_entries!(usage_entries) validate_tool_results!(tool_results) validate_budget!(budget_consumed) super( usage_entries:, tool_results:, budget_consumed: ) end |
Instance Attribute Details
#total_cost ⇒ Object (readonly)
Returns the value of attribute total_cost.
13 14 15 |
# File 'lib/smith/workflow/composite/effects.rb', line 13 def total_cost @total_cost end |
#total_tokens ⇒ Object (readonly)
Returns the value of attribute total_tokens.
13 14 15 |
# File 'lib/smith/workflow/composite/effects.rb', line 13 def total_tokens @total_tokens end |