mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix(proxy): use default_factory for _BudgetCascade.rollover_caps (#38687)
A MappingProxyType instance is unhashable, and dataclasses rejects any unhashable default value outright, so importing this module raised ValueError: mutable default <class 'mappingproxy'> for field rollover_caps at import time, taking down the whole proxy (and every test that imports it).
This commit is contained in:
parent
0f1145160c
commit
d1dc5f25e5
1 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ import json
|
|||
import math
|
||||
import time
|
||||
from collections.abc import Awaitable, Callable, Iterable, Mapping, Sequence
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
from enum import Enum
|
||||
from types import MappingProxyType
|
||||
|
|
@ -224,7 +224,7 @@ class _BudgetCascade:
|
|||
endusers: tuple[_EndUserRow, ...] = ()
|
||||
counter_resets: tuple[tuple[str, float], ...] = ()
|
||||
cache_keys: tuple[str, ...] = ()
|
||||
rollover_caps: Mapping[str, float] = MappingProxyType({})
|
||||
rollover_caps: Mapping[str, float] = field(default_factory=lambda: MappingProxyType({}))
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue