workernode is inited with llm tools and vectorstoe

main
Kye 2 years ago
parent c0b79c04dd
commit c936aaa82e

@ -10,12 +10,12 @@ class WorkerNode(BaseTool):
"""Useful for when you need to spawn an autonomous agent instance as a worker to accomplish complex tasks, it can search the internet or spawn child multi-modality models to process and generate images and text or audio and so on """
name = "WorkerNode"
description = "A worker node that can perform complex tasks"
def __init__(self, llm, tools, vectorstore):
super().__init__()
self.llm = llm
self.tools = tools
self.vectorstore = vectorstore
llm: Any = Field(description="Language model")
tools: List[Tool] = Field(description="List of tools")
vectorstore: VectorStore = Field(description="Vector store")
def __init__(self, **data):
super().__init__(**data)
def create_agent(self, ai_name, ai_role, human_in_the_loop, search_kwargs):
self.agent = AutoGPT.from_llm_and_tools(

@ -32,13 +32,7 @@ class Swarms:
return FAISS(embeddings_model.embed_query, index, InMemoryDocstore({}), {})
def initialize_worker_node(self, llm, tools, vectorstore):
worker_node = WorkerNode(
llm=llm,
tools=tools,
vectorstore=vectorstore,
name="WorkerNode",
description="A worker node that can perform complex tasks"
)
worker_node = WorkerNode(llm=llm, tools=tools, vectorstore=vectorstore)
worker_node.create_agent(ai_name="AI Assistant", ai_role="Assistant", human_in_the_loop=False, search_kwargs={})
return worker_node

Loading…
Cancel
Save