mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
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:
parent
1352545617
commit
5847037b3a
1 changed files with 10 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue