mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
* feat(complexity_router): let operators rename the four complexity tiers Adds an optional tier_labels map to complexity_router_config so a deployment can put its own vocabulary on the four tiers, e.g. Cheap / Standard / Premium / Deep, instead of reading SIMPLE / MEDIUM / COMPLEX / REASONING in its dashboard, its spend logs, and the rubric the LLM classifier reasons with. Labels are display-only. Every config key stays canonical, so tiers, keyword_tier_rules[].tier, and tier_boundaries are written exactly as they are without labels, and partial maps are fine with unlisted tiers keeping their default name. A validator rejects blank labels, two tiers sharing a label, and a label that is another tier's canonical name, since any of those would make a log row or a rubric line ambiguous. That validator runs on the /model/new and /model/update write path already, so an ambiguous config gets a 400 rather than being stored for the router to refuse later. Under the default heuristic scorer the names are cosmetic: the scorer maps a weighted score to a rung and never reads a tier name, verified by running the eval corpus with and without a rename and getting identical tier and identical score on all 29 cases. Under classifier_type: llm the labels are the names in the rubric and the values the classifier must return, so the response format's enum is now built from the configured labels and a reply is resolved back to its tier against labels first, then canonical names, case-insensitively. An unresolvable reply degrades to the heuristic on the existing fallback path. A test pins the generated schema for an unrenamed deployment as equal to the shipped TierClassification schema, so the wire shape can't drift. Spend logs keep routing_decision.tier canonical so rows from before and after a rename stay comparable, and gain routing_decision.tier_label on the tiers that were renamed. * refactor(complexity_router): drop added comments and the Counter construction Review feedback: the repository guide bans new comments, so the explanatory comments and the appended docstring paragraphs this branch added come back out. One-line docstrings stay in complexity_router.py, matching that file's own convention. The duplicate-label check no longer builds a Counter, which the mutable-collection budget counts, and the error text drops its list() reprs for joined strings. The labels are stripped in tier_label() now rather than by rewriting the field in the validator, so the stored config keeps exactly what the operator wrote. schema.d.ts is regenerated: ComplexityRouterConfig is exposed in the OpenAPI spec, so tier_labels surfaces there. * fix(ui): carry tier_labels through the auto-router preset prefill buildPresetPrefill maps every payload key onto form state, but the tier_labels key added by this branch had no line, so a preset shipping labels would apply its tiers and silently drop its names. |
||
|---|---|---|
| .. | ||
| litellm-dashboard | ||
| Dockerfile | ||
| nginx.conf | ||