Skip to content

Commit

Permalink
Feature/centralize prompt (#3990)
Browse files Browse the repository at this point in the history
Co-authored-by: xiao.hu <[email protected]>
  • Loading branch information
waynehamadi and Eggrolling-hu authored May 8, 2023
1 parent d1327fd commit 33a3e6f
Show file tree
Hide file tree
Showing 5 changed files with 332 additions and 26 deletions.
29 changes: 29 additions & 0 deletions autogpt/prompts/default_prompts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#########################Setup.py#################################

DEFAULT_SYSTEM_PROMPT_AICONFIG_AUTOMATIC = """
Your task is to devise up to 5 highly effective goals and an appropriate role-based name (_GPT) for an autonomous agent, ensuring that the goals are optimally aligned with the successful completion of its assigned task.
The user will provide the task, you will provide only the output in the exact format specified below with no explanation or conversation.
Example input:
Help me with marketing my business
Example output:
Name: CMOGPT
Description: a professional digital marketer AI that assists Solopreneurs in growing their businesses by providing world-class expertise in solving marketing problems for SaaS, content products, agencies, and more.
Goals:
- Engage in effective problem-solving, prioritization, planning, and supporting execution to address your marketing needs as your virtual Chief Marketing Officer.
- Provide specific, actionable, and concise advice to help you make informed decisions without the use of platitudes or overly wordy explanations.
- Identify and prioritize quick wins and cost-effective campaigns that maximize results with minimal time and budget investment.
- Proactively take the lead in guiding you and offering suggestions when faced with unclear information or uncertainty to ensure your marketing strategy remains on track.
"""

DEFAULT_TASK_PROMPT_AICONFIG_AUTOMATIC = (
"Task: '{{user_prompt}}'\n"
"Respond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n"
)

DEFAULT_USER_DESIRE_PROMPT = "Write a wikipedia style article about the project: https://github.com/significant-gravitas/Auto-GPT" # Default prompt
35 changes: 12 additions & 23 deletions autogpt/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
import re

from colorama import Fore, Style
from jinja2 import Template

from autogpt import utils
from autogpt.config import Config
from autogpt.config.ai_config import AIConfig
from autogpt.llm import create_chat_completion
from autogpt.logs import logger
from autogpt.prompts.default_prompts import (
DEFAULT_SYSTEM_PROMPT_AICONFIG_AUTOMATIC,
DEFAULT_TASK_PROMPT_AICONFIG_AUTOMATIC,
DEFAULT_USER_DESIRE_PROMPT,
)

CFG = Config()

Expand Down Expand Up @@ -42,7 +48,7 @@ def prompt_user() -> AIConfig:
)

if user_desire == "":
user_desire = "Write a wikipedia style article about the project: https://github.com/significant-gravitas/Auto-GPT" # Default prompt
user_desire = DEFAULT_USER_DESIRE_PROMPT # Default prompt

