diff --git a/litellm/proxy/db/dynamo_db.py b/litellm/proxy/db/dynamo_db.py index 28bfa442c7..b570aa0ca8 100644 --- a/litellm/proxy/db/dynamo_db.py +++ b/litellm/proxy/db/dynamo_db.py @@ -187,6 +187,7 @@ class DynamoDBWrapper(CustomDB): elif table_name == "spend": table = client.table(self.database_arguments.spend_table_name) + value = value.copy() for k, v in value.items(): if k == "token" and value[k].startswith("sk-"): value[k] = hash_token(token=v) @@ -311,6 +312,7 @@ class DynamoDBWrapper(CustomDB): # Initialize an empty UpdateExpression actions: List = [] + value = value.copy() for k, v in value.items(): # Convert datetime object to ISO8601 string if isinstance(v, datetime): diff --git a/litellm/tests/test_key_generate_dynamodb.py b/litellm/tests/test_key_generate_dynamodb.py index 5729c0e87b..f482f35437 100644 --- a/litellm/tests/test_key_generate_dynamodb.py +++ b/litellm/tests/test_key_generate_dynamodb.py @@ -116,6 +116,10 @@ def test_call_with_invalid_key(custom_db_client): def test_call_with_invalid_model(custom_db_client): # 3. Make a call to a key with an invalid model - expect to fail + from litellm._logging import verbose_proxy_logger + import logging + + verbose_proxy_logger.setLevel(logging.DEBUG) setattr(litellm.proxy.proxy_server, "custom_db_client", custom_db_client) setattr(litellm.proxy.proxy_server, "master_key", "sk-1234") try: