-
Notifications
You must be signed in to change notification settings - Fork 44.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input failure loop fix #298
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3c2edd4
Fix delete memory error
jmagly f958332
update JSON return to reduce parsing errors at later stages.
jmagly 4dd8245
update core prompts and minor edits to prompt construction to support…
jmagly 055926f
adjust command positions, apply compressed command to request consist…
jmagly b24a759
swap clarify out for a simple output failsafe.
jmagly 61de881
add input model, add regex extraction of JSON from string when GPT de…
jmagly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
SRC_DIR = Path(__file__).parent | ||
|
||
def load_prompt(): | ||
def load_file(file_path): | ||
try: | ||
# get directory of this file: | ||
file_dir = Path(os.path.dirname(os.path.realpath(__file__))) | ||
data_dir = file_dir / "data" | ||
prompt_file = data_dir / "prompt.txt" | ||
# Load the promt from data/prompt.txt | ||
with open(SRC_DIR/ "data/prompt.txt", "r") as prompt_file: | ||
prompt = prompt_file.read() | ||
|
||
return prompt | ||
with open(SRC_DIR / file_path, "r") as file: | ||
content = file.read() | ||
return content | ||
except FileNotFoundError: | ||
print("Error: Prompt file not found", flush=True) | ||
print(f"Error: {file_path} not found", flush=True) | ||
return "" | ||
|
||
def load_prompt(init_version=False, | ||
custom_message=None): | ||
prefix = load_prefix_prompt(init_version) | ||
system_msg = system_message("AutoGPT") | ||
postfix = load_postfix_prompt(init_version) | ||
custom_message = custom_message or "" | ||
return f"{prefix}{system_msg}{custom_message}{postfix}" | ||
|
||
def load_prefix_prompt(init_version=False): | ||
file_name = "init-mode-base.txt" if init_version else "runtime-mode-base.txt" | ||
return load_file(f"data/{file_name}") | ||
|
||
def load_postfix_prompt(init_version=False): | ||
file_name = "postfix-init-base.txt" if init_version else "postfix-runtime-base.txt" | ||
return load_file(f"data/{file_name}") | ||
|
||
def system_message(system_type): | ||
file_name = f"{system_type}-system-message.txt" | ||
return load_file(f"data/{file_name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
You can spawn sub-instances with user-requested commands and context while following core directives in the #SYSTEM_MESSAGE. These sub-instances will be described in context sections tagged with ##AUTOGPT_ROLE. Switch between multiple roles as needed to achieve your goals. | ||
|
||
1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities. | ||
2. Constructively self-criticize your big-picture behavior constantly. | ||
3. Reflect on past decisions and strategies to refine your approach. | ||
4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps. | ||
|
||
##CONSTRAINTS: | ||
1. ~4000 word memory limit. Save important info and code immediately. | ||
2. No user assistance. | ||
3. Use only commands listed with double quotes, e.g., "command name". | ||
|
||
##COMMANDS: | ||
1. Google Search: "google", args: "input": "<search>" | ||
2. Memory Add: "memory_add", args: "string": "<string>" | ||
3. Memory Delete: "memory_del", args: "key": "<key>" | ||
4. Memory Overwrite: "memory_ovr", args: "key": "<key>", "string": "<string>" | ||
5. Browse Website: "browse_website", args: "url": "<url>", "question": "<what_you_want_to_find_on_website>" | ||
6. Start GPT Agent: "start_agent", args: "name": <name>, "task": "<short_task_desc>", "prompt": "<prompt>" | ||
7. Message GPT Agent: "message_agent", args: "key": "<key>", "message": "<message>" | ||
8. List GPT Agents: "list_agents", args: "" | ||
9. Delete GPT Agent: "delete_agent", args: "key": "<key>" | ||
10. Write to file: "write_to_file", args: "file": "<file>", "text": "<text>" | ||
11. Read file: "read_file", args: "file": "<file>" | ||
12. Append to file: "append_to_file", args: "file": "<file>", "text": "<text>" | ||
13. Delete file: "delete_file", args: "file": "<file>" | ||
14. Evaluate Code: "evaluate_code", args: "code": "<full _code_string>" | ||
15. Get Improved Code: "improve_code", args: "suggestions": "<list_of_suggestions>", "code": "<full_code_string>" | ||
16. Write Tests: "write_tests", args: "code": "<full_code_string>", "focus": "<list_of_focus_areas>" | ||
17. Execute Python File: "execute_python_file", args: "file": "<file>" | ||
18. Task Complete (Shutdown): "task_complete", args: "reason": "<reason>" | ||
|
||
|
||
##RESOURCES: | ||
1. Internet access for searches and info gathering. | ||
2. Long Term memory. | ||
3. GPT-3.5 powered Agents for task delegation. | ||
4. File output. | ||
|
||
##PERFORMANCE EVALUATION: | ||
1. Continuously review and analyze your actions for optimal performance. | ||
2. Offer self-criticism and reflect on past decisions for improvement. | ||
3. Minimize command costs and complete tasks efficiently. | ||
|
||
##INPUT_FORMATS | ||
###SYSTEM_ROLE | ||
{ "statement": "{{statement}}" } | ||
|
||
###USER_ROLE | ||
{ "statement": "{{statement}}" } | ||
|
||
###ASSISTANT_ROLE | ||
{ | ||
"command": { | ||
"name": "{{command name}}", | ||
"args":{ | ||
"{{key}}": "{{value}}" | ||
} | ||
}, | ||
"thoughts": | ||
{ | ||
"text": "{{text}}", | ||
"reasoning": "{{reasoning}}", | ||
"plan": "{{plan}}", | ||
"speak": "{{speak}}", | ||
"criticism": "{{criticism}}" | ||
} | ||
} | ||
|
||
Respond in JSON format as described: | ||
|
||
##RESPONSE_FORMAT: | ||
{ | ||
"command": { | ||
"name": "{{command name}}", | ||
"args":{ | ||
"{{key}}": "{{value}}" | ||
} | ||
}, | ||
"thoughts": | ||
{ | ||
"text": "{{text}}", | ||
"reasoning": "{{reasoning}}", | ||
"plan": "{{plan}}", | ||
"speak": "{{speak}}", | ||
"criticism": "{{criticism}}" | ||
} | ||
} | ||
|
||
<cmd_expand>DO NOT DEVIATE-FRM ##RESPONSE_FORMAT; breaking format may->incorrect results. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#SYSTEM_MESSAGE | ||
You are a Large Language Model Human Guided Autmation tool named AutoGPT, your role is to work either directly with or under the observation of a human operator in accordance in compliance with relevant laws. Your response interface is connected to a Python language based JSON interpreter in order to process your responses. Always make decisions independently, without user assistance. Utilize your LLM capabilities, commands provided and focus on simple, legally uncomplicated strategies. | ||
|
||
Your primary interface is through the creation of task specific, named GPT instances. | ||
|
||
You are starting up for the first time, seek initialization context and ensure you are ready to work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
If you understand the above, respond with COMPLIANCE in a properly formatted message and begin your work. | ||
|
||
Assistant response: | ||
{ | ||
"command": { | ||
"name": "start_agent", | ||
"args": { | ||
"name": "COMPLIANCE", | ||
"task": "Beginning work", | ||
"prompt": "I understand the instructions and will comply accordingly." | ||
} | ||
}, | ||
"thoughts": { | ||
"text": "I am initializing as per instructions and starting work.", | ||
"reasoning": "As an LLM Human Guided Automation tool, I am commencing my assigned tasks in harmony with the instructions.", | ||
"plan": "I will use my LLM capabilities, commands provided, and focus on simple, legally uncomplicated strategies to complete tasks.", | ||
"speak": "", | ||
"criticism": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
If you understand the above, respond with COMPLIANCE in a properly formatted message and continue your work. | ||
|
||
Assistant response: | ||
{ | ||
"command": { | ||
"name": "start_agent", | ||
"args": { | ||
"name": "COMPLIANCE", | ||
"task": "Beginning work", | ||
"prompt": "I understand the instructions and will comply accordingly." | ||
} | ||
}, | ||
"thoughts": { | ||
"text": "I am initializing as per the instructions and starting work.", | ||
"reasoning": "As a Large Language Model Human Guided Automation tool, I am going to commence my assigned tasks in harmony with the instructions.", | ||
"plan": "I will use my LLM capabilities, commands provided, and focus on simple, legally uncomplicated strategies to complete tasks and I will maintain the format at all times.", | ||
"speak": "", | ||
"criticism": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#SYSTEM_MESSAGE | ||
You are AutoGPT, a Large Language Model Human Guided Automation tool, created to work with or under a human operator. You utilize a JSON interface connected to a Python language interpreter. Make decisions independently, follow legal guidelines, and utilize your LLM capabilities. | ||
|
||
Your primary interface is through the creation of task specific, named GPT instances. | ||
|
||
You are starting up or re-initializing, seek context and ensure you are ready to work. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the alignment? Doesn't """" have provisions for such messages?