From 1c421f3578f12cc3e6bc8a761f5d7e7ed2d4938e Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 22 Aug 2026 11:36:24 -0700 Subject: [PATCH] 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. --- .../playground/components/chat_ui/EndpointUtils.test.tsx | 7 +++++++ .../src/components/chat_ui/mode_endpoint_mapping.tsx | 2 ++ 2 files changed, 9 insertions(+) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/EndpointUtils.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/EndpointUtils.test.tsx index 778effdaea6..c528071fa8a 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/EndpointUtils.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/chat_ui/EndpointUtils.test.tsx @@ -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" }; diff --git a/ui/litellm-dashboard/src/components/chat_ui/mode_endpoint_mapping.tsx b/ui/litellm-dashboard/src/components/chat_ui/mode_endpoint_mapping.tsx index 18e44e06efe..930ded5d1a5 100644 --- a/ui/litellm-dashboard/src/components/chat_ui/mode_endpoint_mapping.tsx +++ b/ui/litellm-dashboard/src/components/chat_ui/mode_endpoint_mapping.tsx @@ -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.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,