From 9b87e4ea5234d593d6b02cde20c3c3f34737aa77 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 21 Oct 2024 22:32:51 +0530 Subject: [PATCH] fix setting StandardLoggingMetadata --- litellm/litellm_core_utils/litellm_logging.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index d17b2c79084..73e2b4ec304 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -2867,13 +2867,9 @@ def get_standard_logging_metadata( ) if isinstance(metadata, dict): # Filter the metadata dictionary to include only the specified keys - clean_metadata = StandardLoggingMetadata( - **{ # type: ignore - key: metadata[key] - for key in StandardLoggingMetadata.__annotations__.keys() - if key in metadata - } - ) + for k, v in metadata.items(): + if k in StandardLoggingMetadata.__annotations__.keys(): + clean_metadata[k] = v if metadata.get("user_api_key") is not None: if is_valid_sha256_hash(str(metadata.get("user_api_key"))):