Class: VoyageAI::Usage
- Inherits:
-
Object
- Object
- VoyageAI::Usage
- Defined in:
- lib/voyageai/usage.rb
Overview
The usage returned by the VoyageAI API.
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(total_tokens:) ⇒ Usage
constructor
A new instance of Usage.
- #inspect ⇒ String
Constructor Details
#initialize(total_tokens:) ⇒ Usage
Returns a new instance of Usage.
14 15 16 |
# File 'lib/voyageai/usage.rb', line 14 def initialize(total_tokens:) @total_tokens = total_tokens end |
Instance Attribute Details
#total_tokens ⇒ Integer
11 12 13 |
# File 'lib/voyageai/usage.rb', line 11 def total_tokens @total_tokens end |
Class Method Details
.parse(data:) ⇒ Usage
25 26 27 |
# File 'lib/voyageai/usage.rb', line 25 def self.parse(data:) new(total_tokens: data["total_tokens"]) end |
Instance Method Details
#inspect ⇒ String
19 20 21 |
# File 'lib/voyageai/usage.rb', line 19 def inspect "#<#{self.class.name} total_tokens=#{total_tokens}>" end |