From 11e388780b572b5dc6c431011c71c3ffaa5dfefd Mon Sep 17 00:00:00 2001 From: "7. Sun" Date: Fri, 27 Mar 2026 09:32:28 +0000 Subject: [PATCH] fix(s3): truncate long response IDs consistently and restore None fallback --- litellm/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 22648580f07..8645108fe82 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -7677,8 +7677,11 @@ def print_args_passed_to_litellm(original_function, args, kwargs): def get_logging_id(start_time, response_obj): try: + resp_id = response_obj.get("id") + if not resp_id: + return None response_id = ( - "time-" + start_time.strftime("%H-%M-%S-%f") + "_" + str(response_obj.get("id"))[:150] if response_obj.get("id") else "" + "time-" + start_time.strftime("%H-%M-%S-%f") + "_" + str(resp_id)[:150] ) return response_id except Exception: