fix: preserve falsy ID values and remove redundant comments

- Fix ID extraction to preserve falsy values (0, empty string, False) from response_obj

- Only fallback to litellm_call_id when id is None (attribute doesn't exist)

- Remove redundant comments that duplicate function names and obvious logic

- Clean up code for better readability
This commit is contained in:
Alexsander Hamir 2026-01-14 12:26:34 -08:00
parent 5969824089
commit 5401e6d97b

View file

@ -5102,7 +5102,10 @@ def get_standard_logging_object_payload(
),
)
id = _safe_get_attribute(response_obj, "id", None) or kwargs.get("litellm_call_id")
# Preserve falsy values (0, "", False) if they exist in response_obj
id = _safe_get_attribute(response_obj, "id", None)
if id is None:
id = kwargs.get("litellm_call_id")
_model_id = metadata.get("model_info", {}).get("id", "")
_model_group = metadata.get("model_group", "")