Module: LlmCostTracker::Usage::Catalog
- Defined in:
- lib/llm_cost_tracker/usage/catalog.rb
Constant Summary collapse
- DEFINITIONS_PATH =
File.("dimensions.yml", __dir__)
- DEFAULT_RATE_BASIS_BY_UNIT =
{ "token" => "per_million_tokens", "character" => "per_million_characters", "request" => "per_request", "session" => "per_session", "hour" => "per_hour", "minute" => "per_minute", "image" => "per_image" }.freeze
Class Method Summary collapse
Class Method Details
.all ⇒ Object
26 27 28 |
# File 'lib/llm_cost_tracker/usage/catalog.rb', line 26 def all @all ||= load_definitions.freeze end |
.token_priced ⇒ Object
30 31 32 |
# File 'lib/llm_cost_tracker/usage/catalog.rb', line 30 def token_priced @token_priced ||= all.select(&:token_key).freeze end |
.token_priced_for(kind:, direction:, cache_state:) ⇒ Object
34 35 36 37 38 |
# File 'lib/llm_cost_tracker/usage/catalog.rb', line 34 def token_priced_for(kind:, direction:, cache_state:) token_priced.find do |dimension| dimension.kind == kind && dimension.direction == direction && dimension.cache_state == cache_state end end |