[Bugfix] fix tool call arguments is empty (#25223)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
Co-authored-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
Chauncey
2025-09-20 13:29:54 +08:00
committed by GitHub
parent 6c5f82e5aa
commit f91480b2d4
2 changed files with 65 additions and 3 deletions

View File

@@ -1450,9 +1450,11 @@ def _postprocess_messages(messages: list[ConversationMessage]) -> None:
and isinstance(message["tool_calls"], list)
):
for item in message["tool_calls"]:
item["function"]["arguments"] = json.loads(
item["function"]["arguments"]
)
# if arguments is None or empty string, set to {}
if content := item["function"].get("arguments"):
item["function"]["arguments"] = json.loads(content)
else:
item["function"]["arguments"] = {}
def parse_chat_messages(