fix: add None check for litellm_params

We currently cover the first case where the `litellm_params` may not be there, but not when it could be None
This commit is contained in:
AlexsanderHamir 2025-11-17 14:48:51 -08:00
parent 57ae20611b
commit cf22e9a92b

View file

@ -34,6 +34,8 @@ class LowestTPMLoggingHandler(CustomLogger):
"""
Update TPM/RPM usage on success
"""
if "litellm_params" not in kwargs or kwargs["litellm_params"] is None:
return
if kwargs["litellm_params"].get("metadata") is None:
pass
else:
@ -93,11 +95,11 @@ class LowestTPMLoggingHandler(CustomLogger):
"""
Update TPM/RPM usage on success
"""
if "litellm_params" not in kwargs or kwargs["litellm_params"] is None:
return
if kwargs["litellm_params"].get("metadata") is None:
pass
else:
if "litellm_params" not in kwargs:
return
model_group = kwargs["litellm_params"]["metadata"].get(
"model_group", None
)