From 08efef5316a72646ff8111ece73484946ccc7dd3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 12 Jul 2024 18:18:39 -0700 Subject: [PATCH] feat add safe_memory_mode --- litellm/__init__.py | 1 + litellm/proxy/utils.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/litellm/__init__.py b/litellm/__init__.py index 6a2b8b151c..9e28559e90 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -113,6 +113,7 @@ ssl_verify: bool = True ssl_certificate: Optional[str] = None disable_streaming_logging: bool = False in_memory_llm_clients_cache: dict = {} +safe_memory_mode: bool = False ### DEFAULT AZURE API VERSION ### AZURE_DEFAULT_API_VERSION = "2024-02-01" # this is updated to the latest ### GUARDRAILS ### diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 435f5f9257..11662de4be 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -83,6 +83,8 @@ def safe_deep_copy(data): Use this function to safely deep copy the LiteLLM Request """ + if litellm.safe_memory_mode is True: + return data # Step 1: Remove the litellm_parent_otel_span if isinstance(data, dict):