Class: Langfuse::Models::Usage
- Inherits:
-
Object
- Object
- Langfuse::Models::Usage
- Defined in:
- lib/langfuse/models/usage.rb
Instance Attribute Summary collapse
-
#completion_tokens ⇒ Object
Returns the value of attribute completion_tokens.
-
#input ⇒ Object
Returns the value of attribute input.
-
#input_cost ⇒ Object
Returns the value of attribute input_cost.
-
#output ⇒ Object
Returns the value of attribute output.
-
#output_cost ⇒ Object
Returns the value of attribute output_cost.
-
#prompt_tokens ⇒ Object
Returns the value of attribute prompt_tokens.
-
#total ⇒ Object
Returns the value of attribute total.
-
#total_cost ⇒ Object
Returns the value of attribute total_cost.
-
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Usage
constructor
A new instance of Usage.
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Usage
Returns a new instance of Usage.
9 10 11 12 13 |
# File 'lib/langfuse/models/usage.rb', line 9 def initialize(attributes = {}) attributes.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |
Instance Attribute Details
#completion_tokens ⇒ Object
Returns the value of attribute completion_tokens.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def completion_tokens @completion_tokens end |
#input ⇒ Object
Returns the value of attribute input.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def input @input end |
#input_cost ⇒ Object
Returns the value of attribute input_cost.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def input_cost @input_cost end |
#output ⇒ Object
Returns the value of attribute output.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def output @output end |
#output_cost ⇒ Object
Returns the value of attribute output_cost.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def output_cost @output_cost end |
#prompt_tokens ⇒ Object
Returns the value of attribute prompt_tokens.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def prompt_tokens @prompt_tokens end |
#total ⇒ Object
Returns the value of attribute total.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def total @total end |
#total_cost ⇒ Object
Returns the value of attribute total_cost.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def total_cost @total_cost end |
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def total_tokens @total_tokens end |
#unit ⇒ Object
Returns the value of attribute unit.
5 6 7 |
# File 'lib/langfuse/models/usage.rb', line 5 def unit @unit end |
Instance Method Details
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/langfuse/models/usage.rb', line 15 def to_h { input: @input, output: @output, total: @total, unit: @unit, inputCost: @input_cost, outputCost: @output_cost, totalCost: @total_cost, promptTokens: @prompt_tokens, completionTokens: @completion_tokens, totalTokens: @total_tokens }.compact end |