worker_name:Optional[str]="Swarm Worker AI Assistant",
human_in_the_loop:Optional[bool]=True,
boss_prompt:Optional[str]=None,
boss_prompt:Optional[str]="You are an Boss in a swarm who performs one task based on the following objective: {objective}. Take into account these previously completed tasks: {context}.\n",
worker_prompt:Optional[str]=None,
temperature:Optional[float]=None,
@ -132,23 +131,11 @@ class HierarchicalSwarm:
logging.error(f"Failed to initialize vector store: {e}")
returnNone
definitialize_worker_node(self,worker_tools,vectorstore,llm_class=ChatOpenAI,ai_name="Swarm Worker AI Assistant",):
worker_node_tool=Tool(name="WorkerNode AI Agent",func=worker_node.run,description=worker_descriptionor"Input: an objective with a todo list for that objective. Output: your task completed: Please be very clear what the objective and task instructions are. The Swarm worker agent is Useful for when you need to spawn an autonomous agent instance as a worker to accomplish any complex tasks, it can search the internet or write code or spawn child multi-modality models to process and generate images and text or audio and so on")
returnworker_node_tool
exceptExceptionase:
@ -173,7 +160,7 @@ class HierarchicalSwarm:
llm=self.initialize_llm(llm_class)
# prompt = self.boss_prompt
todo_prompt=PromptTemplate.from_template({self.boss_prompt}or"You are a boss planer in a swarm who is an expert at coming up with a todo list for a given objective and then creating an worker to help you accomplish your task. Rate every task on the importance of it's probability to complete the main objective on a scale from 0 to 1, an integer. Come up with a todo list for this objective: {objective} and then spawn a worker agent to complete the task for you. Always spawn an worker agent after creating a plan and pass the objective and plan to the worker agent.")