mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
test(proxy): register safety identifier coverage
This commit is contained in:
parent
232007e7f9
commit
74174c87d8
2 changed files with 6 additions and 2 deletions
1
.github/workflows/test-unit-proxy-db.yml
vendored
1
.github/workflows/test-unit-proxy-db.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue