mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
Adds a top-level classifier_plugins config key mapping names to dotted paths, resolved at startup into litellm.classifier_plugin_registry with the same load-time checks classifier_plugin already gets. A before-validator on ComplexityRouterConfig.classifier_plugin resolves string values through the registry, so the save-time write gate, router deployment init, and direct construction all accept a registered name and reject an unknown one with a clean error; DB-stored auto-routers therefore carry plain names and no proxy read path changes. GET /auto_router/classifier_plugins lists the names. The dashboard's classification method picker gains a Custom classifier option with a plugin dropdown fed by that endpoint, a plugin timeout field, and the fallback picker now shown for both non-heuristic modes. Create and edit serialize and validate identically, the models table labels custom routers correctly, and the routing decision card names the classifier_plugin cause and stops implying the LLM classifier failed on plugin fallbacks
17 lines
587 B
TypeScript
17 lines
587 B
TypeScript
import { vi } from "vitest";
|
|
|
|
/**
|
|
* Stubs the proxy's registered classifier plugin names for any test that renders the auto-router tree.
|
|
* Exported as a vi.fn so a test can override the query state, which is how the empty-registry and
|
|
* failed-fetch paths are covered.
|
|
*/
|
|
export const REGISTERED_CLASSIFIER_PLUGINS = ["spend-aware", "tier-by-team"];
|
|
|
|
export const LOADED_CLASSIFIER_PLUGINS_QUERY = {
|
|
data: REGISTERED_CLASSIFIER_PLUGINS,
|
|
isPending: false,
|
|
isError: false,
|
|
refetch: vi.fn(),
|
|
};
|
|
|
|
export const useClassifierPlugins = vi.fn(() => LOADED_CLASSIFIER_PLUGINS_QUERY);
|