Package com.tnsai.quality.cost
Enum Class BudgetPolicy
- All Implemented Interfaces:
Serializable,Comparable<BudgetPolicy>,Constable
What the framework should do when a
CostBudget is exhausted
(issue #82).
Sealed-style enum so the enforcement layer can pattern-match
exhaustively. The enforcement layer itself (a Hook<PreAction>
for LLM calls) is a separate follow-up — this enum is the data the
hook will read off the budget definition.
- Since:
- 0.5.0 (issue #82)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic BudgetPolicyReturns the enum constant of this class with the specified name.static BudgetPolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
SOFT_WARN
Emit a warning event + Prometheus alert; let the call through. Use when the budget is informational rather than enforcement (e.g. cost visibility for analytics, not throttling). -
HARD_STOP
Block any new LLM call that would push the period spend over budget. The enforcement hook returns a structured deny so the caller sees "budget exceeded" rather than a silent failure. -
DEFER
Queue the call for the next period and notify the user via theOnNotificationhook. Useful for non-interactive workloads that can wait — interactive chats should pick HARD_STOP instead.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-