Class: LLM::Usage

Inherits:
Struct
  • Object
show all
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, and total tokens. It can also help track usage of the context window (which may vary by model).

Instance Attribute Summary collapse

Instance Attribute Details

#input_tokensObject

Returns the value of attribute input_tokens

Returns:

  • (Object)

    the current value of input_tokens



9
10
11
# File 'lib/llm/usage.rb', line 9

def input_tokens
  @input_tokens
end

#output_tokensObject

Returns the value of attribute output_tokens

Returns:

  • (Object)

    the current value of output_tokens



9
10
11
# File 'lib/llm/usage.rb', line 9

def output_tokens
  @output_tokens
end

#total_tokensObject

Returns the value of attribute total_tokens

Returns:

  • (Object)

    the current value of total_tokens



9
10
11
# File 'lib/llm/usage.rb', line 9

def total_tokens
  @total_tokens
end