From e4542215ccc51d14e9e8b6f707a9dbbfd607a0aa Mon Sep 17 00:00:00 2001 From: Joe <79627742+ZhouhaoJiang@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:10:13 +0800 Subject: [PATCH] fix: tongyi empty tool_calls is not supported in message (#6719) --- api/core/model_runtime/model_providers/tongyi/llm/llm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/core/model_runtime/model_providers/tongyi/llm/llm.py b/api/core/model_runtime/model_providers/tongyi/llm/llm.py index 1f018c4078..6f768131fb 100644 --- a/api/core/model_runtime/model_providers/tongyi/llm/llm.py +++ b/api/core/model_runtime/model_providers/tongyi/llm/llm.py @@ -501,8 +501,7 @@ You should also complete the text started with ``` but not tell ``` directly. 'role': 'assistant', 'content': content if not rich_content else [{"text": content}], 'tool_calls': [tool_call.model_dump() for tool_call in - prompt_message.tool_calls] if prompt_message.tool_calls else [] - + prompt_message.tool_calls] if prompt_message.tool_calls else None }) elif isinstance(prompt_message, ToolPromptMessage): tongyi_messages.append({