fix: add None check for litellm_params (#16754)

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:
Alexsander Hamir 2025-11-17 19:44:29 -08:00 committed by GitHub
parent b9bc903536
commit 6b7035e32f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,6 +33,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:
@ -92,11 +94,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
)