mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
test(ui): align auto-router preset tests with bundled preset models
The Auto Router preset JSON added in #35746 was bundled with newer models (claude-sonnet-5, gpt-5.4-*, latest opus/haiku), but the tests still expected the older names (claude-sonnet-4-5, gpt-5-nano/mini). The two lists never matched, so every Anthropic-family preset test in add_auto_router_tab kept the option disabled, and autorouter_presets' version-separator test reported claude-sonnet-5 as missing when the caller Set only spelled it 4.5. Point ALL_FAMILY_MODELS and the tier-summary/default-model expectations at the models the preset actually names, and swap the sonnet entry in the separator-normalization test for claude-sonnet-5 (the haiku entry still exercises the dot-vs-dash path against the preset's claude-haiku-4-5). Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
parent
420d9a7e9f
commit
79b41a6f5b
2 changed files with 13 additions and 10 deletions
|
|
@ -11,11 +11,11 @@ import { ModelGroup } from "@/components/llm_calls/fetch_models";
|
|||
// either preset; dropping any one greys out the preset that names it.
|
||||
const ALL_FAMILY_MODELS: ModelGroup[] = [
|
||||
{ model_group: "claude-haiku-4-5", mode: "chat" },
|
||||
{ model_group: "claude-sonnet-4-5", mode: "chat" },
|
||||
{ model_group: "claude-sonnet-5", mode: "chat" },
|
||||
{ model_group: "claude-opus-5", mode: "chat" },
|
||||
{ model_group: "gpt-5-nano", mode: "chat" },
|
||||
{ model_group: "gpt-5-mini", mode: "chat" },
|
||||
{ model_group: "gpt-5", mode: "chat" },
|
||||
{ model_group: "gpt-5.4-nano", mode: "chat" },
|
||||
{ model_group: "gpt-5.4-mini", mode: "chat" },
|
||||
{ model_group: "gpt-5.4", mode: "chat" },
|
||||
{ model_group: "o3", mode: "chat" },
|
||||
];
|
||||
|
||||
|
|
@ -382,7 +382,7 @@ describe("AddAutoRouterTab", () => {
|
|||
expect(screen.queryByText("Advanced: Keyword/Semantic Matching")).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText(
|
||||
"Simple: claude-haiku-4-5 · Medium: claude-sonnet-4-5 · Complex: claude-opus-5 · Reasoning: claude-opus-5",
|
||||
"Simple: claude-haiku-4-5 · Medium: claude-sonnet-5 · Complex: claude-opus-5 · Reasoning: claude-opus-5",
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
|
@ -424,11 +424,11 @@ describe("AddAutoRouterTab", () => {
|
|||
|
||||
await waitFor(() => expect(handleAddAutoRouterSubmit).toHaveBeenCalled());
|
||||
expect(vi.mocked(handleAddAutoRouterSubmit).mock.calls.at(-1)?.[0]).toMatchObject({
|
||||
auto_router_default_model: "claude-sonnet-4-5",
|
||||
auto_router_default_model: "claude-sonnet-5",
|
||||
complexity_router_config: {
|
||||
tiers: {
|
||||
SIMPLE: ["claude-haiku-4-5"],
|
||||
MEDIUM: ["claude-sonnet-4-5"],
|
||||
MEDIUM: ["claude-sonnet-5"],
|
||||
COMPLEX: ["claude-opus-5"],
|
||||
REASONING: ["claude-opus-5"],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -57,12 +57,15 @@ describe("autorouter_presets", () => {
|
|||
expect(getMissingModelsInPreset(preset, new Set(required))).toEqual([]);
|
||||
});
|
||||
|
||||
// Admins spell version numbers with either "-" or "." (claude-sonnet-4-5 vs claude-sonnet-4.5);
|
||||
// a caller who only registered one form still satisfies a preset that names the other.
|
||||
// Admins spell version numbers with either "-" or "." (claude-haiku-4-5 vs claude-haiku-4.5);
|
||||
// a caller who only registered one form still satisfies a preset that names the other. Only the
|
||||
// haiku entry actually differs by separator here (sonnet/opus have no dot-digit pattern in the
|
||||
// preset), but that's enough to prove the normalization is applied against a real preset rather
|
||||
// than only via getMissingModels directly.
|
||||
it("treats a preset's model as available under either version-separator spelling", () => {
|
||||
const preset = getPresetByKey("anthropic_family")!;
|
||||
expect(
|
||||
getMissingModelsInPreset(preset, new Set(["claude-haiku-4.5", "claude-sonnet-4.5", "claude-opus-5"])),
|
||||
getMissingModelsInPreset(preset, new Set(["claude-haiku-4.5", "claude-sonnet-5", "claude-opus-5"])),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue