pub struct BudgetCfg {
pub name: String,
pub scope: String,
pub unit: String,
pub limit: f64,
pub window: String,
}Expand description
One hard budget ([[llm.budgets]]): a ceiling of limit (in unit) over window, keyed by
scope. Enforced fail-closed before the request reaches the upstream.
Fields§
§name: StringIdentifier (also the metric/log label and part of the store key). Required, non-empty.
scope: StringKeying dimension: "global", "key" (per authenticated principal), or "model".
unit: String"tokens" (prompt + completion) or "usd" (cost via the price book).
limit: f64The ceiling, in unit: a token count, or — for unit = "usd" — dollars (e.g. 25.0).
window: StringReset window, e.g. "1h", "24h", "30d". The budget resets at each window boundary.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BudgetCfg
impl<'de> Deserialize<'de> for BudgetCfg
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BudgetCfg
impl RefUnwindSafe for BudgetCfg
impl Send for BudgetCfg
impl Sync for BudgetCfg
impl Unpin for BudgetCfg
impl UnsafeUnpin for BudgetCfg
impl UnwindSafe for BudgetCfg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more