Add validation for STORE_MODEL_IN_DB when updating public model groups (#14269)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: ishaan <ishaan@berri.ai>
This commit is contained in:
Ishaan Jaff 2025-09-04 14:40:28 -07:00 committed by GitHub
parent 1352545617
commit 5847037b3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -987,7 +987,7 @@ async def update_public_model_groups(
try:
# Update the public model groups
import litellm
from litellm.proxy.proxy_server import proxy_config
from litellm.proxy.proxy_server import proxy_config, store_model_in_db
# Check if user has admin permissions
if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
@ -1000,6 +1000,15 @@ async def update_public_model_groups(
},
)
# Check if STORE_MODEL_IN_DB is enabled
if store_model_in_db is not True:
raise HTTPException(
status_code=500,
detail={
"error": "Set `'STORE_MODEL_IN_DB='True'` in your env to enable this feature."
},
)
litellm.public_model_groups = request.model_groups
# Load existing config