From 0fcdfa3c598f07eba01c86a42408db7fe226e2d5 Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 3 Aug 2023 10:57:21 -0400 Subject: [PATCH] __init__ imports for tools to seamlessly import Former-commit-id: 6a335b0c2ee858065c0088588d63cc9354764230 --- swarms/agents/__init__.py | 8 +++++ swarms/agents/tools/__init__.py | 9 ++++++ swarms/agents/tools/developer.py | 39 ++++++++++++------------- swarms/agents/tools/file_mangagement.py | 6 ++-- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/swarms/agents/__init__.py b/swarms/agents/__init__.py index 6ee43d6d..42200420 100644 --- a/swarms/agents/__init__.py +++ b/swarms/agents/__init__.py @@ -6,4 +6,12 @@ #tools +from swarms.agents.tools.base import BaseTool, Tool, StructuredTool, ToolWrapper, BaseToolSet, ToolCreator, GlobalToolsCreator, SessionToolsCreator, ToolsFactory +from swarms.agents.tools.autogpt import pushd, process_csv, async_load_playwright, run_async, browse_web_page, WebpageQATool, web_search +from swarms.agents.tools.exit_conversation import ExitConversation +from swarms.agents.tools.models import MaskFormer, ImageEditing, InstructPix2Pix, Text2Image, VisualQuestionAnswering, ImageCaptioning +from swarms.agents.tools.file_mangagement import read_tool, write_tool, list_tool +from swarms.agents.tools.requests import RequestsGet + +from swarms.agents.tools.developer import Terminal, CodeEditor \ No newline at end of file diff --git a/swarms/agents/tools/__init__.py b/swarms/agents/tools/__init__.py index e69de29b..b59c3951 100644 --- a/swarms/agents/tools/__init__.py +++ b/swarms/agents/tools/__init__.py @@ -0,0 +1,9 @@ +from swarms.agents.tools.base import BaseTool, Tool, StructuredTool, ToolWrapper, BaseToolSet, ToolCreator, GlobalToolsCreator, SessionToolsCreator, ToolsFactory +from swarms.agents.tools.autogpt import pushd, process_csv, async_load_playwright, run_async, browse_web_page, WebpageQATool, web_search +from swarms.agents.tools.exit_conversation import ExitConversation + +from swarms.agents.tools.models import MaskFormer, ImageEditing, InstructPix2Pix, Text2Image, VisualQuestionAnswering, ImageCaptioning +from swarms.agents.tools.file_mangagement import read_tool, write_tool, list_tool +from swarms.agents.tools.requests import RequestsGet + +from swarms.agents.tools.developer import Terminal, CodeEditor \ No newline at end of file diff --git a/swarms/agents/tools/developer.py b/swarms/agents/tools/developer.py index 1d89c93d..d4de96d1 100644 --- a/swarms/agents/tools/developer.py +++ b/swarms/agents/tools/developer.py @@ -781,23 +781,23 @@ class CodeEditor(BaseToolSet): ) return output - # @tool( - # name="CodeEditor.PATCH", - # description="Patch the code to correct the error if an error occurs or to improve it. " - # "Input is a list of patches. The patch is separated by {seperator}. ".format( - # seperator=CodePatcher.separator.replace("\n", "\\n") - # ) - # + "Each patch has to be formatted like below.\n" - # "|,|,|" - # "Here is an example. If the original code is:\n" - # "print('hello world')\n" - # "and you want to change it to:\n" - # "print('hi corca')\n" - # "then the patch should be:\n" - # "test.py|1,8|1,19|hi corca\n" - # "Code between start and end will be replaced with new_code. " - # "The output will be written/deleted bytes or error message. ", - # ) + @tool( + name="CodeEditor.PATCH", + description="Patch the code to correct the error if an error occurs or to improve it. " + "Input is a list of patches. The patch is separated by {seperator}. ".format( + seperator=CodePatcher.separator.replace("\n", "\\n") + ) + + "Each patch has to be formatted like below.\n" + "|,|,|" + "Here is an example. If the original code is:\n" + "print('hello world')\n" + "and you want to change it to:\n" + "print('hi corca')\n" + "then the patch should be:\n" + "test.py|1,8|1,19|hi corca\n" + "Code between start and end will be replaced with new_code. " + "The output will be written/deleted bytes or error message. ", + ) def patch(self, patches: str) -> str: try: w, d = CodePatcher.patch(patches) @@ -831,7 +831,4 @@ class CodeEditor(BaseToolSet): f"Output Answer: {output}" ) return output - -###################### EDITOR// INIT.PY END - - + \ No newline at end of file diff --git a/swarms/agents/tools/file_mangagement.py b/swarms/agents/tools/file_mangagement.py index 92389397..1637a6a8 100644 --- a/swarms/agents/tools/file_mangagement.py +++ b/swarms/agents/tools/file_mangagement.py @@ -17,8 +17,8 @@ file_management_tools = FileManagementToolkit( ).get_tools() read_tool, write_tool, list_tool = file_management_tools -write_tool.run({"file_path": "example.txt", "text": "Hello World!"}) +# write_tool.run({"file_path": "example.txt", "text": "Hello World!"}) -# List files in the working directory -list_tool.run({}) +# # List files in the working directory +# list_tool.run({})