The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ui): format tag-based guardrail mode in delete modal, playground, and policy picker
Devin AI881aa2080871
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsxindex fd8ed22867b..c64b5d7cb5c 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx@@ -6,13 +6,15 @@ import { toast } from "@/lib/toast";import { Card, CardContent } from "@/components/ui/card";import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";import { UiLoadingSpinner } from "@/components/ui/ui-loading-spinner";+import { GuardrailMode } from "@/components/guardrails/types";+import { formatGuardrailMode } from "./guardrail_info_helpers";interface GuardrailItem {guardrail_id?: string;guardrail_name: string | null;litellm_params: {guardrail: string;- mode: string;+ mode: GuardrailMode;default_on: boolean;};guardrail_info: Record<string, any> | null;@@ -171,7 +173,9 @@ const GuardrailTestPlayground: React.FC<GuardrailTestPlaygroundProps> = ({</div><div><span className="font-medium">Mode: </span>- <span className="text-muted-foreground">{guardrail.litellm_params.mode}</span>+ <span className="text-muted-foreground">+ {formatGuardrailMode(guardrail.litellm_params.mode)}+ </span></div></div></li>diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.tsxindex b4c29bd9c40..7e59abf8e3d 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailsPanel.tsx@@ -18,7 +18,7 @@ import GuardrailTestPlayground from "./GuardrailTestPlayground";import { toast } from "@/lib/toast";import { Guardrail } from "@/components/guardrails/types";import DeleteResourceModal from "@/components/common_components/DeleteResourceModal";-import { getGuardrailLogoAndName } from "./guardrail_info_helpers";+import { formatGuardrailMode, getGuardrailLogoAndName } from "./guardrail_info_helpers";import { CustomCodeModal } from "./custom_code";import GuardrailGarden from "./guardrail_garden";import { TeamGuardrailsTab } from "./TeamGuardrailsTab";@@ -211,7 +211,7 @@ const GuardrailsPanel: React.FC<GuardrailsPanelProps> = ({ accessToken, userRole{ label: "Name", value: guardrailToDelete?.guardrail_name },{ label: "ID", value: guardrailToDelete?.guardrail_id, code: true },{ label: "Provider", value: providerDisplayName },- { label: "Mode", value: guardrailToDelete?.litellm_params.mode },+ { label: "Mode", value: formatGuardrailMode(guardrailToDelete?.litellm_params.mode) },{label: "Default On",value: guardrailToDelete?.litellm_params.default_on ? "Yes" : "No",diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsxindex 5e476a8accd..d4a1885146d 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx@@ -560,7 +560,9 @@ const GuardrailInfoView: React.FC<GuardrailInfoProps> = ({ guardrailId, onClose,<Card className="block p-6"><p>Mode</p><div className="mt-2">- <h3 className="text-lg font-medium">{formatGuardrailMode(guardrailData.litellm_params?.mode) || "-"}</h3>+ <h3 className="text-lg font-medium">+ {formatGuardrailMode(guardrailData.litellm_params?.mode) || "-"}+ </h3><Badge variant={guardrailData.litellm_params?.default_on ? "secondary" : "outline"}>{guardrailData.litellm_params?.default_on ? "Default On" : "Default Off"}</Badge>diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsxindex 0b439462c1a..f87155db719 100644--- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx@@ -12,6 +12,7 @@ import {} from "@/components/ui/dialog";import { Separator } from "@/components/ui/separator";import { CheckCircle2, Info } from "lucide-react";+import { formatGuardrailMode } from "@/app/(dashboard)/guardrails/_components/guardrail_info_helpers";interface GuardrailInfo {guardrail_name: string;@@ -163,7 +164,9 @@ const GuardrailSelectionModal: React.FC<GuardrailSelectionModalProps> = ({{/* Show guardrail type and mode */}<div className="flex gap-2 mt-2"><Badge variant="outline">{guardrail.definition?.litellm_params?.guardrail || "unknown"}</Badge>- <Badge variant="secondary">{guardrail.definition?.litellm_params?.mode || "unknown"}</Badge>+ <Badge variant="secondary">+ {formatGuardrailMode(guardrail.definition?.litellm_params?.mode) || "unknown"}+ </Badge>{guardrail.definition?.litellm_params?.patterns && (<Badge variant="secondary">{guardrail.definition.litellm_params.patterns.length} pattern(s)