mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(ui): exclude unknown model modes from playground endpoint filters
Modes outside ModelMode (batch, rerank, ocr, etc.) must not collapse to chat-compatible, or conversational endpoints surface unusable models
This commit is contained in:
parent
4b2781ccb3
commit
d635f44683
2 changed files with 15 additions and 1 deletions
|
|
@ -246,4 +246,12 @@ describe("isModelCompatibleWithEndpoint / filterModelsForEndpoint", () => {
|
|||
"no-mode",
|
||||
]);
|
||||
});
|
||||
|
||||
it("excludes unknown modes from conversational endpoints", () => {
|
||||
const batchModel: ModelGroup = { model_group: "batch-job", mode: "batch" };
|
||||
const rerankModel: ModelGroup = { model_group: "reranker", mode: "rerank" };
|
||||
expect(isModelCompatibleWithEndpoint(batchModel, EndpointType.CHAT)).toBe(false);
|
||||
expect(isModelCompatibleWithEndpoint(rerankModel, EndpointType.RESPONSES)).toBe(false);
|
||||
expect(isModelCompatibleWithEndpoint(batchModel, EndpointType.REALTIME)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { ModelGroup } from "@/components/llm_calls/fetch_models";
|
||||
import { EndpointType, getEndpointType } from "@/components/chat_ui/mode_endpoint_mapping";
|
||||
import { EndpointType, getEndpointType, ModelMode } from "@/components/chat_ui/mode_endpoint_mapping";
|
||||
|
||||
const KNOWN_MODEL_MODES = new Set<string>(Object.values(ModelMode));
|
||||
|
||||
export const determineEndpointType = (selectedModel: string, modelInfo: ModelGroup[]): EndpointType => {
|
||||
const selectedModelInfo = modelInfo.find((option) => option.model_group === selectedModel);
|
||||
|
|
@ -16,6 +18,10 @@ export const isModelCompatibleWithEndpoint = (model: ModelGroup, endpointType: E
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!KNOWN_MODEL_MODES.has(model.mode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const optionEndpoint = getEndpointType(model.mode);
|
||||
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue