From 1c7bcc55b86d6cb867072dfb890dec6c7e747a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Gallou=C3=A9dec?= <45557362+qgallouedec@users.noreply.github.com> Date: Wed, 19 Nov 2025 23:20:12 -0700 Subject: [PATCH] [Frontend] Allow parsed tool arguments (#28820) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- vllm/entrypoints/chat_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/entrypoints/chat_utils.py b/vllm/entrypoints/chat_utils.py index 3b722c2d9..03214c4d1 100644 --- a/vllm/entrypoints/chat_utils.py +++ b/vllm/entrypoints/chat_utils.py @@ -1437,7 +1437,8 @@ def _postprocess_messages(messages: list[ConversationMessage]) -> None: for item in message["tool_calls"]: # if arguments is None or empty string, set to {} if content := item["function"].get("arguments"): - item["function"]["arguments"] = json.loads(content) + if not isinstance(content, (dict, list)): + item["function"]["arguments"] = json.loads(content) else: item["function"]["arguments"] = {}