mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
Merge ac2551057d into 49affa7c01
This commit is contained in:
commit
cddc5dc4d5
1 changed files with 5 additions and 3 deletions
|
|
@ -73,12 +73,14 @@ class TestTeamDisableGlobalGuardrail:
|
|||
exercised_on=["chat_completions"],
|
||||
)
|
||||
def test_team_with_disable_flag_bypasses_global_guardrail(
|
||||
self, client: GuardrailsClient, resources: ResourceManager
|
||||
self, client: GuardrailsClient, resources: ResourceManager, scoped_key: str
|
||||
) -> None:
|
||||
banned = unique_marker()
|
||||
guardrail_id = client.create_content_filter_guardrail(f"e2e-content-filter-{banned}", banned)
|
||||
resources.defer(lambda: client.delete_guardrail(guardrail_id))
|
||||
|
||||
_assert_eventually_blocked(client, scoped_key, banned)
|
||||
|
||||
team_id = client.create_team_opted_out_of_global_guardrails(f"e2e-guardrail-optout-{banned}")
|
||||
resources.defer(lambda: client.delete_team(team_id))
|
||||
key = client.create_key_in_team(team_id)
|
||||
|
|
@ -87,6 +89,6 @@ class TestTeamDisableGlobalGuardrail:
|
|||
chat = unwrap(client.chat(key, MODEL, _prompt_with(banned)))
|
||||
|
||||
assert chat.choices, (
|
||||
f"team opted out of global guardrails, so the banned keyword must pass "
|
||||
f"through and the call must succeed, but no choices came back: {chat}"
|
||||
f"the same prompt was just blocked for a key outside the team, so the opt-out "
|
||||
f"is what must let it through, but no choices came back: {chat}"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue