Former-commit-id: 1d022f4fe9af3853e0825adbf499f1d4a9133157
pull/160/head
Kye 2 years ago
parent f2533b3f1e
commit c94b169a44

@ -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

Loading…
Cancel
Save