pull/12/head
Kye 2 years ago
parent 641d59731e
commit f85d415b1a

@ -36,12 +36,15 @@ class Swarms:
except Exception as e: except Exception as e:
logging.error(f"Failed to initialize language model: {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 Init tools
Params: Params:
llm_class (class): The Language model class. Default is OpenAI llm_class (class): The Language model class. Default is OpenAI
extra_tools = [CustomTool()]
worker_tools = swarms.initialize_tools(OpenAI, extra_tools)
""" """
try: try:
llm = self.initialize_llm(llm_class) llm = self.initialize_llm(llm_class)
@ -56,6 +59,11 @@ class Swarms:
WebpageQATool(qa_chain=load_qa_with_sources_chain(llm)), 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" assert tools is not None, "tools is not initialized"
return tools return tools

Loading…
Cancel
Save