mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
enforece guardrails per API Key as enterprise
This commit is contained in:
parent
225e75cafb
commit
cea7b73015
1 changed files with 7 additions and 0 deletions
|
@ -354,6 +354,13 @@ def move_guardrails_to_metadata(
|
|||
"""
|
||||
if user_api_key_dict.metadata:
|
||||
if "guardrails" in user_api_key_dict.metadata:
|
||||
from litellm.proxy.proxy_server import premium_user
|
||||
|
||||
if premium_user is not True:
|
||||
raise ValueError(
|
||||
f"Using Guardrails on API Key {CommonProxyErrors.not_premium_user}"
|
||||
)
|
||||
|
||||
data[_metadata_variable_name]["guardrails"] = user_api_key_dict.metadata[
|
||||
"guardrails"
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue