From ed9db29cf3261e1a736f92fc3c8d4cf7425c613e Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 20 Jul 2023 10:58:31 -0400 Subject: [PATCH] clean up Former-commit-id: f85d415b1a5ef55358d7451f3f50b4a2b5f45a1b --- swarms/swarms.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/swarms/swarms.py b/swarms/swarms.py index 2b7bc849..bb0c86d4 100644 --- a/swarms/swarms.py +++ b/swarms/swarms.py @@ -36,12 +36,15 @@ class Swarms: except Exception as e: logging.error(f"Failed to initialize language model: {e}") - def initialize_tools(self, llm_class): + def initialize_tools(self, llm_class, extra_tools=None): """ Init tools Params: llm_class (class): The Language model class. Default is OpenAI + + extra_tools = [CustomTool()] + worker_tools = swarms.initialize_tools(OpenAI, extra_tools) """ try: llm = self.initialize_llm(llm_class) @@ -56,6 +59,11 @@ class Swarms: WebpageQATool(qa_chain=load_qa_with_sources_chain(llm)), ] + if extra_tools: + tools.extend(extra_tools) + + + assert tools is not None, "tools is not initialized" return tools