diff --git a/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py b/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py index 2fd0c4ec1f..734cf28b15 100644 --- a/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py +++ b/api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py @@ -377,10 +377,7 @@ class OAIAPICompatLargeLanguageModel(_CommonOaiApiCompat, LargeLanguageModel): for tool in tools: formatted_tools.append(helper.dump_model(PromptMessageFunction(function=tool))) - if prompt_messages[-1].role.value == "tool": - data["tools"] = None - else: - data["tools"] = formatted_tools + data["tools"] = formatted_tools if stop: data["stop"] = stop