From 39e4bbc19179dc8388ea0789a50541fa5a69cd03 Mon Sep 17 00:00:00 2001 From: CollieAi Date: Wed, 4 Nov 2026 21:57:48 +0100 Subject: [PATCH] fix(guardrails): use the generated Collieai provider key in the dashboard The dashboard builds provider keys from the proxy's provider list, so collieai becomes Collieai. The static CollieAi key came first in the provider map, which left saved CollieAi guardrails without their display name and logo. The map, the Garden preset and the card now use Collieai, and a test covers the lookup The preset expectation is a named value now, which keeps the dashboard under its inline object lint budget --- .../_components/guardrail_garden_configs.ts | 2 +- .../_components/guardrail_garden_data.test.ts | 25 ++++++++++++++++--- .../_components/guardrail_garden_data.ts | 2 +- .../_components/guardrail_info_helpers.tsx | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_configs.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_configs.ts index 4c7985b3114..ca3101224ae 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_configs.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_configs.ts @@ -394,7 +394,7 @@ export const GUARDRAIL_PRESETS: Record = { defaultOn: false, }, collieai: { - provider: "CollieAi", + provider: "Collieai", guardrailNameSuggestion: "CollieAi", mode: ["pre_call", "post_call"], defaultOn: true, diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.test.ts index 2f315fe69aa..061e0fefb40 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.test.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.test.ts @@ -6,6 +6,13 @@ import { LITELLM_CONTENT_FILTER_CARDS, PARTNER_GUARDRAIL_CARDS, } from "./guardrail_garden_data"; +import { + getGuardrailLogoAndName, + getGuardrailProviders, + guardrailLogoMap, + populateGuardrailProviderMap, + populateGuardrailProviders, +} from "./guardrail_info_helpers"; const EXPECTED_PARTNER_LOGO_FILES: Record = { presidio: "microsoft_azure.svg", @@ -104,11 +111,23 @@ describe("decision model presets", () => { describe("collieai preset", () => { it("opens the CollieAi card as an always-on guardrail on both halves of the call", () => { - expect(GUARDRAIL_PRESETS["collieai"]).toEqual({ - provider: "CollieAi", + const expectedPreset = { + provider: "Collieai", guardrailNameSuggestion: "CollieAi", mode: ["pre_call", "post_call"], defaultOn: true, - }); + }; + expect(GUARDRAIL_PRESETS["collieai"]).toEqual(expectedPreset); + }); + + it("uses the provider key the proxy's provider list generates, so saved guardrails keep their name and logo", () => { + const providerParams = { collieai: { ui_friendly_name: "CollieAi" } }; + populateGuardrailProviders(providerParams); + populateGuardrailProviderMap(providerParams); + const provider = GUARDRAIL_PRESETS["collieai"].provider; + + expect(getGuardrailLogoAndName("collieai")).toEqual({ logo: guardrailLogoMap.CollieAi, displayName: "CollieAi" }); + expect(Object.keys(getGuardrailProviders())).toContain(provider); + expect(PARTNER_GUARDRAIL_CARDS.find((card) => card.id === "collieai")?.providerKey).toBe(provider); }); }); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.ts index aebfadfad2f..3ffe2ba2d1f 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.ts @@ -585,7 +585,7 @@ export const PARTNER_GUARDRAIL_CARDS: GuardrailCardInfo[] = [ category: "partner", logo: guardrailLogoMap["CollieAi"], tags: ["Security", "Prompt Injection", "PII", "Policy", "Monitoring"], - providerKey: "CollieAi", + providerKey: "Collieai", }, ]; diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx index cf10e03d81c..6675f3121b8 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx @@ -93,7 +93,7 @@ export const guardrail_provider_map: Record = { "LLM Shield Proxy": "llm_shield_proxy", Conduct: "conduct", DecisionModel: "decision_model", - CollieAi: "collieai", + Collieai: "collieai", }; // Search aliases matched alongside the provider label in the add-guardrail provider combobox