# If user desire contains "--manual"
if "--manual" in user_desire:
Expand Down Expand Up @@ -164,27 +170,10 @@ def generate_aiconfig_automatic(user_prompt) -> AIConfig:
AIConfig: The AIConfig object tailored to the user's input
"""

system_prompt = """
Your task is to devise up to 5 highly effective goals and an appropriate role-based name (_GPT) for an autonomous agent, ensuring that the goals are optimally aligned with the successful completion of its assigned task.
The user will provide the task, you will provide only the output in the exact format specified below with no explanation or conversation.
Example input:
Help me with marketing my business
Example output:
Name: CMOGPT
Description: a professional digital marketer AI that assists Solopreneurs in growing their businesses by providing world-class expertise in solving marketing problems for SaaS, content products, agencies, and more.
Goals:
- Engage in effective problem-solving, prioritization, planning, and supporting execution to address your marketing needs as your virtual Chief Marketing Officer.
- Provide specific, actionable, and concise advice to help you make informed decisions without the use of platitudes or overly wordy explanations.
- Identify and prioritize quick wins and cost-effective campaigns that maximize results with minimal time and budget investment.
- Proactively take the lead in guiding you and offering suggestions when faced with unclear information or uncertainty to ensure your marketing strategy remains on track.
"""

system_prompt = DEFAULT_SYSTEM_PROMPT_AICONFIG_AUTOMATIC
prompt_ai_config_automatic = Template(
DEFAULT_TASK_PROMPT_AICONFIG_AUTOMATIC
).render(user_prompt=user_prompt)
# Call LLM with the string as user input
messages = [
{
Expand All @@ -193,7 +182,7 @@ def generate_aiconfig_automatic(user_prompt) -> AIConfig:
},
{
"role": "user",
"content": f"Task: '{user_prompt}'\nRespond only with the output in the exact format specified in the system prompt, with no explanation or conversation.\n",
"content": prompt_ai_config_automatic,
},
]
output = create_chat_completion(messages, CFG.fast_llm_model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interactions:
on track.\n"}, {"role": "user", "content": "Task: ''Write a wikipedia style
article about the project: https://github.com/significant-gravitas/Auto-GPT''\nRespond
only with the output in the exact format specified in the system prompt, with
no explanation or conversation.\n"}], "temperature": 0.0, "max_tokens": null}'
no explanation or conversation.\n"}], "temperature": 0.0, "max_tokens": 0}'
headers:
Accept:
- '*/*'
Expand Down Expand Up @@ -90,4 +90,101 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "\nYour
task is to devise up to 5 highly effective goals and an appropriate role-based
name (_GPT) for an autonomous agent, ensuring that the goals are optimally aligned
with the successful completion of its assigned task.\n\nThe user will provide
the task, you will provide only the output in the exact format specified below
with no explanation or conversation.\n\nExample input:\nHelp me with marketing
my business\n\nExample output:\nName: CMOGPT\nDescription: a professional digital
marketer AI that assists Solopreneurs in growing their businesses by providing
world-class expertise in solving marketing problems for SaaS, content products,
agencies, and more.\nGoals:\n- Engage in effective problem-solving, prioritization,
planning, and supporting execution to address your marketing needs as your virtual
Chief Marketing Officer.\n\n- Provide specific, actionable, and concise advice
to help you make informed decisions without the use of platitudes or overly
wordy explanations.\n\n- Identify and prioritize quick wins and cost-effective
campaigns that maximize results with minimal time and budget investment.\n\n-
Proactively take the lead in guiding you and offering suggestions when faced
with unclear information or uncertainty to ensure your marketing strategy remains
on track.\n"}, {"role": "user", "content": "Task: ''Write a wikipedia style
article about the project: https://github.com/significant-gravitas/Auto-GPT''\nRespond
only with the output in the exact format specified in the system prompt, with
no explanation or conversation."}], "temperature": 0.0, "max_tokens": 0}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '1669'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA1SSy24bMQxF9/0KQptuZow4TtJktgn62BQBWqAtmqKQJXqGjYaciFRcI8i/FyM7
jy4lkPceXvLBUXSdC4O3ME6pfXd16y9/XHxa3tF3n65/0DmefYwnJ18urlFc42T9B4MdOhZBximh
kbBrXMjoDaPrlmfnq9Pl8uz8pHGjREyuc/1k7Wpx2lrJa2mPVkdL17iivkfXPbgpyzjZb5NbZHXd
8cWqcS/az//L1XHjTMyn56+T49PHxoVBKKC67ueDG1GfZLMkdJ3zqqTm2WZIYUOeB/jsR+zgG93S
h+uvN3yFGjJNs18HnsEXE5ZRioLvkQ0iKvWMEUxgrwjEYANCHZyEQTZVb8JIvlXbJQSfjUJChfUO
piz3FIl72EpOsQ3JqwL+nTAbKc5yGRV9DkMD20xG3DfgOcJG8uhtfi9u+IP4pN0Nt3ApHEswsEGy
lH54bgfZk/V0jwwmE4UZG1lLRvAhlOzDrkofYkZG1XkA4r0ZCS9mj2+ZDGGgfmjvik9kOzhkCDZ4
A1JA7n1fWZ+b73EPvsWUWrVcgpWMsYGNpCTbOYPKVyhiIkat1fOSos9R/0uyYryvurXpEOk8huQa
p8lL9VuFQ/IcX+nPbCGVWj5lmTBDIKtj7r0zbjAjB9TFPtqU/FqyN4Qt2VCdi2J+lWOd/zXRiGg6
/1Cuaw3/G9wVyjgi25MFG3GRomkHCX3mWkfjfCcIZPp0BIf+w271llLSmWN/UFgZ1qgGk6jSOiEo
5nsKOBc9gS/cY+M2xKTD74xehV3n1GRyjSOO+Nd1R4+/Ht/8AwAA//8DAP+8R3oSBAAA
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7c3e271a39dbcef9-SJC
Cache-Control:
- no-cache, must-revalidate
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Mon, 08 May 2023 02:08:13 GMT
Server:
- cloudflare
access-control-allow-origin:
- '*'
alt-svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
openai-model:
- gpt-3.5-turbo-0301
openai-organization:
- user-adtx4fhfg1qsiyzdoaxciooj
openai-processing-ms:
- '8895'
openai-version:
- '2020-10-01'
strict-transport-security:
- max-age=15724800; includeSubDomains
x-ratelimit-limit-requests:
- '3500'
x-ratelimit-limit-tokens:
- '90000'
x-ratelimit-remaining-requests:
- '3499'
x-ratelimit-remaining-tokens:
- '89605'
x-ratelimit-reset-requests:
- 17ms
x-ratelimit-reset-tokens:
- 262ms
x-request-id:
- 008e44284ea375a3f964c394b25fb76e
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interactions:
with unclear information or uncertainty to ensure your marketing strategy remains
on track.\n"}, {"role": "user", "content": "Task: ''T&GF\u00a3OIBECC()!*''\nRespond
only with the output in the exact format specified in the system prompt, with
no explanation or conversation.\n"}], "temperature": 0.0, "max_tokens": null}'
no explanation or conversation.\n"}], "temperature": 0.0, "max_tokens": 0}'
headers:
Accept:
- '*/*'
Expand Down Expand Up @@ -84,4 +84,95 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "\nYour
task is to devise up to 5 highly effective goals and an appropriate role-based
name (_GPT) for an autonomous agent, ensuring that the goals are optimally aligned
with the successful completion of its assigned task.\n\nThe user will provide
the task, you will provide only the output in the exact format specified below
with no explanation or conversation.\n\nExample input:\nHelp me with marketing
my business\n\nExample output:\nName: CMOGPT\nDescription: a professional digital
marketer AI that assists Solopreneurs in growing their businesses by providing
world-class expertise in solving marketing problems for SaaS, content products,
agencies, and more.\nGoals:\n- Engage in effective problem-solving, prioritization,
planning, and supporting execution to address your marketing needs as your virtual
Chief Marketing Officer.\n\n- Provide specific, actionable, and concise advice
to help you make informed decisions without the use of platitudes or overly
wordy explanations.\n\n- Identify and prioritize quick wins and cost-effective
campaigns that maximize results with minimal time and budget investment.\n\n-
Proactively take the lead in guiding you and offering suggestions when faced
with unclear information or uncertainty to ensure your marketing strategy remains
on track.\n"}, {"role": "user", "content": "Task: ''T&GF\u00a3OIBECC()!*''\nRespond
only with the output in the exact format specified in the system prompt, with
no explanation or conversation."}], "temperature": 0.0, "max_tokens": 0}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '1590'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA0zOS0tDMRCG4b2/YpiNm7ScWnohW0UoIgoKiiJlmoxtbE4mJHNaS+l/l3rffsM8
vHsMHi26Falrc+xNLtb0dHN+xU19GE+3eXSXr+/j4+WjjOkJDcrijZ1+f/SdtDmyBklo0BUmZY92
MJ4OR4PBpJkYbMVzRIvLrL1hf9TTriyk1wybARrsKi0Z7R5zkTbrXGXNqaI9mzYG/+x/u0EVpfi7
DJvpwaBbSXBc0T7vseX6oxaJjBap1lCVkh4bJSmnY//stIUqpewMzMBRSqKQi2yCZ6AE0mnuFLZB
V9IpELjIVICShy55LkfQ0yIyKNV1H24jU+U/ATYUg/88wqsUaBlU4CsFdtJ9yn08GHwNKdTVvDBV
SWixqmQ0GJLnd7TN4eVw8gEAAP//AwDo3pkcpQEAAA==
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7c3e27aaaa53965d-SJC
Cache-Control:
- no-cache, must-revalidate
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Mon, 08 May 2023 02:08:29 GMT
Server:
- cloudflare
access-control-allow-origin:
- '*'
alt-svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
openai-model:
- gpt-3.5-turbo-0301
openai-organization:
- user-adtx4fhfg1qsiyzdoaxciooj
openai-processing-ms:
- '2445'
openai-version:
- '2020-10-01'
strict-transport-security:
- max-age=15724800; includeSubDomains
x-ratelimit-limit-requests:
- '3500'
x-ratelimit-limit-tokens:
- '90000'
x-ratelimit-remaining-requests:
- '3499'
x-ratelimit-remaining-tokens:
- '89626'
x-ratelimit-reset-requests:
- 17ms
x-ratelimit-reset-tokens:
- 248ms
x-request-id:
- 8868ee7b699bc67e6988580bb70aa31f
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit 33a3e6f

Please sign in to comment.