From 29309f767c08c2b13aad775b805db34d9ce78e01 Mon Sep 17 00:00:00 2001 From: Arseny Boykov <36469655+Bobronium@users.noreply.github.com> Date: Tue, 9 Sep 2025 20:21:31 +0200 Subject: [PATCH] Use fastuuid for litellm_call_id (#14346) (cherry picked from commit 201806401ff12564fb6065b69cd8af347ed7c8e6) --- litellm/litellm_core_utils/litellm_logging.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 4c95d0053fc..6a203748c97 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -10,7 +10,7 @@ import subprocess import sys import time import traceback -import uuid +import fastuuid as uuid from datetime import datetime as dt_object from functools import lru_cache from typing import ( @@ -1714,9 +1714,12 @@ class Logging(LiteLLMLoggingBaseClass): response_obj=result, start_time=start_time, end_time=end_time, - litellm_call_id=litellm_params.get( - "litellm_call_id", str(uuid.uuid4()) - ), + litellm_call_id=current_call_id + if ( + current_call_id := litellm_params.get("litellm_call_id") + ) + is not None + else str(uuid.uuid4()), print_verbose=print_verbose, ) if callback == "wandb" and weightsBiasesLogger is not None: