diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 37dc312c4..9f24a79d2 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -4149,9 +4149,10 @@ async def user_request_model(request: Request): "models": new_models, "justification": justification, "user_id": user_id, + "status": "pending", "request_id": str(uuid.uuid4()), }, - table_name="model_request", + table_name="user_notification", ) return {"status": "success"} # update based on remaining passed in values diff --git a/litellm/proxy/schema.prisma b/litellm/proxy/schema.prisma index 623e2ab9b..5377fe90b 100644 --- a/litellm/proxy/schema.prisma +++ b/litellm/proxy/schema.prisma @@ -98,9 +98,10 @@ model LiteLLM_SpendLogs { } // Beta - allow team members to request access to a model -model LiteLLM_ModelRequests { +model LiteLLM_UserNotifications { request_id String @unique user_id String models String[] justification String + status String // approved, disapproved, pending } \ No newline at end of file diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index b073bf8ba..9a36fc9ad 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -698,7 +698,9 @@ class PrismaClient: async def insert_data( self, data: dict, - table_name: Literal["user", "key", "config", "spend", "team", "model_request"], + table_name: Literal[ + "user", "key", "config", "spend", "team", "user_notification" + ], ): """ Add a key to the database. If it already exists, do nothing. @@ -780,17 +782,19 @@ class PrismaClient: ) verbose_proxy_logger.info(f"Data Inserted into Spend Table") return new_spend_row - elif table_name == "model_request": + elif table_name == "user_notification": db_data = self.jsonify_object(data=data) - new_model_request_row = await self.db.litellm_modelrequests.upsert( - where={"request_id": data["request_id"]}, - data={ - "create": {**db_data}, # type: ignore - "update": {}, # don't do anything if it already exists - }, + new_user_notification_row = ( + await self.db.litellm_usernotifications.upsert( + where={"request_id": data["request_id"]}, + data={ + "create": {**db_data}, # type: ignore + "update": {}, # don't do anything if it already exists + }, + ) ) verbose_proxy_logger.info(f"Data Inserted into Model Request Table") - return new_model_request_row + return new_user_notification_row except Exception as e: print_verbose(f"LiteLLM Prisma Client Exception: {e}") diff --git a/schema.prisma b/schema.prisma index 623e2ab9b..8663db1b0 100644 --- a/schema.prisma +++ b/schema.prisma @@ -98,9 +98,10 @@ model LiteLLM_SpendLogs { } // Beta - allow team members to request access to a model -model LiteLLM_ModelRequests { +model LiteLLM_UserNotifications { request_id String @unique user_id String models String[] justification String + status String // approved, disapproved, pending } \ No newline at end of file