Exception: LlmCostTracker::BudgetExceededError
- Defined in:
- lib/llm_cost_tracker/errors.rb
Instance Attribute Summary collapse
-
#budget ⇒ Object
readonly
Returns the value of attribute budget.
-
#budget_type ⇒ Object
readonly
Returns the value of attribute budget_type.
-
#last_event ⇒ Object
readonly
Returns the value of attribute last_event.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(budget:, budget_type:, total:, last_event: nil) ⇒ BudgetExceededError
constructor
A new instance of BudgetExceededError.
Constructor Details
#initialize(budget:, budget_type:, total:, last_event: nil) ⇒ BudgetExceededError
Returns a new instance of BudgetExceededError.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/llm_cost_tracker/errors.rb', line 11 def initialize(budget:, budget_type:, total:, last_event: nil) @total = total @budget = budget @budget_type = budget_type @last_event = last_event super( "LLM #{@budget_type.to_s.tr('_', '-')} budget exceeded: " \ "$#{format('%.6f', @total)} / $#{format('%.6f', budget)}" ) end |
Instance Attribute Details
#budget ⇒ Object (readonly)
Returns the value of attribute budget.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def budget @budget end |
#budget_type ⇒ Object (readonly)
Returns the value of attribute budget_type.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def budget_type @budget_type end |
#last_event ⇒ Object (readonly)
Returns the value of attribute last_event.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def last_event @last_event end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def total @total end |