From f7f88b706cd76e5ce8f2c5f69940de8cad239fb4 Mon Sep 17 00:00:00 2001 From: David Carreto Fidalgo Date: Thu, 13 Mar 2025 06:04:29 +0100 Subject: [PATCH] HotFix: json serialization error when using OAI v1/batches endpoint with logprobs (#3896) --- python/sglang/srt/openai_api/adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/sglang/srt/openai_api/adapter.py b/python/sglang/srt/openai_api/adapter.py index a8c6167a9..7d3076a07 100644 --- a/python/sglang/srt/openai_api/adapter.py +++ b/python/sglang/srt/openai_api/adapter.py @@ -1147,7 +1147,7 @@ def v1_chat_generate_response( "tool_calls": tool_calls, "reasoning_content": reasoning_text, }, - "logprobs": choice_logprobs, + "logprobs": choice_logprobs.model_dump() if choice_logprobs else None, "finish_reason": (finish_reason["type"] if finish_reason else ""), "matched_stop": ( finish_reason["matched"]