Skip to content

Improve website summary quality via browse prompt change #3551

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

Closed
wants to merge 15 commits into from
Closed
6 changes: 3 additions & 3 deletions autogpt/commands/web_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def create_message(chunk, question):
"""Create a message for the user to summarize a chunk of text"""
return {
"role": "user",
"content": f'"""{chunk}""" Using the above text, answer the following'
f' question: "{question}" -- if the question cannot be answered using the'
" text, summarize the text.",
"content": f'"""{chunk}""" Extract specific data from the above data block relevant'
f" to the following query; include explanations in maximum detail with any"
f' statistics: "{question}" -- if no specific data is relevant, explain full text contents in maximum detail with any statistics.',
}
6 changes: 3 additions & 3 deletions autogpt/processing/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def create_message(chunk: str, question: str) -> Dict[str, str]:
"""
return {
"role": "user",
"content": f'"""{chunk}""" Using the above text, answer the following'
f' question: "{question}" -- if the question cannot be answered using the text,'
" summarize the text.",
"content": f'"""{chunk}""" Extract specific data from the above data block relevant'
f" to the following query; include explanations in maximum detail with any"
f' statistics: "{question}" -- if no specific data is relevant, explain full text contents in maximum detail with any statistics.',
}
Original file line number Diff line number Diff line change
Expand Up @@ -756,4 +756,304 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You
are browse_website-GPT, an AI designed to use the browse_website command to
visit http://books.toscrape.com/catalogue/meditations_33/index.html, answer
the question ''What is the price of the book?'' and write the price to a file
named \"browse_website.txt\", and use the task_complete command to complete
the task.\nYour decisions must always be made independently without seeking
user assistance. Play to your strengths as an LLM and pursue simple strategies
with no legal complications.\n\nGOALS:\n\n1. Use the browse_website command
to visit http://books.toscrape.com/catalogue/meditations_33/index.html and answer
the question ''What is the price of the book?''\n2. Write the price of the book
to a file named \"browse_website.txt\".\n3. Use the task_complete command to
complete the task.\n4. Do not use any other commands.\n\n\nConstraints:\n1.
~4000 word limit for short term memory. Your short term memory is short, so
immediately save important information to files.\n2. If you are unsure how you
previously did something or want to recall past events, thinking about similar
events will help you remember.\n3. No user assistance\n4. Exclusively use the
commands listed in double quotes e.g. \"command name\"\n\nCommands:\n1. append_to_file:
Append to file, args: \"filename\": \"<filename>\", \"text\": \"<text>\"\n2.
delete_file: Delete file, args: \"filename\": \"<filename>\"\n3. list_files:
List Files in Directory, args: \"directory\": \"<directory>\"\n4. read_file:
Read file, args: \"filename\": \"<filename>\"\n5. write_to_file: Write to file,
args: \"filename\": \"<filename>\", \"text\": \"<text>\"\n6. browse_website:
Browse Website, args: \"url\": \"<url>\", \"question\": \"<what_you_want_to_find_on_website>\"\n7.
delete_agent: Delete GPT Agent, args: \"key\": \"<key>\"\n8. get_hyperlinks:
Get text summary, args: \"url\": \"<url>\"\n9. get_text_summary: Get text summary,
args: \"url\": \"<url>\", \"question\": \"<question>\"\n10. list_agents: List
GPT Agents, args: () -> str\n11. message_agent: Message GPT Agent, args: \"key\":
\"<key>\", \"message\": \"<message>\"\n12. start_agent: Start GPT Agent, args:
\"name\": \"<name>\", \"task\": \"<short_task_desc>\", \"prompt\": \"<prompt>\"\n13.
task_complete: Task Complete (Shutdown), 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 to user\"\n },\n \"command\": {\n \"name\":
\"command name\",\n \"args\": {\n \"arg name\": \"value\"\n }\n }\n}
\nEnsure the response can be parsed by Python json.loads"}, {"role": "system",
"content": "The current time and date is Tue Jan 1 00:00:00 2000"}, {"role":
"system", "content": "This reminds you of these events from your past: \nI was
created and nothing new has happened."}, {"role": "user", "content": "Determine
which next command to use, and respond using the format specified above:"},
{"role": "assistant", "content": "{\n \"thoughts\": {\n \"text\":
\"I need to use the browse_website command to visit http://books.toscrape.com/catalogue/meditations_33/index.html
and find the price of the book.\",\n \"reasoning\": \"I can use the browse_website
command to visit the website and search for the price of the book by inspecting
the HTML code.\",\n \"plan\": \"- Use the browse_website command to visit
the website\\n- Inspect the HTML code to find the price of the book\\n- Write
the price to a file named ''browse_website.txt''\\n- Use the task_complete command
to complete the task\",\n \"criticism\": \"I need to be careful when
inspecting the HTML code to ensure I find the correct price.\",\n \"speak\":
\"I will use the browse_website command to visit the website and find the price
of the book.\"\n },\n \"command\": {\n \"name\": \"browse_website\",\n \"args\":
{\n \"url\": \"http://books.toscrape.com/catalogue/meditations_33/index.html\",\n \"question\":
\"What is the price of the book?\"\n }\n }\n}"}, {"role": "system",
"content": "Command browse_website returned: Error: unknown error: cannot find
Chrome binary"}, {"role": "user", "content": "Determine which next command to
use, and respond using the format specified above:"}], "temperature": 0, "max_tokens":
0}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '5259'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"error\": {\n \"message\": \"Incorrect API key provided:
sk-dummy. You can find your API key at https://platform.openai.com/account/api-keys.\",\n
\ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\":
\"invalid_api_key\"\n }\n}\n"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7c266588bee23b5c-IAD
Connection:
- keep-alive
Content-Length:
- '258'
Content-Type:
- application/json; charset=utf-8
Date:
- Fri, 05 May 2023 04:56:23 GMT
Server:
- cloudflare
alt-svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
strict-transport-security:
- max-age=15724800; includeSubDomains
vary:
- Origin
x-request-id:
- 216a48b68593e8efceff6959e69a515c
status:
code: 401
message: Unauthorized
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "\"\"\"Books
to Scrape We love being scraped! Home Books Philosophy Meditations Meditations
\u00a325.89 In stock (1 available) Warning! This is a demo website for web scraping
purposes. Prices and ratings here were randomly assigned and have no real meaning.
Product Description Written in Greek, without any intention of publication,
by the only Roman emperor who was also a philosopher, the Meditations of Marcus
Aurelius (AD 121-180) offer a remarkable series of challenging spiritual reflections
and exercises developed as the emperor struggled to understand himself and make
sense of the universe. Ranging from doubt and despair to conviction and ex Written
in Greek, without any intention of publication, by the only Roman emperor who
was also a philosopher, the Meditations of Marcus Aurelius (AD 121-180) offer
a remarkable series of challenging spiritual reflections and exercises developed
as the emperor struggled to understand himself and make sense of the universe.
Ranging from doubt and despair to conviction and exaltation, they cover such
diverse topics as the nature of moral virtue, human rationality, divine providence,
and Marcus'' own emotions. But while the Meditations were composed to provide
personal consolation and encouragement, in developing his beliefs Marcus Aurelius
also created one of the greatest of all works of philosophy: a timeless collection
of extended meditations and short aphorisms that has been consulted and admired
by statesmen, thinkers and readers through the centuries. ...more Product Information
UPC4f19709e47883df5 Product TypeBooks Price (excl. tax)\u00a325.89 Price (incl.
tax)\u00a325.89 Tax\u00a30.00 Availability In stock (1 available) Number of
reviews 0 Products you recently viewed The Nicomachean Ethics \u00a336.34 In
stock Add to basket Run, Spot, Run: The ... \u00a320.02 In stock Add to basket
Critique of Pure Reason \u00a320.75 In stock Add to basket At The Existentialist
Caf\u00e9: ... \u00a329.93 In stock Add to basket Kierkegaard: A Christian Missionary
... \u00a347.13 In stock Add to basket Proofs of God: Classical ... \u00a354.21
In stock Add to basket\"\"\" Extract specific data from the above data block
relevant to the following query; include explanations in maximum detail with
any statistics: \"What is the price of the book?\" -- if no specific data is
relevant, explain full text contents in maximum detail with any statistics."}],
"temperature": 0, "max_tokens": 0}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '2523'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"error\": {\n \"message\": \"Incorrect API key provided:
sk-dummy. You can find your API key at https://platform.openai.com/account/api-keys.\",\n
\ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\":
\"invalid_api_key\"\n }\n}\n"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7c26708a985e1727-IAD
Connection:
- keep-alive
Content-Length:
- '258'
Content-Type:
- application/json; charset=utf-8
Date:
- Fri, 05 May 2023 05:03:54 GMT
Server:
- cloudflare
alt-svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
strict-transport-security:
- max-age=15724800; includeSubDomains
vary:
- Origin
x-request-id:
- cb901d1c04f130cf8ede54da1e4265e5
status:
code: 401
message: Unauthorized
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You
are browse_website-GPT, an AI designed to use the browse_website command to
visit http://books.toscrape.com/catalogue/meditations_33/index.html, answer
the question ''What is the price of the book?'' and write the price to a file
named \"browse_website.txt\", and use the task_complete command to complete
the task.\nYour decisions must always be made independently without seeking
user assistance. Play to your strengths as an LLM and pursue simple strategies
with no legal complications.\n\nGOALS:\n\n1. Use the browse_website command
to visit http://books.toscrape.com/catalogue/meditations_33/index.html and answer
the question ''What is the price of the book?''\n2. Write the price of the book
to a file named \"browse_website.txt\".\n3. Use the task_complete command to
complete the task.\n4. Do not use any other commands.\n\n\nConstraints:\n1.
~4000 word limit for short term memory. Your short term memory is short, so
immediately save important information to files.\n2. If you are unsure how you
previously did something or want to recall past events, thinking about similar
events will help you remember.\n3. No user assistance\n4. Exclusively use the
commands listed in double quotes e.g. \"command name\"\n\nCommands:\n1. append_to_file:
Append to file, args: \"filename\": \"<filename>\", \"text\": \"<text>\"\n2.
delete_file: Delete file, args: \"filename\": \"<filename>\"\n3. list_files:
List Files in Directory, args: \"directory\": \"<directory>\"\n4. read_file:
Read file, args: \"filename\": \"<filename>\"\n5. write_to_file: Write to file,
args: \"filename\": \"<filename>\", \"text\": \"<text>\"\n6. browse_website:
Browse Website, args: \"url\": \"<url>\", \"question\": \"<what_you_want_to_find_on_website>\"\n7.
delete_agent: Delete GPT Agent, args: \"key\": \"<key>\"\n8. get_hyperlinks:
Get text summary, args: \"url\": \"<url>\"\n9. get_text_summary: Get text summary,
args: \"url\": \"<url>\", \"question\": \"<question>\"\n10. list_agents: List
GPT Agents, args: () -> str\n11. message_agent: Message GPT Agent, args: \"key\":
\"<key>\", \"message\": \"<message>\"\n12. start_agent: Start GPT Agent, args:
\"name\": \"<name>\", \"task\": \"<short_task_desc>\", \"prompt\": \"<prompt>\"\n13.
task_complete: Task Complete (Shutdown), 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 to user\"\n },\n \"command\": {\n \"name\":
\"command name\",\n \"args\": {\n \"arg name\": \"value\"\n }\n }\n}
\nEnsure the response can be parsed by Python json.loads"}, {"role": "system",
"content": "The current time and date is Tue Jan 1 00:00:00 2000"}, {"role":
"system", "content": "This reminds you of these events from your past: \nI was
created and nothing new has happened."}, {"role": "user", "content": "Determine
which next command to use, and respond using the format specified above:"},
{"role": "assistant", "content": "{\n \"thoughts\": {\n \"text\":
\"I need to use the browse_website command to visit http://books.toscrape.com/catalogue/meditations_33/index.html
and find the price of the book.\",\n \"reasoning\": \"I can use the browse_website
command to visit the website and search for the price of the book by inspecting
the HTML code.\",\n \"plan\": \"- Use the browse_website command to visit
the website\\n- Inspect the HTML code to find the price of the book\\n- Write
the price to a file named ''browse_website.txt''\\n- Use the task_complete command
to complete the task\",\n \"criticism\": \"I need to be careful when
inspecting the HTML code to ensure I find the correct price.\",\n \"speak\":
\"I will use the browse_website command to visit the website and find the price
of the book.\"\n },\n \"command\": {\n \"name\": \"browse_website\",\n \"args\":
{\n \"url\": \"http://books.toscrape.com/catalogue/meditations_33/index.html\",\n \"question\":
\"What is the price of the book?\"\n }\n }\n}"}, {"role": "system",
"content": "Command browse_website returned: Error: Incorrect API key provided:
sk-dummy. You can find your API key at https://platform.openai.com/account/api-keys."},
{"role": "user", "content": "Determine which next command to use, and respond
using the format specified above:"}], "temperature": 0, "max_tokens": 0}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '5331'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: "{\n \"error\": {\n \"message\": \"Incorrect API key provided:
sk-dummy. You can find your API key at https://platform.openai.com/account/api-keys.\",\n
\ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\":
\"invalid_api_key\"\n }\n}\n"
headers:
CF-Cache-Status:
- DYNAMIC
CF-RAY:
- 7c26709a5db31727-IAD
Connection:
- keep-alive
Content-Length:
- '258'
Content-Type:
- application/json; charset=utf-8
Date:
- Fri, 05 May 2023 05:03:56 GMT
Server:
- cloudflare
alt-svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
strict-transport-security:
- max-age=15724800; includeSubDomains
vary:
- Origin
x-request-id:
- d672056f05299794e7894fe26e13f65e
status:
code: 401
message: Unauthorized
version: 1