Class: LlmCostTracker::Usage::Dimension

Inherits:
Data
  • Object
show all
Defined in:
lib/llm_cost_tracker/usage/dimension.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_stateObject (readonly)

Returns the value of attribute cache_state

Returns:

  • (Object)

    the current value of cache_state



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def cache_state
  @cache_state
end

#directionObject (readonly)

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def direction
  @direction
end

#keyObject (readonly)

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def key
  @key
end

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def kind
  @kind
end

#modalityObject (readonly)

Returns the value of attribute modality

Returns:

  • (Object)

    the current value of modality



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def modality
  @modality
end

#rate_basisObject (readonly)

Returns the value of attribute rate_basis

Returns:

  • (Object)

    the current value of rate_basis



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def rate_basis
  @rate_basis
end

#unitObject (readonly)

Returns the value of attribute unit

Returns:

  • (Object)

    the current value of unit



5
6
7
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 5

def unit
  @unit
end

Instance Method Details

#cost_keyObject



16
17
18
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 16

def cost_key
  :"#{key}_cost" if token?
end

#token?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 8

def token?
  unit == "token"
end

#token_keyObject



12
13
14
# File 'lib/llm_cost_tracker/usage/dimension.rb', line 12

def token_key
  :"#{key}_tokens" if token?
end