Class: LlmCostTracker::Pricing::Unknown

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

Constant Summary collapse

MUTEX =
Mutex.new

Class Method Summary collapse

Class Method Details

.handle!(model) ⇒ Object



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

def handle!(model)
  model = model.to_s.presence || "unknown"

  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



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

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