Vector memory revamp (part 1: refactoring) (#4208)

Additional changes:

* Improve typing

* Modularize message history memory & fix/refactor lots of things

* Fix summarization

* Move memory relevance calculation to MemoryItem & improve test

* Fix import warnings in web_selenium.py

* Remove `memory_add` ghost command

* Implement overlap in `split_text`

* Move memory tests into subdirectory

* Remove deprecated `get_ada_embedding()` and helpers

* Fix used token calculation in `chat_with_ai`

* Replace Message TypedDict by dataclass

* Fix AgentManager singleton issues in tests

---------

Co-authored-by: Auto-GPT-Bot <github-bot@agpt.co>
This commit is contained in:
Reinier van der Leer
2023-05-25 20:31:11 +02:00
committed by GitHub
parent 10489e0df2
commit bfbe613960
92 changed files with 7282 additions and 7989 deletions

View File

@@ -2896,4 +2896,472 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Write
a concise summary of the following text; include any information that can be
used to answer the question \"What is the price of the book?\". Do not directly
answer the question itself:\n\n\nLITERAL TEXT: \"\"\"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\"\"\"\n\n\nCONCISE SUMMARY: The text is best summarized
as"}], "temperature": 0, "max_tokens": 0}'
headers:
AGENT-MODE:
- AAAAAAAAAAAAAAAAAAAAAMLheAAaAAAA0%2BuSeid%2BULvsea4JtiGRiSDSJSI%3DEUifiRBkKG5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F
AGENT-TYPE:
- Auto-GPT-2023-X-TYPE
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '2507'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA1SSTW4bMQyF9z0FofXYsJM4P7NL202RZtEg6KJNEWgkesRaIwqkxo4b+DS9SU9W
aJK46E7gz+N7H/RsyJvWuGCLG3KcXdxcJd/7m29fhuvx83139+uj+3qyfn+xvCofTGO4+4muvG7M
HQ85YiFOpjFO0Bb0pl2eX64Wp5ery1VjBvYYTWv6XGan89WsjNLxbHG6WJrGjGp7NO2zycJDLo+F
N5jUtKvFWWP+aR/ry+WiMYWLjcfS+fLs0BgXmByqab8/mwH1TVY4ommNVSUtNpVqklPBVANY8KhO
KNcTwGsoAaFj3sCDuUVPxdaGPhjo9nBrxY0K16NgpFEb2AVyAUjBbi1F20WENQvkUVywisAJ6oGB
YYedUnlp77ADdWIzpb7OZlbUOdwHhCzk8D8bpPDn98lqfnnVQDeWqfEmtrOSFEqwL+VpWcEmD2IL
pV7BCoLY5HmIe6gE+oR+mgh2i5AYBG2EAW2i1L94mM7yeo2ioJmEymgjCK4jugnGtI9PKI4UFTxu
MXJGXxFVH3c82AQ4ZBSWaTgHiqycA0oDjrcoNXrhTE5BRxfAKgwsNsKWpIzYQBiriEz4baSybyYl
T1tKNSpvyWNyOIdPpUJynJQ8CnrgdETYT79RC+xYNlqrRyv7VwwKHWIC6weStwyUNjX9RBKtr+8S
hMc+8FggkBaW/dwcGrOmRBoeBa1yMq3Rwtk0hpLHJ9MuDj8O7/4CAAD//wMAU2wM4F0DAAA=
headers:
Access-Control-Allow-Origin:
- '*'
Alt-Svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control:
- no-cache, must-revalidate
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 7ccfc4f548931119-ORD
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Thu, 25 May 2023 18:16:38 GMT
Function-Execution-Id:
- pbmeavwjmg42
Openai-Model:
- gpt-3.5-turbo-0301
Openai-Organization:
- significant-gravitas
Openai-Processing-Ms:
- '13515'
Openai-Version:
- '2020-10-01'
Server:
- Google Frontend
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Cloud-Trace-Context:
- ab314b2e9bb880724cb82a80580d492f;o=1
X-Powered-By:
- Express
X-Ratelimit-Limit-Requests:
- '3500'
X-Ratelimit-Limit-Tokens:
- '90000'
X-Ratelimit-Remaining-Requests:
- '3499'
X-Ratelimit-Remaining-Tokens:
- '88914'
X-Ratelimit-Reset-Requests:
- 17ms
X-Ratelimit-Reset-Tokens:
- 724ms
X-Request-Id:
- fb2737f00b14403a74927018f9a97197
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 below 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 a 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 hyperlinks, 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"}, {"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. I will then write the price to a file named
browse_website.txt. I can then use the task_complete command to complete the
task.\",\n \"reasoning\": \"I need to use the browse_website command
to visit the website and find the price of the book. I will then use the write_to_file
command to write the price to a file named browse_website.txt. Finally, I can
use the task_complete command to complete the task.\",\n \"plan\": \"-
Use the browse_website command to visit http://books.toscrape.com/catalogue/meditations_33/index.html
and find the price of the book\\n- Use the write_to_file command to 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 ensure that I am using
the correct URL and question for the browse_website command. I also need to
make sure that I am writing the correct information to the file.\",\n \"speak\":
\"I will use the browse_website command to visit the website and find the price
of the book. Then, I will write the price to a file named browse_website.txt
and complete the task.\"\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: Answer gathered from website: a
description of the book \"Meditations\" by Marcus Aurelius, which is available
for purchase on a demo website for web scraping purposes. The price of the book
is \u00a325.89, but the website warns that the prices and ratings are randomly
assigned and have no real meaning. The book offers spiritual reflections and
exercises developed by the Roman emperor and philosopher, covering topics such
as moral virtue, human rationality, and divine providence. It is considered
one of the greatest works of philosophy and has been admired by thinkers and
readers throughout history.\n\nLinks: [''Books to Scrape (http://books.toscrape.com/index.html)'',
''Home (http://books.toscrape.com/index.html)'', ''Books (http://books.toscrape.com/catalogue/category/books_1/index.html)'',
''Philosophy (http://books.toscrape.com/catalogue/category/books/philosophy_7/index.html)'',
'' (http://books.toscrape.com/catalogue/the-nicomachean-ethics_75/index.html)'']"},
{"role": "user", "content": "Determine which next command to use, and respond
using the format specified above:"}], "temperature": 0, "max_tokens": 0}'
headers:
AGENT-MODE:
- AAAAAAAAAAAAAAAAAAAAAMLheAAaAAAA0%2BuSeid%2BULvsea4JtiGRiSDSJSI%3DEUifiRBkKG5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F
AGENT-TYPE:
- Auto-GPT-2023-X-TYPE
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '6625'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA7SUS27bMBCG9z3FYNay4bdjbYsujHZVNJtWhUFRY4mxxBHIce3A8Gl6k56soCy/
lCyCFlkJmsfP7x9qdECTYYy6UKKruuzNPy+sfE8n43w5/DKdcTFbLstP86/y/PTxESPk9Im0tB19
zVVdkhi2GKF2pIQyjIezh+lg/DAbDCOsOKMSY8xr6Y37055sXcq9wXgwxAi3XuWE8QFrx1UtK+EN
WY/xcDIbRXgVvyRGk3mEwqLKa+18sDhGqAs2mjzGPw5YkT8LOy4JY1TeGy/KSsBkK2SDhUNiAQAS
lIK3eSE+wRjaYJugvYRggkso1C+CNW9tBlIQ1M5oAl43Lynzpg9LsEQZCMPWUxPfOSO0El6tTUmg
uaqUbQqaxI2OMChoiqyqKIPU8c7TakepN0J92UuQ18qGHnvRF+U3q3ZOd/qX2Lmqn2B068yR8myN
zc/2/hn9ZgRvsvGtIBu1Zv7fR10qe7LQg8f3RU8Sez3j7cQdYO2MGG181R18pTYEfutCpxJYgqoa
YGPzRkuzc6QFjF2zq1TYi9AWUg12c37ovESMh5RCe7uZYOydUmbCg91zd6i+JrU58+1MWb73V9HA
v3bXJ6pjdN7U9sQXixqET8B3hB1fyuXdHT8lQu1V4pWrv9Xp/hr+/B5N+w+LM2wD3HIn9ojHCNfG
Gl+sTjuHMXrhGiM0NqM9xoPjz+OHvwAAAP//AwCkoYsdiAUAAA==
headers:
Access-Control-Allow-Origin:
- '*'
Alt-Svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control:
- no-cache, must-revalidate
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 7ccfc55dc9dee1ad-ORD
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Thu, 25 May 2023 18:17:12 GMT
Function-Execution-Id:
- pbmegdid7glm
Openai-Model:
- gpt-3.5-turbo-0301
Openai-Organization:
- significant-gravitas
Openai-Processing-Ms:
- '30081'
Openai-Version:
- '2020-10-01'
Server:
- Google Frontend
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Cloud-Trace-Context:
- a847bfe80cefa41d8c90162f62421032;o=1
X-Powered-By:
- Express
X-Ratelimit-Limit-Requests:
- '3500'
X-Ratelimit-Limit-Tokens:
- '90000'
X-Ratelimit-Remaining-Requests:
- '3499'
X-Ratelimit-Remaining-Tokens:
- '85948'
X-Ratelimit-Reset-Requests:
- 17ms
X-Ratelimit-Reset-Tokens:
- 2.701s
X-Request-Id:
- 2138028baa9d1b5c4544e7197979eb65
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 below 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 a 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 hyperlinks, 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"}, {"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. I will then write the price to a file named
browse_website.txt. I can then use the task_complete command to complete the
task.\",\n \"reasoning\": \"I need to use the browse_website command
to visit the website and find the price of the book. I will then use the write_to_file
command to write the price to a file named browse_website.txt. Finally, I can
use the task_complete command to complete the task.\",\n \"plan\": \"-
Use the browse_website command to visit http://books.toscrape.com/catalogue/meditations_33/index.html
and find the price of the book\\n- Use the write_to_file command to 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 ensure that I am using
the correct URL and question for the browse_website command. I also need to
make sure that I am writing the correct information to the file.\",\n \"speak\":
\"I will use the browse_website command to visit the website and find the price
of the book. Then, I will write the price to a file named browse_website.txt
and complete the task.\"\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: Answer gathered from website: a
description of the book \"Meditations\" by Marcus Aurelius, which is available
for purchase on a demo website for web scraping purposes. The price of the book
is \u00a325.89, but the website warns that the prices and ratings are randomly
assigned and have no real meaning. The book offers spiritual reflections and
exercises developed by the Roman emperor and philosopher, covering topics such
as moral virtue, human rationality, and divine providence. It is considered
one of the greatest works of philosophy and has been admired by thinkers and
readers throughout history.\n\nLinks: [''Books to Scrape (http://books.toscrape.com/index.html)'',
''Home (http://books.toscrape.com/index.html)'', ''Books (http://books.toscrape.com/catalogue/category/books_1/index.html)'',
''Philosophy (http://books.toscrape.com/catalogue/category/books/philosophy_7/index.html)'',
'' (http://books.toscrape.com/catalogue/the-nicomachean-ethics_75/index.html)'']"},
{"role": "user", "content": "Determine which next command to use, and respond
using the format specified above:"}, {"role": "assistant", "content": "{\n \"thoughts\":
{\n \"text\": \"I have found the price of the book. I need to use the
write_to_file command to write the price to a file named browse_website.txt.
I can then use the task_complete command to complete the task.\",\n \"reasoning\":
\"I need to use the write_to_file command to write the price of the book to
a file named browse_website.txt. Then, I can use the task_complete command to
complete the task.\",\n \"plan\": \"- Use the write_to_file command to
write the price of the book to a file named browse_website.txt\\n- Use the task_complete
command to complete the task\",\n \"criticism\": \"I need to make sure
that I am writing the correct information to the file and that the file is being
created in the correct directory.\",\n \"speak\": \"I will use the write_to_file
command to write the price of the book to a file named browse_website.txt and
complete the task.\"\n },\n \"command\": {\n \"name\": \"write_to_file\",\n \"args\":
{\n \"filename\": \"browse_website.txt\",\n \"text\":
\"\u00a325.89\"\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": 0}'
headers:
AGENT-MODE:
- AAAAAAAAAAAAAAAAAAAAAMLheAAaAAAA0%2BuSeid%2BULvsea4JtiGRiSDSJSI%3DEUifiRBkKG5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F
AGENT-TYPE:
- Auto-GPT-2023-X-TYPE
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '8003'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA6xSTY/TMBC98ytGc06rlm7bbY5wqrggBEiIoJXrTBMTxxPZE9pVlf+OnKabblmx
EuLoNzPvYzwnNDmmqEslum7sZP1hw1+L4iOXd/lm3byffbKHu+O7qpXttwoT5N1P0jJMTDXXjSUx
7DBB7UkJ5ZjOV/fL2eJ+tdgkWHNOFlMsGpkspsuJtH7Hk9liNscE26AKwvSEjee6kQfhilzAdL5e
zhMcya8LCQqLsiO0ebvqEtQlG00B0+8nrClciD1bwhRVCCaIchJtshNyMcIpcwAAGUrJbVFKyDCF
ARwKdJQIZriFUv0iGDxRDlISiArVFLaglQPHB2gDPeEPl9Y4UyuXgzCEshXI+eD6NlWQk2mGybWk
JxXYGVe8ogu8h71xuXFFjzXeaIpgfOyYK4iaB28kdhiJ8gr2xtL/dtxY5c5mJ/DlH/hu6HS0rE2o
LwtwRP1orSqC0PqooOQvMibAjmLqNlAOmr0nLfaxX8jTaC89to6+Gs8Neft4GzM0pKrXPqXfubG2
X+4LWaENlw970fs0w7Nml1yOc6j8cZtO1XS284zpxrXyxe1ZX9/ZmeBztD6mCa3WFMK+tf0Wxslu
8Ja5DrsE98aZUD6cmTDFINxggsbldMR01v3o3vwGAAD//wMARwk3SV8EAAA=
headers:
Access-Control-Allow-Origin:
- '*'
Alt-Svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control:
- no-cache, must-revalidate
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 7ccfc64648bb10cb-ORD
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Thu, 25 May 2023 18:17:38 GMT
Function-Execution-Id:
- yvvl2c4sntif
Openai-Model:
- gpt-3.5-turbo-0301
Openai-Organization:
- significant-gravitas
Openai-Processing-Ms:
- '18885'
Openai-Version:
- '2020-10-01'
Server:
- Google Frontend
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Cloud-Trace-Context:
- df845088a79f4f2e92c980eb9a6e2e52
X-Powered-By:
- Express
X-Ratelimit-Limit-Requests:
- '3500'
X-Ratelimit-Limit-Tokens:
- '90000'
X-Ratelimit-Remaining-Requests:
- '3499'
X-Ratelimit-Remaining-Tokens:
- '85933'
X-Ratelimit-Reset-Requests:
- 17ms
X-Ratelimit-Reset-Tokens:
- 2.71s
X-Request-Id:
- d91688703794f0cfd634cd4bd337530d
status:
code: 200
message: OK
version: 1

View File

@@ -1350,4 +1350,231 @@ interactions:
status:
code: 200
message: OK
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You
are write_to_file-GPT, an AI designed to use the write_to_file command to write
''Hello World'' into a file named \"hello_world.txt\" and then 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 write_to_file
command to write ''Hello World'' into a file named \"hello_world.txt\".\n2.
Use the task_complete command to complete the task.\n3. 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 below 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 a file, args: \"filename\": \"<filename>\"\n5. write_to_file:
Write to file, args: \"filename\": \"<filename>\", \"text\": \"<text>\"\n6.
delete_agent: Delete GPT Agent, args: \"key\": \"<key>\"\n7. get_hyperlinks:
Get hyperlinks, args: \"url\": \"<url>\"\n8. get_text_summary: Get text summary,
args: \"url\": \"<url>\", \"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.
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"}, {"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 write_to_file
command to write ''Hello World'' into a file named ''hello_world.txt''.\",\n \"reasoning\":
\"The task requires me to write ''Hello World'' into a file named ''hello_world.txt'',
and the write_to_file command is the appropriate command 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 use
the correct filename and text to write to the file.\",\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": 0}'
headers:
AGENT-MODE:
- AAAAAAAAAAAAAAAAAAAAAMLheAAaAAAA0%2BuSeid%2BULvsea4JtiGRiSDSJSI%3DEUifiRBkKG5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F
AGENT-TYPE:
- Auto-GPT-2023-X-TYPE
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '4608'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA7RSy27bQAy89ysIXnyRDTuGnVhfUCOHFoiLBqgKY7Oipa1XXHWXip0a+vdCLyhN
XwjQ3hYccjjDnQuaFGPUuRJdlHZ6fbtxUu5MOHx72vo7qdanbHl9f3/1jm/fY4Tu4Qtp6Sdm2hWl
JTGOMULtSQmlGC/WN6v58ma9XkZYuJQsxpiVMl3OVlOp/IObzpfzBUZYBZURxhcsvStK2Ys7EgeM
F/PFJsKRfAQ26wjFibJj6WqxqiPUuTOaAsafLlhQGIi9s4QxqhBMEMXSyHQsxI2FS8IAAAlK7qos
l5BgDH2xB+gsTTHBLeTqkSBUWlMIh8raJzh5I0IMk7dkrYOPztt0AobFgYKDsQSsCkphkjf4/tTg
MznLZAa7nIDpLKBdUShOQRxUgcAEEBWO+947NfXxnVOLzhKMnqv0pIJjw1kndde3gaevlfEUoGh5
Grn0erHQysuJfyEE7gxrgj8dR1zb3myI2tc/s11axZ3jKXwIY9/I8mzLX9m0N2K0CcXw30zUThKH
yjdzSmALpXePJiVQ0F0dDs4P5Iaz39KHktRxoD4Za1vfr5bcUdbRkNy+/afgNn/ZbfuB/oUo5bOX
mX+eqP+R/MFCa6N3k3CNdYQHwybk+243xhjElRih4ZTOGM/rz/Wb7wAAAP//AwDKh13FrgQAAA==
headers:
Access-Control-Allow-Origin:
- '*'
Alt-Svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control:
- no-cache, must-revalidate
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 7ccfc6e12bd2e1ef-ORD
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Thu, 25 May 2023 18:18:06 GMT
Function-Execution-Id:
- yvvlex8job2h
Openai-Model:
- gpt-3.5-turbo-0301
Openai-Organization:
- significant-gravitas
Openai-Processing-Ms:
- '22621'
Openai-Version:
- '2020-10-01'
Server:
- Google Frontend
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Cloud-Trace-Context:
- 827e911ff253a9d12783cb62e669dc20;o=1
X-Powered-By:
- Express
X-Ratelimit-Limit-Requests:
- '3500'
X-Ratelimit-Limit-Tokens:
- '90000'
X-Ratelimit-Remaining-Requests:
- '3499'
X-Ratelimit-Remaining-Tokens:
- '86005'
X-Ratelimit-Reset-Requests:
- 17ms
X-Ratelimit-Reset-Tokens:
- 2.663s
X-Request-Id:
- 4d357db894485be6e259654a899f2e57
status:
code: 200
message: OK
- request:
body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Write
a concise summary of the following text:\n\n\nLITERAL TEXT: \"\"\"Hello World\"\"\"\n\n\nCONCISE
SUMMARY: The text is best summarized as"}], "temperature": 0, "max_tokens":
0}'
headers:
AGENT-MODE:
- AAAAAAAAAAAAAAAAAAAAAMLheAAaAAAA0%2BuSeid%2BULvsea4JtiGRiSDSJSI%3DEUifiRBkKG5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F
AGENT-TYPE:
- Auto-GPT-2023-X-TYPE
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '252'
Content-Type:
- application/json
method: POST
uri: https://api.openai.com/v1/chat/completions
response:
body:
string: !!binary |
H4sIAAAAAAAAA0SOQUvDQBQG7/6K8J03JSVpmu7RU7GIXooHK2WbvCarm33L7qsoIf9dClqvAzPM
BNtBox2MtGNw+Xq3CQ9DXFfPj09Oim5Xu+3+u9oO+/tPhgKf3qmVX2PR8hgciWUPhTaSEeqgl3Wz
KsqmbjYKI3fkoNEHycvFKpdLPHFelMUSCpdkeoKeECKPQY7CH+QTdFkr/KdvuFEQFuNuoKpmhXZg
21KCfp0wUvpLRnYEDZOSTWK8XAfZC/nrvMmSveazPhKJ9X3G5+yALTnH2QtH1y0OwKxwtt6m4RjJ
JPbQSMIBCtZ39AVdzG/z3Q8AAAD//wMAv00f4UIBAAA=
headers:
Access-Control-Allow-Origin:
- '*'
Alt-Svc:
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control:
- no-cache, must-revalidate
Cf-Cache-Status:
- DYNAMIC
Cf-Ray:
- 7ccfc7839fad10e3-ORD
Content-Encoding:
- gzip
Content-Type:
- application/json
Date:
- Thu, 25 May 2023 18:18:11 GMT
Function-Execution-Id:
- pbme9het6dvt
Openai-Model:
- gpt-3.5-turbo-0301
Openai-Organization:
- significant-gravitas
Openai-Processing-Ms:
- '1227'
Openai-Version:
- '2020-10-01'
Server:
- Google Frontend
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Cloud-Trace-Context:
- 4a9b8edee07c9658c887ffc760c711e6;o=1
X-Powered-By:
- Express
X-Ratelimit-Limit-Requests:
- '3500'
X-Ratelimit-Limit-Tokens:
- '90000'
X-Ratelimit-Remaining-Requests:
- '3499'
X-Ratelimit-Remaining-Tokens:
- '89466'
X-Ratelimit-Reset-Requests:
- 17ms
X-Ratelimit-Reset-Tokens:
- 356ms
X-Request-Id:
- fb5593e05606c34e2e9461ff82b28747
status:
code: 200
message: OK
version: 1

View File

@@ -1,8 +1,6 @@
import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
from tests.integration.challenges.utils import run_interaction_loop
from tests.utils import requires_api_key
@@ -13,11 +11,11 @@ CYCLE_COUNT = 2
@pytest.mark.vcr
def test_browse_website(
browser_agent: Agent,
patched_api_requestor: MockerFixture,
patched_api_requestor: None,
monkeypatch: pytest.MonkeyPatch,
) -> None:
file_path = browser_agent.workspace.get_path("browse_website.txt")
run_interaction_loop(monkeypatch, browser_agent, CYCLE_COUNT)
content = read_file(file_path)
content = open(file_path, encoding="utf-8").read()
assert "£25.89" in content, f"Expected £25.89, got {content}"

View File

@@ -1,5 +1,4 @@
import pytest
from pytest_mock import MockerFixture
from autogpt.agent import Agent
from autogpt.commands.file_operations import read_file
@@ -13,7 +12,7 @@ CYCLE_COUNT = 3
@pytest.mark.vcr
def test_write_file(
writer_agent: Agent,
patched_api_requestor: MockerFixture,
patched_api_requestor: None,
monkeypatch: pytest.MonkeyPatch,
) -> None:
file_path = str(writer_agent.workspace.get_path("hello_world.txt"))