Exception: LlmCostTracker::BudgetExceededError

Inherits:
Error
  • Object
show all
Defined in:
lib/llm_cost_tracker/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(monthly_total:, budget:, last_event: nil) ⇒ BudgetExceededError

Returns a new instance of BudgetExceededError.



9
10
11
12
13
14
15
# File 'lib/llm_cost_tracker/errors.rb', line 9

def initialize(monthly_total:, budget:, last_event: nil)
  @monthly_total = monthly_total
  @budget = budget
  @last_event = last_event

  super("LLM monthly budget exceeded: $#{format('%.6f', monthly_total)} / $#{format('%.6f', budget)}")
end

Instance Attribute Details

#budgetObject (readonly)

Returns the value of attribute budget.



7
8
9
# File 'lib/llm_cost_tracker/errors.rb', line 7

def budget
  @budget
end

#last_eventObject (readonly)

Returns the value of attribute last_event.



7
8
9
# File 'lib/llm_cost_tracker/errors.rb', line 7

def last_event
  @last_event
end

#monthly_totalObject (readonly)

Returns the value of attribute monthly_total.



7
8
9
# File 'lib/llm_cost_tracker/errors.rb', line 7

def monthly_total
  @monthly_total
end