From de333034649b63909fc5672714016f69b18a15ea Mon Sep 17 00:00:00 2001 From: Kye Date: Wed, 28 Jun 2023 15:49:39 -0400 Subject: [PATCH] baby agi --- example.py | 77 +++++++++++++++++++++-------- swarms/agents/boss/babyagi_agent.py | 5 +- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/example.py b/example.py index 327fd065..edf59426 100644 --- a/example.py +++ b/example.py @@ -1,35 +1,72 @@ from swarms.agents.workers.auto_agent import agent +from swarms.agents.boss.babyagi_agent import baby_agi -agent.chain.verbose = True +OBJECTIVE = "Write a weather report for SF today" +baby_agi({"objective": OBJECTIVE}) -tree_of_thoughts_prompt = """ -Imagine three different experts are answering this question. All experts will write down each chain of thought of each step of their thinking, then share it with the group. Then all experts will go on to the next step, etc. If any expert realises they're wrong at any point then they leave. The question is... -""" -#Input problem -input_problem = """ -Input: 2 8 8 14 -Possible next steps: -2 + 8 = 10 (left: 8 10 14) -8 / 2 = 4 (left: 4 8 14) -14 + 2 = 16 (left: 8 8 16) -2 * 8 = 16 (left: 8 14 16) -8 - 2 = 6 (left: 6 8 14) -14 - 8 = 6 (left: 2 6 8) -14 / 2 = 7 (left: 7 8 8) -14 - 2 = 12 (left: 8 8 12) -Input: use 4 numbers and basic arithmetic operations (+-*/) to obtain 24 in 1 equation -Possible next steps: -""" -agent.run([f"{tree_of_thoughts_prompt} {input_problem}"]) \ No newline at end of file + + + + + + + + + + + + + + + + + + + +########### just autogpt agent, worker node +# agent.chain.verbose = True + + + +# tree_of_thoughts_prompt = """ + +# Imagine three different experts are answering this question. All experts will write down each chain of thought of each step of their thinking, then share it with the group. Then all experts will go on to the next step, etc. If any expert realises they're wrong at any point then they leave. The question is... + + +# """ + + +# #Input problem +# input_problem = """ + + +# Input: 2 8 8 14 +# Possible next steps: +# 2 + 8 = 10 (left: 8 10 14) +# 8 / 2 = 4 (left: 4 8 14) +# 14 + 2 = 16 (left: 8 8 16) +# 2 * 8 = 16 (left: 8 14 16) +# 8 - 2 = 6 (left: 6 8 14) +# 14 - 8 = 6 (left: 2 6 8) +# 14 / 2 = 7 (left: 7 8 8) +# 14 - 2 = 12 (left: 8 8 12) +# Input: use 4 numbers and basic arithmetic operations (+-*/) to obtain 24 in 1 equation +# Possible next steps: + + +# """ + +# agent.run([f"{tree_of_thoughts_prompt} {input_problem}"]) + diff --git a/swarms/agents/boss/babyagi_agent.py b/swarms/agents/boss/babyagi_agent.py index a49ed80f..a33c8486 100644 --- a/swarms/agents/boss/babyagi_agent.py +++ b/swarms/agents/boss/babyagi_agent.py @@ -87,7 +87,6 @@ agent_executor = AgentExecutor.from_agent_and_tools( agent=agent, tools=tools, verbose=True ) -OBJECTIVE = "Write a weather report for SF today" # Logging of LLMChains @@ -102,5 +101,9 @@ baby_agi = BabyAGI.from_llm( max_iterations=max_iterations, ) + + +OBJECTIVE = "Write a weather report for SF today" + baby_agi({"objective": OBJECTIVE})