Class: Cline::Usage
- Inherits:
-
Struct
- Object
- Struct
- Cline::Usage
- Defined in:
- lib/cline/usage.rb
Overview
Track usage statistics associated to a message
Instance Attribute Summary collapse
-
#cache_read_tokens ⇒ Object
Returns the value of attribute cache_read_tokens.
-
#cache_write_tokens ⇒ Object
Returns the value of attribute cache_write_tokens.
-
#cline_model ⇒ Object
Returns the value of attribute cline_model.
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#input_tokens ⇒ Object
Returns the value of attribute input_tokens.
-
#output_tokens ⇒ Object
Returns the value of attribute output_tokens.
Public API collapse
-
#context_tokens ⇒ Integer
Total context tokens consumed.
-
#context_tokens_limit ⇒ Integer?
Maximum context window limit for the used model.
Instance Attribute Details
#cache_read_tokens ⇒ Object
Returns the value of attribute cache_read_tokens
3 4 5 |
# File 'lib/cline/usage.rb', line 3 def cache_read_tokens @cache_read_tokens end |
#cache_write_tokens ⇒ Object
Returns the value of attribute cache_write_tokens
3 4 5 |
# File 'lib/cline/usage.rb', line 3 def cache_write_tokens @cache_write_tokens end |
#cline_model ⇒ Object
Returns the value of attribute cline_model
3 4 5 |
# File 'lib/cline/usage.rb', line 3 def cline_model @cline_model end |
#cost ⇒ Object
Returns the value of attribute cost
3 4 5 |
# File 'lib/cline/usage.rb', line 3 def cost @cost end |
#input_tokens ⇒ Object
Returns the value of attribute input_tokens
3 4 5 |
# File 'lib/cline/usage.rb', line 3 def input_tokens @input_tokens end |
#output_tokens ⇒ Object
Returns the value of attribute output_tokens
3 4 5 |
# File 'lib/cline/usage.rb', line 3 def output_tokens @output_tokens end |
Instance Method Details
#context_tokens ⇒ Integer
Returns Total context tokens consumed.
28 29 30 |
# File 'lib/cline/usage.rb', line 28 def context_tokens input_tokens + output_tokens + cache_read_tokens + cache_write_tokens end |
#context_tokens_limit ⇒ Integer?
Returns Maximum context window limit for the used model.
33 34 35 |
# File 'lib/cline/usage.rb', line 33 def context_tokens_limit cline_model&.context_window end |