raiseValueError("API key must be providef either as argument as an env named 'api_key'")
ifnotllm:
raiseValueError("Language model must be provided")
ifnotvectorstore:
raiseValueError("Vectorstore must be provided")
ifnotagent_executor:
raiseValueError('Agent Executor must be provided')
raiseValueError("API key must be provided either as argument or as an environment variable named 'API_KEY'.")
llm=BossNode.initialize_llm(llm_class)# This function should be defined elsewhere
todo_prompt=PromptTemplate.from_template("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 a 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 a worker agent after creating a plan and pass the objective and plan to the worker agent.")
todo_chain=LLMChain(llm=llm,prompt=todo_prompt)
tools=[
Tool(name="TODO",func=todo_chain.run,description="useful for when you need to come up with todo lists. Input: an objective to create a todo list for your objective. Note create a todo list then assign a ranking from 0.0 to 1.0 to each task, then sort the tasks based on the tasks most likely to achieve the objective. The Output: a todo list for that objective with rankings for each step from 0.1 Please be very clear what the objective is!"),
worker_node
]
suffix="""Question: {task}\n{agent_scratchpad}"""
prefix="""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"""