diff --git a/.github/workflows/test-unit-proxy-db.yml b/.github/workflows/test-unit-proxy-db.yml index 3725e0f5805..527bc2e5c0b 100644 --- a/.github/workflows/test-unit-proxy-db.yml +++ b/.github/workflows/test-unit-proxy-db.yml @@ -195,6 +195,7 @@ jobs: tests/proxy_unit_tests/test_check_responses_cost.py tests/proxy_unit_tests/test_response_polling_handler.py tests/proxy_unit_tests/test_response_polling_pre_call_checks.py + tests/proxy_unit_tests/test_safety_identifier.py tests/proxy_unit_tests/test_realtime_cache.py tests/proxy_unit_tests/test_proxy_exception_mapping.py tests/proxy_unit_tests/test_custom_tokenizer_bug.py diff --git a/litellm/proxy/common_request_processing.py b/litellm/proxy/common_request_processing.py index 074782c3ec7..720e8dc86b4 100644 --- a/litellm/proxy/common_request_processing.py +++ b/litellm/proxy/common_request_processing.py @@ -1542,7 +1542,7 @@ class ProxyBaseLLMRequestProcessing: route_type: ProxyRouteType, user_api_key_dict: UserAPIKeyAuth, ) -> dict[str, object]: - if route_type not in {"acompletion", "aresponses"}: + if route_type not in ("acompletion", "aresponses"): return data if str_to_bool(os.getenv("LITELLM_ENFORCE_SAFETY_IDENTIFIER")) is not True: return data @@ -1550,7 +1550,10 @@ class ProxyBaseLLMRequestProcessing: if not user_id: return data safety_identifier: Final = hashlib.sha256(user_id.encode("utf-8")).hexdigest() - return {**data, "safety_identifier": safety_identifier} + return { # mutable-ok: downstream request processing mutates payloads + **data, + "safety_identifier": safety_identifier, + } @staticmethod def _merge_passthrough_streaming_headers(