From ef7f3bc4febb18b9146c1ef12eabfca6690322eb Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 27 May 2024 16:29:51 -0700 Subject: [PATCH] backend - add audit logs for adding models --- docs/my-website/docs/proxy/enterprise.md | 1 + litellm/proxy/proxy_server.py | 10 +++++---- .../src/components/model_dashboard.tsx | 21 +++++++++++++------ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/docs/my-website/docs/proxy/enterprise.md b/docs/my-website/docs/proxy/enterprise.md index c47589e8a9..a8c84bf4fb 100644 --- a/docs/my-website/docs/proxy/enterprise.md +++ b/docs/my-website/docs/proxy/enterprise.md @@ -21,6 +21,7 @@ Features: - ✅ Don't log/store specific requests to Langfuse, Sentry, etc. (eg confidential LLM requests) - ✅ Tracking Spend for Custom Tags - ✅ Custom Branding + Routes on Swagger Docs +- ✅ Audit Logs for `Created At, Created By` when Models Added ## Content Moderation diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 19e68965f9..9eb0d2a15a 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -2790,10 +2790,12 @@ class ProxyConfig: model.model_info["id"] = _id model.model_info["db_model"] = True - model.model_info["created_at"] = getattr(model, "created_at", None) - model.model_info["updated_at"] = getattr(model, "updated_at", None) - model.model_info["created_by"] = getattr(model, "created_by", None) - model.model_info["updated_by"] = getattr(model, "updated_by", None) + if premium_user is True: + # seeing "created_at", "updated_at", "created_by", "updated_by" is a LiteLLM Enterprise Feature + model.model_info["created_at"] = getattr(model, "created_at", None) + model.model_info["updated_at"] = getattr(model, "updated_at", None) + model.model_info["created_by"] = getattr(model, "created_by", None) + model.model_info["updated_by"] = getattr(model, "updated_by", None) if model.model_info is not None and isinstance(model.model_info, dict): if "id" not in model.model_info: diff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsx index a8a6637332..2cb1c2cf0a 100644 --- a/ui/litellm-dashboard/src/components/model_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx @@ -1133,8 +1133,11 @@ const ModelDashboard: React.FC = ({ fontSize: "11px" }} > - ✨ Created At - + { + premiumUser ? "Created At" : ✨ Created At + } + + = ({ fontSize: "11px" }} > - ✨ Created By + { + premiumUser ? "Created By" : ✨ Created By + } = ({ selectedModelGroup === "" ) .map((model: any, index: number) => ( - + = ({

- {formatCreatedAt(model.model_info.created_at) || "-"} + { + premiumUser ? formatCreatedAt(model.model_info.created_at) || "-" : "-" + }

- {model.model_info.created_by || "-"} + { + premiumUser ? model.model_info.created_by || "-" : "-" + }