Class: Smith::Workflow::Composite::Effects

Inherits:
Payload
  • Object
show all
Defined in:
lib/smith/workflow/composite/effects.rb

Constant Summary

Constants inherited from Payload

Payload::MAX_SERIALIZED_BYTES

Instance Attribute Summary collapse

Instance Method Summary collapse

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_costObject (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_tokensObject (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