Skip to content

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]

fix(ui): show custom technical keywords on every router whose scorer runs (#38451)

tin-berri166694948f11
diff --git a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx
index 86245a83fbb..cea967f5966 100644
--- a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx
@@ -27,6 +27,7 @@ import {
CLASSIFICATION_RUBRIC_KEYS,
ClassificationRubric,
effectiveTierLabel,
+ heuristicScoringRole,
usesLlmClassifier,
DEFAULT_HEURISTIC_FIRST_MAX_TIER,
HEURISTIC_FIRST_MAX_TIER_KEYS,
@@ -502,7 +503,7 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
</div>
)}
- {value.classifier_type === "heuristic" && (
+ {heuristicScoringRole(value) !== "never" && (
<div className="mt-4">
<div className="flex items-center gap-2 mb-1">
<strong className="font-semibold">Custom Technical Keywords</strong>
diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx
index 45a967c0537..2925c28cc5e 100644
--- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx
@@ -1012,3 +1012,47 @@ describe("ComplexityRouterConfig per-model effort filtering", () => {
);
});
});
+
+describe("ComplexityRouterConfig custom technical keywords", () => {
+ const openClassificationPanel = (value: ComplexityRouterConfigValue) => {
+ renderWithProviders(<ComplexityRouterConfig modelInfo={mockModelInfo} value={value} onChange={vi.fn()} />);
+ fireEvent.click(screen.getByText("Advanced: Classification Method"));
+ };
+
+ const llmConfig = { model: "gpt-3.5-turbo", timeout_ms: 3000 };
+
+ it.each([
+ ["heuristic", { ...defaultValue, classifier_type: "heuristic" as const }],
+ [
+ "heuristic_first",
+ {
+ ...defaultValue,
+ classifier_type: "heuristic_first" as const,
+ heuristic_first_max_tier: "SIMPLE",
+ classifier_llm_config: llmConfig,
+ },
+ ],
+ [
+ "llm falling back to the scorer",
+ {
+ ...defaultValue,
+ classifier_type: "llm" as const,
+ classifier_llm_config: llmConfig,
+ classifier_fallback: "heuristic" as const,
+ },
+ ],
+ ])("offers the keywords on a router whose scorer runs: %s", (_label, value) => {
+ openClassificationPanel(value);
+ expect(screen.getByText("Custom Technical Keywords")).toBeInTheDocument();
+ });
+
+ it("hides the keywords when the scorer never runs, so they cannot imply an effect they have none", () => {
+ openClassificationPanel({
+ ...defaultValue,
+ classifier_type: "llm",
+ classifier_llm_config: llmConfig,
+ classifier_fallback: "default_model",
+ });
+ expect(screen.queryByText("Custom Technical Keywords")).not.toBeInTheDocument();
+ });
+});