Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External tools, marketplace tools fix #1058

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions superagi/agent/tool_builder.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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])

Expand Down