From 9896a1680b28de26de0334626404dad1068e5fbe Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 23 Apr 2026 13:00:56 +0000 Subject: [PATCH] feat(ui): add_model/ComplexityRouterConfig to shadcn - antd Select/Card/Divider/Space/Tooltip/Typography + @ant-design InfoCircleOutlined \u2192 shadcn Select/Card/Tooltip + lucide Info + native
and plain h4/p. - Preserves the full four-tier mapping layout and help card. Gates: TS \u2713 | Build \u2713. Co-authored-by: yuneng-jiang --- .../add_model/ComplexityRouterConfig.tsx | 163 +++++++++++------- 1 file changed, 104 insertions(+), 59 deletions(-) diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx index a20cb969e33..705a0d0058f 100644 --- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx @@ -1,10 +1,21 @@ -import { InfoCircleOutlined } from "@ant-design/icons"; -import { Select as AntdSelect, Card, Divider, Space, Tooltip, Typography } from "antd"; +import { Card } from "@/components/ui/card"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Info } from "lucide-react"; import React from "react"; import { ModelGroup } from "../playground/llm_calls/fetch_models"; -const { Text } = Typography; - interface ComplexityTiers { SIMPLE: string; MEDIUM: string; @@ -18,7 +29,10 @@ interface ComplexityRouterConfigProps { onChange: (tiers: ComplexityTiers) => void; } -const TIER_DESCRIPTIONS: Record = { +const TIER_DESCRIPTIONS: Record< + keyof ComplexityTiers, + { label: string; description: string; examples: string } +> = { SIMPLE: { label: "Simple", description: "Basic questions, greetings, simple factual queries", @@ -32,7 +46,8 @@ const TIER_DESCRIPTIONS: Record = ({ modelInfo, value, onChange }) => { - // Prepare model options for dropdowns +const ComplexityRouterConfig: React.FC = ({ + modelInfo, + value, + onChange, +}) => { const modelOptions = modelInfo.map((model) => ({ value: model.model_group, label: model.model_group, @@ -57,64 +75,90 @@ const ComplexityRouterConfig: React.FC = ({ modelIn return (
- - +
+

Complexity Tier Configuration - - - - - +

+ + + + + + + Map each complexity tier to a model. Simple queries use + cheaper/faster models, complex queries use more capable models. + + + +
- - The complexity router automatically classifies requests by complexity using rule-based scoring (no API calls, - <1ms latency). Configure which model handles each tier. - +

+ The complexity router automatically classifies requests by complexity + using rule-based scoring (no API calls, <1ms latency). Configure + which model handles each tier. +

- - {(Object.keys(TIER_DESCRIPTIONS) as Array).map((tier, index) => { - const tierInfo = TIER_DESCRIPTIONS[tier]; - return ( -
- {index > 0 && } -
-
- - {tierInfo.label} Tier - - - - + + {(Object.keys(TIER_DESCRIPTIONS) as Array).map( + (tier, index) => { + const tierInfo = TIER_DESCRIPTIONS[tier]; + return ( +
+ {index > 0 &&
} +
+
+ + {tierInfo.label} Tier + + + + + + + + {tierInfo.description} + + + +
+

+ Examples: {tierInfo.examples} +

+
- - Examples: {tierInfo.examples} - - handleTierChange(tier, model)} - placeholder={`Select model for ${tierInfo.label.toLowerCase()} queries`} - showSearch - style={{ width: "100%" }} - options={modelOptions} - />
-
- ); - })} + ); + }, + )} - +
- - - How Classification Works - - - The router scores each request across 7 dimensions: token count, code presence, reasoning markers, technical - terms, simple indicators, multi-step patterns, and question complexity. The weighted score determines the - tier: - -
    + +

    How Classification Works

    +

    + The router scores each request across 7 dimensions: token count, code + presence, reasoning markers, technical terms, simple indicators, + multi-step patterns, and question complexity. The weighted score + determines the tier: +

    +
    • SIMPLE: Score < 0.15
    • @@ -125,7 +169,8 @@ const ComplexityRouterConfig: React.FC = ({ modelIn COMPLEX: Score 0.35 - 0.60
    • - REASONING: Score > 0.60 (or 2+ reasoning markers) + REASONING: Score > 0.60 (or 2+ reasoning + markers)