task="Create an accounting team to analyze crypto transactions, there must be 5 agents in the team with extremely extensive prompts. Make the prompts extremely detailed and specific and long and comprehensive. Make sure to include all the details of the task in the prompts."
task="Create an accounting team to analyze crypto transactions, there must be 5 agents in the team with extremely extensive prompts. Make the prompts extremely detailed and specific and long and comprehensive. Make sure to include all the details of the task in the prompts."
agent_description=f"You're the {name} agent that is responsible for reasoning about the task and creating a plan for the swarm to accomplish the task.",
# Executes the swarm on the given task. If correct_answer is provided, the method will retry until this answer is found in the output, up to max_loops times.
# If correct_answer is not provided, the method will execute the task once and return the output.
# Args:
# task (str): The task to execute.
# correct_answer (str, optional): If provided, the method will retry until this answer is found in the output.
# *args: Additional positional arguments.
# **kwargs: Additional keyword arguments.
# Returns:
# Any: The output of the swarm execution, or the output containing the correct answer if specified.
# """
# if correct_answer is None:
# # If no correct_answer is specified, just run once and return the output
# return self._run(task, *args, **kwargs)
# else:
# # If correct_answer is specified, retry up to max_loops times
# for attempt in range(1, self.max_loops + 1):
# output = self._run(task, *args, **kwargs)
# if correct_answer in str(output):
# logger.info(
# f"AutoSwarmBuilder: Correct answer found on attempt {attempt}."
# )
# return output
# else:
# logger.info(
# f"AutoSwarmBuilder: Attempt {attempt} did not yield the correct answer, retrying..."
# )
# # If correct_answer was not found after max_loops, return the last output
# return output
defdict_to_agent(self,output:dict):
agents=[]
ifisinstance(output,dict):
@ -402,7 +338,9 @@ class AutoSwarmBuilder:
f"Create the multi-agent team for the following task: {task}"
)
returnoutput.model_dump()
output=json.loads(output)
returnoutput
exceptExceptionase:
logger.error(
@ -412,12 +350,19 @@ class AutoSwarmBuilder:
raisee
defbuild_llm_agent(self,config:BaseModel):
returnOpenAIFunctionCaller(
# return OpenAIFunctionCaller(
# system_prompt=BOSS_SYSTEM_PROMPT,
# api_key=os.getenv("OPENAI_API_KEY"),
# temperature=0.5,
# base_model=config,
# model_name=self.model_name,
# max_tokens=self.max_tokens,
# )
returnLiteLLM(
model_name=self.model_name,
system_prompt=BOSS_SYSTEM_PROMPT,
api_key=os.getenv("OPENAI_API_KEY"),
temperature=0.5,
base_model=config,
model_name=self.model_name,
response_format=config,
max_tokens=self.max_tokens,
)
@ -440,10 +385,7 @@ class AutoSwarmBuilder:
f"Create the agents for the following task: {task}"