mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(ui): keep completion-mode models in the playground chat dropdown (#37954)
PR #36130 added a KNOWN_MODEL_MODES guard to isModelCompatibleWithEndpoint that hides any model whose mode isn't in the ModelMode enum, to keep rerank/ocr/batch/etc. models out of chat-style endpoints. mode: completion (legacy text-completion models) wasn't in that enum, so it got caught by the same guard and disappeared from every endpoint, including chat, where it routes fine. Add ModelMode.COMPLETION and map it to EndpointType.CHAT like the other chat-compatible modes.
This commit is contained in:
parent
28887f12c5
commit
1c421f3578
2 changed files with 9 additions and 0 deletions
|
|
@ -247,6 +247,13 @@ describe("isModelCompatibleWithEndpoint / filterModelsForEndpoint", () => {
|
|||
expect(isModelCompatibleWithEndpoint(batchModel, EndpointType.REALTIME)).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps completion-mode models for the chat endpoint", () => {
|
||||
const completionModel: ModelGroup = { model_group: "davinci-002", mode: "completion" };
|
||||
expect(isModelCompatibleWithEndpoint(completionModel, EndpointType.CHAT)).toBe(true);
|
||||
expect(isModelCompatibleWithEndpoint(completionModel, EndpointType.RESPONSES)).toBe(true);
|
||||
expect(isModelCompatibleWithEndpoint(completionModel, EndpointType.SPEECH)).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps image-edit models for the image-edits endpoint using the mode the backend sends", () => {
|
||||
const imageEditModel: ModelGroup = { model_group: "gpt-image-1", mode: "image_edit" };
|
||||
const imageModel: ModelGroup = { model_group: "dall-e-3", mode: "image_generation" };
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export enum ModelMode {
|
|||
IMAGE_GENERATION = "image_generation",
|
||||
VIDEO_GENERATION = "video_generation",
|
||||
CHAT = "chat",
|
||||
COMPLETION = "completion",
|
||||
RESPONSES = "responses",
|
||||
IMAGE_EDITS = "image_edit",
|
||||
ANTHROPIC_MESSAGES = "anthropic_messages",
|
||||
|
|
@ -36,6 +37,7 @@ export const litellmModeMapping: Record<ModelMode, EndpointType> = {
|
|||
[ModelMode.IMAGE_GENERATION]: EndpointType.IMAGE,
|
||||
[ModelMode.VIDEO_GENERATION]: EndpointType.VIDEO,
|
||||
[ModelMode.CHAT]: EndpointType.CHAT,
|
||||
[ModelMode.COMPLETION]: EndpointType.CHAT,
|
||||
[ModelMode.RESPONSES]: EndpointType.RESPONSES,
|
||||
[ModelMode.IMAGE_EDITS]: EndpointType.IMAGE_EDITS,
|
||||
[ModelMode.ANTHROPIC_MESSAGES]: EndpointType.ANTHROPIC_MESSAGES,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue