mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
Merge 8a334c6709 into 647cb46fe3
This commit is contained in:
commit
8d68d73ff8
2 changed files with 9 additions and 1 deletions
|
|
@ -251,7 +251,7 @@ def _redact_agent_params_tree(value: object, _depth: int) -> object:
|
|||
return {
|
||||
key: (
|
||||
REDACTED_BY_LITELM_STRING
|
||||
if _AGENT_PARAMS_MASKER.is_sensitive_key(key)
|
||||
if nested_value not in (None, "") and _AGENT_PARAMS_MASKER.is_sensitive_key(key)
|
||||
else _redact_agent_params_tree(nested_value, _depth + 1)
|
||||
)
|
||||
for key, nested_value in typed_params.items()
|
||||
|
|
|
|||
|
|
@ -578,6 +578,14 @@ def test_redact_sensitive_agent_litellm_params_handles_none_and_json_string():
|
|||
assert json.loads(redacted)["model"] == "gpt-4"
|
||||
|
||||
|
||||
def test_redact_sensitive_agent_litellm_params_shows_an_unset_secret_as_unset() -> None:
|
||||
redacted: Final = redact_sensitive_agent_litellm_params(
|
||||
{"api_key": None, "aws_secret_access_key": "", "client_secret": SENTINEL_AWS_SECRET_ACCESS_KEY}
|
||||
)
|
||||
|
||||
assert redacted == {"api_key": None, "aws_secret_access_key": "", "client_secret": REDACTED_BY_LITELM_STRING}
|
||||
|
||||
|
||||
def test_redact_sensitive_agent_litellm_params_recurses_into_lists_of_dicts():
|
||||
"""A secret nested inside a list of provider sub-configs (a shape a
|
||||
non-sensitively-named key can legitimately hold) must also be redacted,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue