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
8 9 10 11 12 |
# File 'lib/langfuse/models/usage.rb', line 8 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.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def completion_tokens @completion_tokens end |
#input ⇒ Object
Returns the value of attribute input.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def input @input end |
#input_cost ⇒ Object
Returns the value of attribute input_cost.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def input_cost @input_cost end |
#output ⇒ Object
Returns the value of attribute output.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def output @output end |
#output_cost ⇒ Object
Returns the value of attribute output_cost.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def output_cost @output_cost end |
#prompt_tokens ⇒ Object
Returns the value of attribute prompt_tokens.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def prompt_tokens @prompt_tokens end |
#total ⇒ Object
Returns the value of attribute total.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def total @total end |
#total_cost ⇒ Object
Returns the value of attribute total_cost.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def total_cost @total_cost end |
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def total_tokens @total_tokens end |
#unit ⇒ Object
Returns the value of attribute unit.
4 5 6 |
# File 'lib/langfuse/models/usage.rb', line 4 def unit @unit end |
Instance Method Details
#to_h ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/langfuse/models/usage.rb', line 14 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 |