mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix: replace mutable default arguments with None in function signatures
This commit is contained in:
parent
5be0797d24
commit
9ca3e41121
5 changed files with 12 additions and 9 deletions
|
|
@ -950,7 +950,8 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
masked_api_base = api_base
|
||||
return str(masked_api_base)
|
||||
|
||||
def _pre_call(self, input, api_key, model=None, additional_args={}):
|
||||
def _pre_call(self, input, api_key, model=None, additional_args=None):
|
||||
additional_args = additional_args or {}
|
||||
"""
|
||||
Common helper function across the sync + async pre-call function
|
||||
"""
|
||||
|
|
@ -967,7 +968,8 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
self._get_masked_api_base(additional_args.get("api_base", ""))
|
||||
)
|
||||
|
||||
def pre_call(self, input, api_key, model=None, additional_args={}): # noqa: PLR0915
|
||||
def pre_call(self, input, api_key, model=None, additional_args=None):
|
||||
additional_args = additional_args or {} # noqa: PLR0915
|
||||
# Log the exact input to the LLM API
|
||||
litellm.error_logs["PRE_CALL"] = locals()
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -7136,7 +7136,8 @@ def select_data_generator(
|
|||
)
|
||||
|
||||
|
||||
def get_litellm_model_info(model: dict = {}):
|
||||
def get_litellm_model_info(model: dict = None):
|
||||
model = model or {}
|
||||
model_info = model.get("model_info", {})
|
||||
model_to_lookup = model.get("litellm_params", {}).get("model", None)
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ class LowestLatencyLoggingHandler(CustomLogger):
|
|||
logged_success: int = 0
|
||||
logged_failure: int = 0
|
||||
|
||||
def __init__(self, router_cache: DualCache, routing_args: dict = {}):
|
||||
def __init__(self, router_cache: DualCache, routing_args: dict = None):
|
||||
self.router_cache = router_cache
|
||||
self.routing_args = RoutingArgs(**routing_args)
|
||||
self.routing_args = RoutingArgs(**(routing_args or {}))
|
||||
|
||||
def log_success_event( # noqa: PLR0915
|
||||
self, kwargs, response_obj, start_time, end_time
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class LowestTPMLoggingHandler(CustomLogger):
|
|||
logged_failure: int = 0
|
||||
default_cache_time_seconds: int = 1 * 60 * 60 # 1 hour
|
||||
|
||||
def __init__(self, router_cache: DualCache, routing_args: dict = {}):
|
||||
def __init__(self, router_cache: DualCache, routing_args: dict = None):
|
||||
self.router_cache = router_cache
|
||||
self.routing_args = RoutingArgs(**routing_args)
|
||||
self.routing_args = RoutingArgs(**(routing_args or {}))
|
||||
|
||||
def log_success_event(self, kwargs, response_obj, start_time, end_time):
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -3417,11 +3417,11 @@ class LiteLLMLoggingBaseClass:
|
|||
Meant to simplify type checking for logging obj.
|
||||
"""
|
||||
|
||||
def pre_call(self, input, api_key, model=None, additional_args={}):
|
||||
def pre_call(self, input, api_key, model=None, additional_args=None):
|
||||
pass
|
||||
|
||||
def post_call(
|
||||
self, original_response, input=None, api_key=None, additional_args={}
|
||||
self, original_response, input=None, api_key=None, additional_args=None
|
||||
):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue