Class: Smith::Workflow::UsageEntry
- Inherits:
-
Struct
- Object
- Struct
- Smith::Workflow::UsageEntry
- Defined in:
- lib/smith/workflow/usage_entry.rb
Overview
One row per agent provider call. usage_id is a UUID generated at
recording time and stable across persist/restore so hosts can use it as an
idempotency anchor.
rubocop:disable Style/RedundantStructKeywordInit
Instance Attribute Summary collapse
-
#agent_name ⇒ Object
Returns the value of attribute agent_name.
-
#attempt_kind ⇒ Object
Returns the value of attribute attempt_kind.
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#input_tokens ⇒ Object
Returns the value of attribute input_tokens.
-
#model ⇒ Object
Returns the value of attribute model.
-
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
-
#recorded_at ⇒ Object
Returns the value of attribute recorded_at.
-
#usage_id ⇒ Object
Returns the value of attribute usage_id.
Class Method Summary collapse
Instance Attribute Details
#agent_name ⇒ Object
Returns the value of attribute agent_name
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def agent_name @agent_name end |
#attempt_kind ⇒ Object
Returns the value of attribute attempt_kind
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def attempt_kind @attempt_kind end |
#cost ⇒ Object
Returns the value of attribute cost
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def cost @cost end |
#input_tokens ⇒ Object
Returns the value of attribute input_tokens
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def input_tokens @input_tokens end |
#model ⇒ Object
Returns the value of attribute model
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def model @model end |
#output_tokens ⇒ Object
Returns the value of attribute output_tokens
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def output_tokens @output_tokens end |
#recorded_at ⇒ Object
Returns the value of attribute recorded_at
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def recorded_at @recorded_at end |
#usage_id ⇒ Object
Returns the value of attribute usage_id
9 10 11 |
# File 'lib/smith/workflow/usage_entry.rb', line 9 def usage_id @usage_id end |
Class Method Details
.from_h(hash) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/smith/workflow/usage_entry.rb', line 20 def self.from_h(hash) sym = hash.transform_keys(&:to_sym) filtered = sym.slice(*members) filtered[:agent_name] = filtered[:agent_name].to_sym if filtered[:agent_name].is_a?(String) filtered[:attempt_kind] = filtered[:attempt_kind].to_sym if filtered[:attempt_kind].is_a?(String) new(**filtered) end |