From 678416aa8497fef91c1c580431164fd54d85ef22 Mon Sep 17 00:00:00 2001 From: Kye Date: Fri, 30 Jun 2023 15:07:53 -0400 Subject: [PATCH] organized tools --- swarms/agents/swarms.py | 13 +------------ swarms/tools/main.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/swarms/agents/swarms.py b/swarms/agents/swarms.py index 7364f128..70a7190f 100644 --- a/swarms/agents/swarms.py +++ b/swarms/agents/swarms.py @@ -68,7 +68,7 @@ from langchain.tools.human.tool import HumanInputRun from swarms.agents.workers.auto_agent import MultiModalVisualAgent from swarms.tools.main import Terminal, CodeWriter, CodeEditor, process_csv, WebpageQATool - +from swarms.tools.main import math_tool llm = ChatOpenAI(model_name="gpt-4", temperature=1.0, openai_api_key="") @@ -97,17 +97,6 @@ web_search = DuckDuckGoSearchRun() multimodal_agent_tool = MultiModalVisualAgentTool(MultiModalVisualAgent) -#======> Calculator -from langchain import LLMMathChain - -llm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=True) -math_tool = Tool( - name="Calculator", - func=llm_math_chain.run, - description="useful for when you need to answer questions about math" - ), - - tools = [ diff --git a/swarms/tools/main.py b/swarms/tools/main.py index a244b691..f17781ea 100644 --- a/swarms/tools/main.py +++ b/swarms/tools/main.py @@ -2260,3 +2260,19 @@ class TranscribeAudioTool(BaseTool): ) -> str: """Use the tool asynchronously.""" raise NotImplementedError("transcribe_audio does not support async") + + + +###########=========================> + +#======> Calculator +from langchain import LLMMathChain + +llm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=True) +math_tool = Tool( + name="Calculator", + func=llm_math_chain.run, + description="useful for when you need to answer questions about math" + ), + +