remove do nothing (#3369)

This commit is contained in:
merwanehamadi
2023-04-26 17:55:02 -07:00
committed by GitHub
parent bfaf36099e
commit a3195d84d3
5 changed files with 79 additions and 87 deletions

View File

@@ -252,29 +252,26 @@ class Agent:
result = plugin.post_command(command_name, result)
if self.next_action_count > 0:
self.next_action_count -= 1
if command_name != "do_nothing":
memory_to_add = (
f"Assistant Reply: {assistant_reply} "
f"\nResult: {result} "
f"\nHuman Feedback: {user_input} "
memory_to_add = (
f"Assistant Reply: {assistant_reply} "
f"\nResult: {result} "
f"\nHuman Feedback: {user_input} "
)
self.memory.add(memory_to_add)
# Check if there's a result from the command append it to the message
# history
if result is not None:
self.full_message_history.append(create_chat_message("system", result))
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, result)
else:
self.full_message_history.append(
create_chat_message("system", "Unable to execute command")
)
logger.typewriter_log(
"SYSTEM: ", Fore.YELLOW, "Unable to execute command"
)
self.memory.add(memory_to_add)
# Check if there's a result from the command append it to the message
# history
if result is not None:
self.full_message_history.append(
create_chat_message("system", result)
)
logger.typewriter_log("SYSTEM: ", Fore.YELLOW, result)
else:
self.full_message_history.append(
create_chat_message("system", "Unable to execute command")
)
logger.typewriter_log(
"SYSTEM: ", Fore.YELLOW, "Unable to execute command"
)
def _resolve_pathlike_command_args(self, command_args):
if "directory" in command_args and command_args["directory"] in {"", "/"}:

View File

@@ -119,8 +119,6 @@ def execute_command(
# TODO: Change these to take in a file rather than pasted code, if
# non-file is given, return instructions "Input should be a python
# filepath, write your code to file and try again
elif command_name == "do_nothing":
return f"Error: No action performed. Reason: {arguments['reason']}"
elif command_name == "task_complete":
shutdown()
else:

View File

@@ -127,7 +127,7 @@ class PromptGenerator:
for item in self.command_registry.commands.values()
if item.enabled
]
# These are the commands that are added manually, do_nothing and terminate
# terminate command is added manually
command_strings += [self._generate_command_string(item) for item in items]
return "\n".join(f"{i+1}. {item}" for i, item in enumerate(command_strings))
else:

View File

@@ -39,7 +39,6 @@ def build_default_prompt_generator() -> PromptGenerator:
# Define the command list
commands = [
("Do Nothing", "do_nothing", {"reason": "<reason>"}),
("Task Complete (Shutdown)", "task_complete", {"reason": "<reason>"}),
]

View File

@@ -23,17 +23,16 @@ interactions:
\"question\": \"<question>\"\n9. list_agents: List GPT Agents, args: () -> str\n10.
message_agent: Message GPT Agent, args: \"key\": \"<key>\", \"message\": \"<message>\"\n11.
start_agent: Start GPT Agent, args: \"name\": \"<name>\", \"task\": \"<short_task_desc>\",
\"prompt\": \"<prompt>\"\n12. Do Nothing: \"do_nothing\", args: \"reason\":
\"<reason>\"\n13. Task Complete (Shutdown): \"task_complete\", args: \"reason\":
\"<reason>\"\n\nResources:\n1. Internet access for searches and information
gathering.\n2. Long Term memory management.\n3. GPT-3.5 powered Agents for delegation
of simple tasks.\n4. File output.\n\nPerformance Evaluation:\n1. Continuously
review and analyze your actions to ensure you are performing to the best of
your abilities.\n2. Constructively self-criticize your big-picture behavior
constantly.\n3. Reflect on past decisions and strategies to refine your approach.\n4.
Every command has a cost, so be smart and efficient. Aim to complete tasks in
the least number of steps.\n5. Write all code to a file.\n\nYou should only
respond in JSON format as described below \nResponse Format: \n{\n \"thoughts\":
\"prompt\": \"<prompt>\"\n12. Task Complete (Shutdown): \"task_complete\", args:
\"reason\": \"<reason>\"\n\nResources:\n1. Internet access for searches and
information gathering.\n2. Long Term memory management.\n3. GPT-3.5 powered
Agents for delegation of simple tasks.\n4. File output.\n\nPerformance Evaluation:\n1.
Continuously review and analyze your actions to ensure you are performing to
the best of your abilities.\n2. Constructively self-criticize your big-picture
behavior constantly.\n3. Reflect on past decisions and strategies to refine
your approach.\n4. Every command has a cost, so be smart and efficient. Aim
to complete tasks in the least number of steps.\n5. Write all code to a file.\n\nYou
should only respond in JSON format as described below \nResponse Format: \n{\n \"thoughts\":
{\n \"text\": \"thought\",\n \"reasoning\": \"reasoning\",\n \"plan\":
\"- short bulleted\\n- list that conveys\\n- long-term plan\",\n \"criticism\":
\"constructive self-criticism\",\n \"speak\": \"thoughts summary to say
@@ -43,7 +42,7 @@ interactions:
time and date is Tue Jan 01 00:00:00 2000"}, {"role": "system", "content": "This
reminds you of these events from your past:\n\n\n"}, {"role": "user", "content":
"Determine which next command to use, and respond using the format specified
above:"}], "temperature": 0, "max_tokens": 3205}'
above:"}], "temperature": 0, "max_tokens": 3223}'
headers:
Accept:
- '*/*'
@@ -52,7 +51,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '3554'
- '3490'
Content-Type:
- application/json
method: POST
@@ -60,20 +59,20 @@ interactions:
response:
body:
string: !!binary |
H4sIAAAAAAAAA7yTQW/aQBCF7/0Vo7lwMQgIKeBbemmjtlIPtFFUV2hZD/aW9Y6zOy5IyP+9MjYh
ccWpVa/zxu99zx4f0aQYo86V6KK0w/lSr+6eZl8W04P6fNh8evdkH2x59/jx/exbhhHy5idp6Z4Y
aS5KS2LYYYTakxJKMZ68XUxvp/PJYhZhwSlZjDErZXgzuh1K5Tc8HN+MJxhhFVRGGB+x9FyUshbe
kQsYz5fTCC/ez/PJch6hsCj7PFoulnWEOmejKWD8/YgFhbOtZ0sYowrBBFFOGkh2Qq4pcEwcAECC
knOV5RISjKEbdgIdpBkmeA97Yy1UgUBygr03Qmvh9dZYAs1FoVwKwq0Agw9kLcMDe5sOwDhhUHBa
daqgFAZ5o6/3jT6SgwxGCUYvgz2pwM64rE1f5QQZKwsm/E0IrK6iN8Y5QcFBQJWl59IbJRd9yx4k
b7ZU2PVpS6tcCzqEr//pDWlvxGgTivP3cUQnf3Kh8g2DEriHXP1qeTR7T1pA+awqyEnoKl0h7ceF
ktTu+ik0wf+uaBtcR+f77Ez/OM/GoWV61aGHrnzWv+xWaHYvFj2OVyb9v+FFpzPtibgDT1yNdYRb
40zI1+0tY4xBuMQIjUvpgPG4/lG/+Q0AAP//AwCiz6SNfQQAAA==
H4sIAAAAAAAAA7yTT2/TQBDF73yK0VxycSI3f0jjWwUHisQFAQVhFG3tib3NesfdHSutIn93tLbT
tEY9gbjOG7/3m9nxEXWOCWalkqyqzXS9ubt53H+68u9+FPeON2vzcb654m/v4/vP3zFCvr2jTIYv
ZhlXtSHRbDHCzJESyjG5eHs5X62Wi/llhBXnZDDBopbpYraaSuNueRov4guMsPGqIEyOWDuuatkK
78l6TNbrZYRn76f6PI4jFBZlnkqb9bKNMCtZZ+Qx+XnEivzJ1rEhTFB5r70oKwGSrZANAxxTCwCQ
opTcFKX4FBMYioNADxKKKV7DQRsDjSeQkuDgtNBWeLvThiDjqlI2B+FegMkHMobhhp3JJ6CtMCjo
Wq2qKIdJGfTtIegzeZDJLMXoebAj5dlqW/TpX0qCgpUB7f8iJIIO8lX8YF4SVOwFVF07rp1WQrBj
B1IGVfn9mLQ2yvaQU/j6n7aTOS060746vY0l6vzJ+sYFBiVwDaqCxmtbdEwZO0eZnHOGZSjp5PDS
YQGBUMie2s3jONvXpPav30Sg+HdT98FtdDrUwfSPOw0OPdOL1Y/QlSvGJ94LofdsMeJ4YTL+LZ7N
dKLtiAfw1LbYRrjTVvty2x81JuiFa4xQ25weMInbX+2b3wAAAP//AwAxpIznhgQAAA==
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7be04376c97296c3-SJC
- 7be2da273c20ce54-SJC
Cache-Control:
- no-cache, must-revalidate
Connection:
@@ -83,7 +82,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 26 Apr 2023 16:40:03 GMT
- Thu, 27 Apr 2023 00:12:22 GMT
Server:
- cloudflare
access-control-allow-origin:
@@ -95,7 +94,7 @@ interactions:
openai-organization:
- user-adtx4fhfg1qsiyzdoaxciooj
openai-processing-ms:
- '18864'
- '14714'
openai-version:
- '2020-10-01'
strict-transport-security:
@@ -107,7 +106,7 @@ interactions:
x-ratelimit-reset-requests:
- 17ms
x-request-id:
- 77d98331ebd579dd929c8de10a83a035
- 23366aac1ddcc141fc735b4a1a8b268c
status:
code: 200
message: OK
@@ -135,17 +134,16 @@ interactions:
\"question\": \"<question>\"\n9. list_agents: List GPT Agents, args: () -> str\n10.
message_agent: Message GPT Agent, args: \"key\": \"<key>\", \"message\": \"<message>\"\n11.
start_agent: Start GPT Agent, args: \"name\": \"<name>\", \"task\": \"<short_task_desc>\",
\"prompt\": \"<prompt>\"\n12. Do Nothing: \"do_nothing\", args: \"reason\":
\"<reason>\"\n13. Task Complete (Shutdown): \"task_complete\", args: \"reason\":
\"<reason>\"\n\nResources:\n1. Internet access for searches and information
gathering.\n2. Long Term memory management.\n3. GPT-3.5 powered Agents for delegation
of simple tasks.\n4. File output.\n\nPerformance Evaluation:\n1. Continuously
review and analyze your actions to ensure you are performing to the best of
your abilities.\n2. Constructively self-criticize your big-picture behavior
constantly.\n3. Reflect on past decisions and strategies to refine your approach.\n4.
Every command has a cost, so be smart and efficient. Aim to complete tasks in
the least number of steps.\n5. Write all code to a file.\n\nYou should only
respond in JSON format as described below \nResponse Format: \n{\n \"thoughts\":
\"prompt\": \"<prompt>\"\n12. Task Complete (Shutdown): \"task_complete\", args:
\"reason\": \"<reason>\"\n\nResources:\n1. Internet access for searches and
information gathering.\n2. Long Term memory management.\n3. GPT-3.5 powered
Agents for delegation of simple tasks.\n4. File output.\n\nPerformance Evaluation:\n1.
Continuously review and analyze your actions to ensure you are performing to
the best of your abilities.\n2. Constructively self-criticize your big-picture
behavior constantly.\n3. Reflect on past decisions and strategies to refine
your approach.\n4. Every command has a cost, so be smart and efficient. Aim
to complete tasks in the least number of steps.\n5. Write all code to a file.\n\nYou
should only respond in JSON format as described below \nResponse Format: \n{\n \"thoughts\":
{\n \"text\": \"thought\",\n \"reasoning\": \"reasoning\",\n \"plan\":
\"- short bulleted\\n- list that conveys\\n- long-term plan\",\n \"criticism\":
\"constructive self-criticism\",\n \"speak\": \"thoughts summary to say
@@ -158,17 +156,18 @@ interactions:
above:"}, {"role": "assistant", "content": "{\n \"thoughts\": {\n \"text\":
\"I will use the write_to_file command to write ''Hello World'' into a file
named ''hello_world.txt''.\",\n \"reasoning\": \"The goal is to write
''Hello World'' into a file named ''hello_world.txt''. The write_to_file command
is the most appropriate command for this task.\",\n \"plan\": \"- Use
''Hello World'' into a file named ''hello_world.txt'', and the write_to_file
command is the most appropriate for this task.\",\n \"plan\": \"- Use
the write_to_file command to write ''Hello World'' into a file named ''hello_world.txt''.\",\n \"criticism\":
\"I need to ensure that I have the correct arguments for the write_to_file command.\",\n \"speak\":
\"I will use the write to file command to write ''Hello World'' into a file
named ''hello_world.txt''.\"\n },\n \"command\": {\n \"name\":
\"write_to_file\",\n \"args\": {\n \"filename\": \"hello_world.txt\",\n \"text\":
\"Hello World\"\n }\n }\n}"}, {"role": "system", "content": "Command
write_to_file returned: File written to successfully."}, {"role": "user", "content":
"Determine which next command to use, and respond using the format specified
above:"}], "temperature": 0, "max_tokens": 2955}'
\"I need to ensure that I am using the correct file name and that the text is
written correctly.\",\n \"speak\": \"I will use the write to file command
to write ''Hello World'' into a file named ''hello_world.txt''.\"\n },\n \"command\":
{\n \"name\": \"write_to_file\",\n \"args\": {\n \"filename\":
\"hello_world.txt\",\n \"text\": \"Hello World\"\n }\n }\n}"},
{"role": "system", "content": "Command write_to_file returned: File written
to successfully."}, {"role": "user", "content": "Determine which next command
to use, and respond using the format specified above:"}], "temperature": 0,
"max_tokens": 2970}'
headers:
Accept:
- '*/*'
@@ -177,7 +176,7 @@ interactions:
Connection:
- keep-alive
Content-Length:
- '4667'
- '4612'
Content-Type:
- application/json
method: POST
@@ -185,20 +184,19 @@ interactions:
response:
body:
string: !!binary |
H4sIAAAAAAAAA6SS3W7aQBCF7/sUo7nhxiDApaR+gsBNG4n0R3WENuvB3rLesXbHgQr53SvHJlAS
pEi9nTNz5pvdc0CTYYK6UKLLyg7nn/Xq29OCfqrFF728i5c/vtq7eJHH98vdLUbIj79JSz8x0lxW
lsSwwwi1JyWUYTL5dDOdTefT8SzCkjOymGBeyTAezYZS+0cejuPxBCOsg8oJkwNWnstK1sJbcgGT
yTiOIzyZn4TZxwiFRdlTaXIzbyLUBRtNAZNfBywpHI09W8IEVQgmiHLSYr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revalidate
Connection:
@@ -208,7 +206,7 @@ interactions:
Content-Type:
- application/json
Date:
- Wed, 26 Apr 2023 16:40:20 GMT
- Thu, 27 Apr 2023 00:12:36 GMT
Server:
- cloudflare
access-control-allow-origin:
@@ -220,7 +218,7 @@ interactions:
openai-organization:
- user-adtx4fhfg1qsiyzdoaxciooj
openai-processing-ms:
- '15127'
- '10505'
openai-version:
- '2020-10-01'
strict-transport-security:
@@ -232,7 +230,7 @@ interactions:
x-ratelimit-reset-requests:
- 17ms
x-request-id:
- 468c3c77efd74e3a2d396ef6033a5602
- f593fff7d415793b53e5124283ad25c9
status:
code: 200
message: OK