mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
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
This commit is contained in:
parent
348b82fd33
commit
39e4bbc191
4 changed files with 25 additions and 6 deletions
|
|
@ -394,7 +394,7 @@ export const GUARDRAIL_PRESETS: Record<string, GuardrailPreset> = {
|
|||
defaultOn: false,
|
||||
},
|
||||
collieai: {
|
||||
provider: "CollieAi",
|
||||
provider: "Collieai",
|
||||
guardrailNameSuggestion: "CollieAi",
|
||||
mode: ["pre_call", "post_call"],
|
||||
defaultOn: true,
|
||||
|
|
|
|||
|
|
@ -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<string, string> = {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export const guardrail_provider_map: Record<string, string> = {
|
|||
"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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue