From 75a8105eef818488ee015761a01103094d1d1c6d Mon Sep 17 00:00:00 2001 From: Lalit Kumar Jena Date: Wed, 16 Aug 2023 14:21:00 +0530 Subject: [PATCH] External tools, marketplace tools fix --- superagi/agent/tool_builder.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/superagi/agent/tool_builder.py b/superagi/agent/tool_builder.py index 33a0395de..1801047a1 100644 --- a/superagi/agent/tool_builder.py +++ b/superagi/agent/tool_builder.py @@ -1,5 +1,5 @@ import importlib - +import os from superagi.config.config import get_config from superagi.llms.llm_model_factory import get_model from superagi.models.tool import Tool @@ -58,9 +58,11 @@ def build_tool(self, tool: Tool): """ file_name = self.__validate_filename(filename=tool.file_name) - tools_dir = get_config("TOOLS_DIR") - if tools_dir is None: - tools_dir = "superagi/tools" + tool_paths = ["superagi/tools", "superagi/tools/external_tools", "superagi/tools/marketplace_tools"] + for tool_path in tool_paths: + if os.path.exists(os.path.join(os.getcwd(), tool_path) + '/' + tool.folder_name): + tools_dir = tool_path + break parsed_tools_dir = tools_dir.rstrip("/") module_name = ".".join(parsed_tools_dir.split("/") + [tool.folder_name, file_name])