From 44aab7f91c350b1c6ecb77a7a34efb98af106cb5 Mon Sep 17 00:00:00 2001 From: Ravi Theja Date: Thu, 5 Jun 2025 15:51:47 +0530 Subject: [PATCH] oai: fix openAI client error with single request via batch api (#6170) Co-authored-by: Ravi Theja Desetty --- python/sglang/srt/openai_api/adapter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/openai_api/adapter.py b/python/sglang/srt/openai_api/adapter.py index 9daca7588..0c8a9a972 100644 --- a/python/sglang/srt/openai_api/adapter.py +++ b/python/sglang/srt/openai_api/adapter.py @@ -1395,7 +1395,9 @@ def v1_chat_generate_response( "id": ret[i]["meta_info"]["id"], "object": "chat.completion", "created": created, - "model": request[i].model, + "model": ( + request[i].model if isinstance(request, list) else request.model + ), "choices": choice, "usage": { "prompt_tokens": ret[i]["meta_info"]["prompt_tokens"],