Class: LlmCostTracker::Pricing::Unknown

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_cost_tracker/pricing/unknown.rb

Constant Summary collapse

MUTEX =
Mutex.new
WARN_CACHE_LIMIT =
1024

Class Method Summary collapse

Class Method Details

.process(model) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/llm_cost_tracker/pricing/unknown.rb', line 12

def process(model)
  model = model.to_s.presence || Event::UNKNOWN_MODEL

  case LlmCostTracker.configuration.unknown_pricing_behavior
  when :ignore
    nil
  when :warn
    warn_missing(model)
  when :raise
    raise UnknownPricingError.new(model: model)
  end
end

.reset!Object



25
26
27
# File 'lib/llm_cost_tracker/pricing/unknown.rb', line 25

def reset!
  MUTEX.synchronize { @warned_models = Set.new }
end