[Frontend] Added chat-style multimodal support to /classify. (#27516)

Signed-off-by: WorldExplored <srreyansh.sethi@gmail.com>
Signed-off-by: Srreyansh Sethi <107075589+WorldExplored@users.noreply.github.com>
Signed-off-by: vnadathur <glvikramn@gmail.com>
Signed-off-by: wang.yuqi <yuqi.wang@daocloud.io>
Co-authored-by: vnadathur <236933696+vnadathur@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: vnadathur <glvikramn@gmail.com>
Co-authored-by: wang.yuqi <noooop@126.com>
Co-authored-by: wang.yuqi <yuqi.wang@daocloud.io>
This commit is contained in:
Srreyansh Sethi
2025-11-14 11:03:55 +00:00
committed by GitHub
co-authored by vnadathur gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> vnadathur wang.yuqi wang.yuqi
parent ecf8230d4d
commit 360bd8762f
6 changed files with 318 additions and 27 deletions
+16 -5
View File
@@ -43,6 +43,8 @@ from vllm.entrypoints.openai.protocol import (
ChatCompletionNamedToolChoiceParam,
ChatCompletionRequest,
ChatCompletionResponse,
ClassificationChatRequest,
ClassificationCompletionRequest,
ClassificationRequest,
ClassificationResponse,
CompletionRequest,
@@ -114,13 +116,16 @@ CompletionLikeRequest: TypeAlias = (
| DetokenizeRequest
| EmbeddingCompletionRequest
| RerankRequest
| ClassificationRequest
| ClassificationCompletionRequest
| ScoreRequest
| TokenizeCompletionRequest
)
ChatLikeRequest: TypeAlias = (
ChatCompletionRequest | EmbeddingChatRequest | TokenizeChatRequest
ChatCompletionRequest
| EmbeddingChatRequest
| TokenizeChatRequest
| ClassificationChatRequest
)
SpeechToTextRequest: TypeAlias = TranscriptionRequest | TranslationRequest
AnyRequest: TypeAlias = (
@@ -814,7 +819,11 @@ class OpenAIServing:
if not hasattr(request, "messages"):
return message_types
for message in request.messages:
messages = request.messages
if messages is None or isinstance(messages, (str, bytes)):
return message_types
for message in messages:
if (
isinstance(message, dict)
and "content" in message
@@ -907,7 +916,8 @@ class OpenAIServing:
EmbeddingCompletionRequest,
ScoreRequest,
RerankRequest,
ClassificationRequest,
ClassificationCompletionRequest,
ClassificationChatRequest,
),
):
# Note: input length can be up to the entire model context length
@@ -915,7 +925,8 @@ class OpenAIServing:
if token_num > self.max_model_len:
operations: dict[type[AnyRequest], str] = {
ScoreRequest: "score",
ClassificationRequest: "classification",
ClassificationCompletionRequest: "classification",
ClassificationChatRequest: "classification",
}
operation = operations.get(type(request), "embedding generation")
raise ValueError(