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.
-
#call_cost ⇒ Object
readonly
Returns the value of attribute call_cost.
-
#daily_total ⇒ Object
readonly
Returns the value of attribute daily_total.
-
#last_event ⇒ Object
readonly
Returns the value of attribute last_event.
-
#monthly_total ⇒ Object
readonly
Returns the value of attribute monthly_total.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(budget:, last_event: nil, budget_type: nil, total: nil, monthly_total: nil, daily_total: nil, call_cost: nil) ⇒ BudgetExceededError
constructor
A new instance of BudgetExceededError.
Constructor Details
#initialize(budget:, last_event: nil, budget_type: nil, total: nil, monthly_total: nil, daily_total: nil, call_cost: nil) ⇒ BudgetExceededError
Returns a new instance of BudgetExceededError.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/llm_cost_tracker/errors.rb', line 11 def initialize(budget:, last_event: nil, budget_type: nil, total: nil, monthly_total: nil, daily_total: nil, call_cost: nil) @monthly_total = monthly_total @daily_total = daily_total @call_cost = call_cost @total = total || monthly_total || daily_total || call_cost @budget = budget @budget_type = budget_type || inferred_budget_type @last_event = last_event super("LLM #{budget_label} 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 |
#call_cost ⇒ Object (readonly)
Returns the value of attribute call_cost.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def call_cost @call_cost end |
#daily_total ⇒ Object (readonly)
Returns the value of attribute daily_total.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def daily_total @daily_total 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 |
#monthly_total ⇒ Object (readonly)
Returns the value of attribute monthly_total.
9 10 11 |
# File 'lib/llm_cost_tracker/errors.rb', line 9 def monthly_total @monthly_total 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 |