Class: LLM::Usage
- Inherits:
-
Struct
- Object
- Struct
- LLM::Usage
- Defined in:
- lib/llm/usage.rb
Overview
The LLM::Usage class represents token usage for a given conversation or completion. As a conversation grows, so does the number of tokens used. This class helps track the number of input, output, reasoning and overall token count. It can also help track usage of the context window (which may vary by model).
Instance Attribute Summary collapse
-
#input_tokens ⇒ Object
Returns the value of attribute input_tokens.
-
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
-
#reasoning_tokens ⇒ Object
Returns the value of attribute reasoning_tokens.
-
#total_tokens ⇒ Object
Returns the value of attribute total_tokens.
Instance Attribute Details
#input_tokens ⇒ Object
Returns the value of attribute input_tokens
10 11 12 |
# File 'lib/llm/usage.rb', line 10 def input_tokens @input_tokens end |
#output_tokens ⇒ Object
Returns the value of attribute output_tokens
10 11 12 |
# File 'lib/llm/usage.rb', line 10 def output_tokens @output_tokens end |
#reasoning_tokens ⇒ Object
Returns the value of attribute reasoning_tokens
10 11 12 |
# File 'lib/llm/usage.rb', line 10 def reasoning_tokens @reasoning_tokens end |
#total_tokens ⇒ Object
Returns the value of attribute total_tokens
10 11 12 |
# File 'lib/llm/usage.rb', line 10 def total_tokens @total_tokens end |