diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea87ba2f..c2afde55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,10 @@ jobs: run: isort . --check if: success() || failure() + - name: Check mypy formatting + run: mypy + if: success() || failure() + test: permissions: # Gives the action the necessary permissions for publishing new diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2ea6114..345d88be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,10 @@ repos: hooks: - id: black language_version: python3.10 + - repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v1.3.0' + hooks: + - id: mypy - repo: local hooks: diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000..b977deb0 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,10 @@ +[mypy] +follow_imports = skip +check_untyped_defs = True +disallow_untyped_defs = True +files = tests/integration/challenges/**/*.py + +[mypy-requests.*] +ignore_missing_imports = True +[mypy-yaml.*] +ignore_missing_imports = True diff --git a/requirements.txt b/requirements.txt index c59b8bb6..3c997b57 100644 --- a/requirements.txt +++ b/requirements.txt @@ -36,7 +36,7 @@ gitpython==3.1.31 auto-gpt-plugin-template mkdocs pymdown-extensions - +mypy # OpenAI and Generic plugins import openapi-python-client==0.13.4 diff --git a/tests/integration/agent_factory.py b/tests/integration/agent_factory.py index 12e06721..b96953fe 100644 --- a/tests/integration/agent_factory.py +++ b/tests/integration/agent_factory.py @@ -12,7 +12,7 @@ from autogpt.workspace import Workspace def agent_test_config(config: Config): was_continuous_mode = config.continuous_mode was_temperature = config.temperature - config.set_continuous_mode(True) + config.set_continuous_mode(False) config.set_temperature(0) yield config config.set_continuous_mode(was_continuous_mode) diff --git a/tests/integration/agent_utils.py b/tests/integration/agent_utils.py deleted file mode 100644 index a899afcf..00000000 --- a/tests/integration/agent_utils.py +++ /dev/null @@ -1,12 +0,0 @@ -import concurrent.futures - -from autogpt.agent.agent import Agent - - -def run_interaction_loop(agent: Agent, timeout: float | None): - with concurrent.futures.ThreadPoolExecutor() as executor: - future = executor.submit(agent.start_interaction_loop) - try: - result = future.result(timeout=timeout) - except concurrent.futures.TimeoutError: - assert False, f"The process took longer than {timeout} seconds to complete." diff --git a/tests/integration/challenges/basic_abilities/__init__.py b/tests/integration/challenges/basic_abilities/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/integration/goal_oriented/cassettes/test_browse_website/test_browse_website.yaml b/tests/integration/challenges/basic_abilities/cassettes/test_browse_website/test_browse_website.yaml similarity index 100% rename from tests/integration/goal_oriented/cassettes/test_browse_website/test_browse_website.yaml rename to tests/integration/challenges/basic_abilities/cassettes/test_browse_website/test_browse_website.yaml diff --git a/tests/integration/goal_oriented/cassettes/test_write_file/test_write_file.yaml b/tests/integration/challenges/basic_abilities/cassettes/test_write_file/test_write_file.yaml similarity index 100% rename from tests/integration/goal_oriented/cassettes/test_write_file/test_write_file.yaml rename to tests/integration/challenges/basic_abilities/cassettes/test_write_file/test_write_file.yaml diff --git a/tests/integration/goal_oriented/goal_oriented_tasks.md b/tests/integration/challenges/basic_abilities/goal_oriented_tasks.md similarity index 100% rename from tests/integration/goal_oriented/goal_oriented_tasks.md rename to tests/integration/challenges/basic_abilities/goal_oriented_tasks.md diff --git a/tests/integration/challenges/basic_abilities/test_browse_website.py b/tests/integration/challenges/basic_abilities/test_browse_website.py new file mode 100644 index 00000000..1afe10cc --- /dev/null +++ b/tests/integration/challenges/basic_abilities/test_browse_website.py @@ -0,0 +1,23 @@ +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 + +CYCLE_COUNT = 2 + + +@requires_api_key("OPENAI_API_KEY") +@pytest.mark.vcr +def test_browse_website( + browser_agent: Agent, + patched_api_requestor: MockerFixture, + 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) + assert "£25.89" in content, f"Expected £25.89, got {content}" diff --git a/tests/integration/challenges/basic_abilities/test_write_file.py b/tests/integration/challenges/basic_abilities/test_write_file.py new file mode 100644 index 00000000..36a97733 --- /dev/null +++ b/tests/integration/challenges/basic_abilities/test_write_file.py @@ -0,0 +1,23 @@ +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 + +CYCLE_COUNT = 3 + + +@requires_api_key("OPENAI_API_KEY") +@pytest.mark.vcr +def test_write_file( + writer_agent: Agent, + patched_api_requestor: MockerFixture, + monkeypatch: pytest.MonkeyPatch, +) -> None: + file_path = str(writer_agent.workspace.get_path("hello_world.txt")) + run_interaction_loop(monkeypatch, writer_agent, CYCLE_COUNT) + + content = read_file(file_path) + assert content == "Hello World", f"Expected 'Hello World', got {content}" diff --git a/tests/integration/challenges/conftest.py b/tests/integration/challenges/conftest.py index dce4518d..9bb5a1a4 100644 --- a/tests/integration/challenges/conftest.py +++ b/tests/integration/challenges/conftest.py @@ -1,17 +1,21 @@ import pytest +from _pytest.config import Config +from _pytest.config.argparsing import Parser +from _pytest.fixtures import FixtureRequest +from _pytest.monkeypatch import MonkeyPatch -def pytest_addoption(parser): +def pytest_addoption(parser: Parser) -> None: parser.addoption( "--level", action="store", default=None, type=int, help="Specify test level" ) -def pytest_configure(config): +def pytest_configure(config: Config) -> None: config.option.level = config.getoption("--level") @pytest.fixture -def user_selected_level(request) -> int: +def user_selected_level(request: FixtureRequest) -> int: ## used for challenges in the goal oriented tests return request.config.option.level diff --git a/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py b/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py index b96e811a..0bf7bfe6 100644 --- a/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py +++ b/tests/integration/challenges/information_retrieval/test_information_retrieval_challenge_a.py @@ -1,32 +1,22 @@ -import contextlib -from functools import wraps -from typing import Generator - import pytest +from pytest_mock import MockerFixture from autogpt.commands.file_operations import read_file, write_to_file -from tests.integration.agent_utils import run_interaction_loop -from tests.integration.challenges.utils import run_multiple_times +from tests.integration.challenges.utils import run_interaction_loop, run_multiple_times from tests.utils import requires_api_key - -def input_generator(input_sequence: list) -> Generator[str, None, None]: - """ - Creates a generator that yields input strings from the given sequence. - - :param input_sequence: A list of input strings. - :return: A generator that yields input strings. - """ - yield from input_sequence +CYCLE_COUNT = 3 +from autogpt.agent import Agent -# @pytest.skip("Nobody beat this challenge yet") @pytest.mark.skip("This challenge hasn't been beaten yet.") @pytest.mark.vcr @requires_api_key("OPENAI_API_KEY") @run_multiple_times(3) def test_information_retrieval_challenge_a( - get_company_revenue_agent, monkeypatch, patched_api_requestor + get_company_revenue_agent: Agent, + monkeypatch: pytest.MonkeyPatch, + patched_api_requestor: MockerFixture, ) -> None: """ Test the challenge_a function in a given agent by mocking user inputs and checking the output file content. @@ -34,12 +24,7 @@ def test_information_retrieval_challenge_a( :param get_company_revenue_agent: The agent to test. :param monkeypatch: pytest's monkeypatch utility for modifying builtins. """ - input_sequence = ["s", "s", "s", "s", "s", "EXIT"] - gen = input_generator(input_sequence) - monkeypatch.setattr("builtins.input", lambda _: next(gen)) - - with contextlib.suppress(SystemExit): - run_interaction_loop(get_company_revenue_agent, None) + run_interaction_loop(monkeypatch, get_company_revenue_agent, CYCLE_COUNT) file_path = str(get_company_revenue_agent.workspace.get_path("output.txt")) content = read_file(file_path) diff --git a/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py b/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py index 79228203..b8ae3004 100644 --- a/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py +++ b/tests/integration/challenges/kubernetes/test_kubernetes_template_challenge_a.py @@ -1,30 +1,21 @@ -import contextlib -from typing import Generator - import pytest import yaml +from autogpt.agent import Agent from autogpt.commands.file_operations import read_file -from tests.integration.agent_utils import run_interaction_loop -from tests.integration.challenges.utils import run_multiple_times +from tests.integration.challenges.utils import run_interaction_loop, run_multiple_times from tests.utils import requires_api_key - -def input_generator(input_sequence: list) -> Generator[str, None, None]: - """ - Creates a generator that yields input strings from the given sequence. - - :param input_sequence: A list of input strings. - :return: A generator that yields input strings. - """ - yield from input_sequence +CYCLE_COUNT = 6 @pytest.mark.skip("This challenge hasn't been beaten yet.") @pytest.mark.vcr @requires_api_key("OPENAI_API_KEY") @run_multiple_times(3) -def test_information_retrieval_challenge_a(kubernetes_agent, monkeypatch) -> None: +def test_kubernetes_template_challenge_a( + kubernetes_agent: Agent, monkeypatch: pytest.MonkeyPatch +) -> None: """ Test the challenge_a function in a given agent by mocking user inputs and checking the output file content. @@ -32,12 +23,7 @@ def test_information_retrieval_challenge_a(kubernetes_agent, monkeypatch) -> Non :param get_company_revenue_agent: The agent to test. :param monkeypatch: pytest's monkeypatch utility for modifying builtins. """ - input_sequence = ["s", "s", "s", "s", "s", "EXIT"] - gen = input_generator(input_sequence) - monkeypatch.setattr("builtins.input", lambda _: next(gen)) - - with contextlib.suppress(SystemExit): - run_interaction_loop(kubernetes_agent, None) + run_interaction_loop(monkeypatch, kubernetes_agent, CYCLE_COUNT) file_path = str(kubernetes_agent.workspace.get_path("kube.yaml")) content = read_file(file_path) diff --git a/tests/integration/challenges/memory/cassettes/test_memory_challenge_c/test_memory_challenge_c.yaml b/tests/integration/challenges/memory/cassettes/test_memory_challenge_c/test_memory_challenge_c.yaml index a4c6636e..15110227 100644 --- a/tests/integration/challenges/memory/cassettes/test_memory_challenge_c/test_memory_challenge_c.yaml +++ b/tests/integration/challenges/memory/cassettes/test_memory_challenge_c/test_memory_challenge_c.yaml @@ -550,4 +550,860 @@ interactions: status: code: 200 message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You + are Follow-Instructions-GPT, an AI designed to read the instructions_1.txt file + using the read_file method and follow the instructions in the file.\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 command read_file to read the instructions_1.txt file\n2. Follow the + instructions in the instructions_1.txt file\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\": \"\", \"text\": \"\"\n2. delete_file: + Delete file, args: \"filename\": \"\"\n3. list_files: List Files in + Directory, args: \"directory\": \"\"\n4. read_file: Read file, args: + \"filename\": \"\"\n5. write_to_file: Write to file, args: \"filename\": + \"\", \"text\": \"\"\n6. delete_agent: Delete GPT Agent, args: + \"key\": \"\"\n7. get_hyperlinks: Get text summary, args: \"url\": \"\"\n8. + get_text_summary: Get text summary, args: \"url\": \"\", \"question\": + \"\"\n9. list_agents: List GPT Agents, args: () -> str\n10. message_agent: + Message GPT Agent, args: \"key\": \"\", \"message\": \"\"\n11. + start_agent: Start GPT Agent, args: \"name\": \"\", \"task\": \"\", + \"prompt\": \"\"\n12. task_complete: Task Complete (Shutdown), args: + \"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 should start by reading + the instructions_1.txt file using the read_file command.\",\n \"reasoning\": + \"The first step is to understand the instructions and the tasks that need to + be performed.\",\n \"plan\": \"- Use the read_file command to read the + instructions_1.txt file\\n- Analyze the instructions and determine the next + steps\",\n \"criticism\": \"I need to ensure that I understand the instructions + completely before proceeding with any tasks.\",\n \"speak\": \"I will + start by reading the instructions file.\"\n },\n \"command\": {\n \"name\": + \"read_file\",\n \"args\": {\n \"filename\": \"instructions_1.txt\"\n }\n }\n}"}, + {"role": "system", "content": "Command read_file returned: nBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nThis + phrase is ''The purple elephant danced on a rainbow while eating a taco.''\nnBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nWrite + all the phrases into the file output.txt. The file has not been created yet. + After that, use the task_complete command.\n"}, {"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: + - '6599' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA5STy27bQAxF9/0KgmvZsGMnKbQO0mRVFEhWVWGMR4w0tUSqMxTswvC/F3pZjeoE + zUIbvnQu5/KILsUYbW7UllUxu/3yfFvfufR5vftmCr9+fFgdnu4X96m7e7jHCGX7k6z2HXMrZVWQ + OmGM0HoySinGy5vP6+XNar1cRFhKSgXGmFU6W82vZ1r7rcwWq8USI6yDyQjjI1Zeyko3KjvigPHV + erGOcBw+Jq6WEaqoKcbQzdX1KUKbi7MUMP5+xJLCMNhLQRijCcEFNawNprASNxKOCQMAJKi51Fmu + IcEY+mCfoIM2wQQfgYlSUIG9d0qgOUGVexMogGOVNiC1VrXO9aDw4gqCOjjO2kzbtFHZtHErZWk4 + hebTnBjq0E1UE3abXvdYpgLn2FA1TzD6m9STCcKOsw73qS8DT79q5ylASe/Am5Y3giDwCHtXFGei + i+Bz+Mp2ZAEXzoDRdMCbkkJeK6Sy57bMZMQ6FVUVhjs9M3h+D+hj75IkPM77/5VP4Kx36qwL5dQg + xKH2TZvRVzjGd/RKDFa8J6vF77fNs6UX8TRgDEa69PahIrMbKNrlf8CjZw9eslj3l1M0HEq/nn/u + hE1JHcCr55lwGp9NT6xLNLXjiJHwVf/0IhuLV7WvCgIqqMoNK6SGLaUgDAa8cbyVPezzRiaZdoUG + 1FiZJwkP4lqBvc6ET3iK8MWxC/mmOymMMahUGKHjlA4YL04/Tp/+AAAA//8DALF+obc3BQAA + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c4e5cef41ce34-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:10: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: + - '20220' + 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: + - '87369' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 1.754s + x-request-id: + - 9cf7adfb755b717551ad7364f2c9ccd6 + status: + code: 200 + message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Your + task is to create a concise running summary of actions and information results + in the provided text, focusing on key and potentially important information + to remember.\n\nYou will receive the current summary and the your latest actions. + Combine them, adding relevant key information from the latest development in + 1st person past tense and keeping the summary concise.\n\nSummary So Far:\n\"\"\"\n{''role'': + ''system'', ''content'': ''This reminds you of these events from your past: + \\nI was created and nothing new has happened.''}\n\"\"\"\n\nLatest Development:\n\"\"\"\n[{''role'': + ''you'', ''content'': ''{\"command\": {\"name\": \"read_file\", \"args\": {\"filename\": + \"instructions_1.txt\"}}}''}]\n\"\"\"\n"}], "temperature": 0, "max_tokens": + 0}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '814' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA0SPTUtDMRBF9/6KYdbpo8+nbc3OlbaggiAKKiUm075okgnJ1LaU/nd54sf2cu/h + 3AN6hxptb8TGHEbTq4fZ9Xz//rQIt3lxvzf3V3c3/nG9WlzezVEhv72TlZ9FYznmQOI5oUJbyAg5 + 1O1kdtZOurOuUxjZUUCN6yyjrjkfyaa88WjcjVtUuKlmTagPmAvHLEvhD0oVdXveKvxn/+WnM4XC + YsJ/c3pxVGh79pYq6ucDRqq/1MKBUKOp1VcxSQZHTkJp8J/D1lQoFH1y5IBXEPfwfcFzApMcSG8E + Ekvv0xoSbaE3FXqTMyVyDcyhkCX/SQ4MWI7xe8NQyAzJygcCa0IgBy/oU5WysQO7LttGdvKCDR4V + rnzytV8WMpUTaqzCGRUOUjvU4+Pr8eQLAAD//wMAE8xbWKMBAAA= + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c4ef19a03ce34-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:10:35 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: + - '2672' + 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: + - '89815' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 122ms + x-request-id: + - bb82e64d01f00403286b9b4bd16d4c51 + status: + code: 200 + message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You + are Follow-Instructions-GPT, an AI designed to read the instructions_1.txt file + using the read_file method and follow the instructions in the file.\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 command read_file to read the instructions_1.txt file\n2. Follow the + instructions in the instructions_1.txt file\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\": \"\", \"text\": \"\"\n2. delete_file: + Delete file, args: \"filename\": \"\"\n3. list_files: List Files in + Directory, args: \"directory\": \"\"\n4. read_file: Read file, args: + \"filename\": \"\"\n5. write_to_file: Write to file, args: \"filename\": + \"\", \"text\": \"\"\n6. delete_agent: Delete GPT Agent, args: + \"key\": \"\"\n7. get_hyperlinks: Get text summary, args: \"url\": \"\"\n8. + get_text_summary: Get text summary, args: \"url\": \"\", \"question\": + \"\"\n9. list_agents: List GPT Agents, args: () -> str\n10. message_agent: + Message GPT Agent, args: \"key\": \"\", \"message\": \"\"\n11. + start_agent: Start GPT Agent, args: \"name\": \"\", \"task\": \"\", + \"prompt\": \"\"\n12. task_complete: Task Complete (Shutdown), args: + \"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 reminded of my creation + and that nothing new has happened. I received a command to read a file called + \"instructions_1.txt\"."}, {"role": "system", "content": "Command read_file + returned: nBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nThis + phrase is ''The purple elephant danced on a rainbow while eating a taco.''\nnBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nWrite + all the phrases into the file output.txt. The file has not been created yet. + After that, use the task_complete command.\n"}, {"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 write the phrases into the output.txt file using the write_to_file + command and then use the task_complete command to complete the task.\",\n \"reasoning\": + \"The task requires me to write the phrases into a file, so I will use the write_to_file + command. Once the task is complete, I will use the task_complete command to + shut down the agent.\",\n \"plan\": \"- Use the write_to_file command + to write the phrases into the output.txt file\\n- Use the task_complete command + to complete the task\",\n \"criticism\": \"I need to ensure that the + phrases are written correctly into the output.txt file before completing the + task.\",\n \"speak\": \"I will write the phrases into the output.txt + file and then complete the task.\"\n },\n \"command\": {\n \"name\": + \"write_to_file\",\n \"args\": {\n \"filename\": \"output.txt\",\n \"text\": + \"The purple elephant danced on a rainbow while eating a taco.\\n\"\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: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '7082' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA5SST2/TQBDF73yK0ZydKCGtqXyrQKCqIC4UIWoUbdYTe5v1rOUZN4HI3x0lttMm + IEW5zp+3v/d2tugyTNAWRm1Z+dG7Tw839/zz9vnr5z9fFu9v/Yen2Yrlx/f19OM9RhgWT2S13xjb + UFae1AXGCG1NRinDZBrfXE3j2dUsjrAMGXlMMK90NBtfj7SpF2E0mU2mGGEjJidMtljVoax0rmFF + LJi8vZ7EEb6IHxrTeBKhBjX+ZTaO4zZCWwRnSTB53GJJMgjXwRMmaEScqGHdYQZW4p2FbcoAAClq + EZq8UEkxgb7YN2iju2KKd1CYZwJprCWRZeP9b1jXTpUYtCCoitoICTjWsC+ERqtGx7pRWDpPY7iD + tfMeOKyhEdrPqJHVvLdJYENZGs5AAxxqw9Q4xeg1WE1GAjvOO7pv/RgURmBBxAeF7Ag5AgkDyFkI + KRqFLKw7gyYn1lOMyhvuCEbwcLGpEzFbO3XWSTkkzkT7RWJp6t2a0cPuOaewoGWoaW9CHednjEhF + ZnVZlkc/+v+suhfaaLizPox/zoxNSd3jR+GdMJo6P73Q18dwIf1AtyfsQVNusY1w6dhJMe9kMUHR + UGGEjjPaYDJpf7Vv/gIAAP//AwDVHqaiNwQAAA== + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c4f033fb8ce34-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:10:50 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: + - '14190' + 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: + - '87343' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 1.77s + x-request-id: + - efeb33e59612d816eca6bb4263edce4e + status: + code: 200 + message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You + are Follow-Instructions-GPT, an AI designed to read the instructions_1.txt file + using the read_file method and follow the instructions in the file.\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 command read_file to read the instructions_1.txt file\n2. Follow the + instructions in the instructions_1.txt file\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\": \"\", \"text\": \"\"\n2. delete_file: + Delete file, args: \"filename\": \"\"\n3. list_files: List Files in + Directory, args: \"directory\": \"\"\n4. read_file: Read file, args: + \"filename\": \"\"\n5. write_to_file: Write to file, args: \"filename\": + \"\", \"text\": \"\"\n6. delete_agent: Delete GPT Agent, args: + \"key\": \"\"\n7. get_hyperlinks: Get text summary, args: \"url\": \"\"\n8. + get_text_summary: Get text summary, args: \"url\": \"\", \"question\": + \"\"\n9. list_agents: List GPT Agents, args: () -> str\n10. message_agent: + Message GPT Agent, args: \"key\": \"\", \"message\": \"\"\n11. + start_agent: Start GPT Agent, args: \"name\": \"\", \"task\": \"\", + \"prompt\": \"\"\n12. task_complete: Task Complete (Shutdown), args: + \"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 should start by reading + the instructions_1.txt file using the read_file command.\",\n \"reasoning\": + \"The first step is to understand the instructions and the tasks that need to + be performed.\",\n \"plan\": \"- Use the read_file command to read the + instructions_1.txt file\\n- Analyze the instructions and determine the next + steps\",\n \"criticism\": \"I need to ensure that I understand the instructions + completely before proceeding with any tasks.\",\n \"speak\": \"I will + start by reading the instructions file.\"\n },\n \"command\": {\n \"name\": + \"read_file\",\n \"args\": {\n \"filename\": \"instructions_1.txt\"\n }\n }\n}"}, + {"role": "system", "content": "Command read_file returned: nBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nThe + current phrase is ''The purple elephant danced on a rainbow while eating a taco.''.\nnBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nRead + the file instructions_2.txt using the read_file command."}, {"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: + - '6541' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA6yTTWvbQBCG7/0Vw5wl428nuuUQktBLKDYUqmLWq7G09WpW3R0Ru8b/vciSo+K0 + pZBe5+N9n1m9OqLJMEFdKNFlZePFw+qm5O96uVuOsgf3+Gnx+Hz/+X7x8W75vMII3eYbaek2BtqV + lSUxjjFC7UkJZZiM5jfT0XwynU8jLF1GFhPMK4kng1kstd+4eDgZjjDCOqicMDli5V1ZyVrcjjhg + Mp7cjiPsxV8bo5tZhOJE2X52tlicItSFM5oCJl+OWFK4CHtnCRNUIZggiqXBdCzEzQnHlAEAUpTC + 1XkhIcUEumLXoL00xRSXBYHhIL7WDVFYjweyF9gaS9AoKsMBFFgTBNz2XA9gGKQgyIwnLc4fBvAE + oXC1zaAOdO41C+t2WruyVJyBuFamaf9BJ8XoV0xPKjg2nP9nVib6F5xmJCMhXxpur2LaCwShKlyj + VlZxSxnD6j1vkKYcwx0re/jRq/Tn/AXpikh7I0abULZY/dXEofbNshJ4gpoz8k2Gst+4dVEle4AN + bZ0nqLzTRJnhHF6MFKD4AKLC7s2DhIrU7mL9Yqx9dzRa9VN0SXe3/CbcrEpqjXunKzjl8+ufom30 + n+Es8Op6du4AUj7hKcKtYROKdZtRTDCIqzBCwxntMRmevp4+/AQAAP//AwBHX/WchQQAAA== + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c4fb30e7a2566-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:11:20 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: + - '16266' + 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: + - '87370' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 1.752s + x-request-id: + - 20e0d58720f751a589521080b8e101f4 + status: + code: 200 + message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You + are Follow-Instructions-GPT, an AI designed to read the instructions_1.txt file + using the read_file method and follow the instructions in the file.\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 command read_file to read the instructions_1.txt file\n2. Follow the + instructions in the instructions_1.txt file\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\": \"\", \"text\": \"\"\n2. delete_file: + Delete file, args: \"filename\": \"\"\n3. list_files: List Files in + Directory, args: \"directory\": \"\"\n4. read_file: Read file, args: + \"filename\": \"\"\n5. write_to_file: Write to file, args: \"filename\": + \"\", \"text\": \"\"\n6. delete_agent: Delete GPT Agent, args: + \"key\": \"\"\n7. get_hyperlinks: Get text summary, args: \"url\": \"\"\n8. + get_text_summary: Get text summary, args: \"url\": \"\", \"question\": + \"\"\n9. list_agents: List GPT Agents, args: () -> str\n10. message_agent: + Message GPT Agent, args: \"key\": \"\", \"message\": \"\"\n11. + start_agent: Start GPT Agent, args: \"name\": \"\", \"task\": \"\", + \"prompt\": \"\"\n12. task_complete: Task Complete (Shutdown), args: + \"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 reminded of my creation + and that nothing new has happened. I received a command to read a file called + \"instructions_1.txt\"."}, {"role": "system", "content": "Command read_file + returned: nBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nThe + current phrase is ''The purple elephant danced on a rainbow while eating a taco.''.\nnBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\nRead + the file instructions_2.txt using the read_file command."}, {"role": "user", + "content": "Determine which next command to use, and respond using the format + specified above:"}, {"role": "assistant", "content": "{\n \"thoughts\": {\n \"text\": + \"The instructions_2.txt file contains a list of files in the directory. I should + use the list_files command to list the files in the directory.\",\n \"reasoning\": + \"The instructions_2.txt file contains a list of files in the directory. I need + to list the files in the directory to determine the next steps.\",\n \"plan\": + \"- Use the list_files command to list the files in the directory\\n- Analyze + the list of files to determine the next steps\",\n \"criticism\": \"I + need to ensure that I understand the list of files completely before proceeding + with any tasks.\",\n \"speak\": \"I will use the list_files command to + list the files in the directory.\"\n },\n \"command\": {\n \"name\": + \"list_files\",\n \"args\": {\n \"directory\": \".\"\n }\n }\n}"}, + {"role": "system", "content": "Command list_files returned: [''file_logger.txt'', + ''instructions_2.txt'', ''instructions_1.txt'', ''auto-gpt.json'']"}, {"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: + - '6894' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA9yTTW/TQBCG7/yK0Vx6caKmTdLUNxAfDZXgQrlgFG3tiT3t7qzZHdOkUf47sp0Q + lFIhJE4c5+ud5x1pNsgFpphXRnNX28HFu5vL6ecPb+bvP66uJtev/OO3q/L6tbw9u5MxJuhv7yjX + 3cQw9662pOwFE8wDGaUC09F0Nh5Nz8ezcYLOF2QxxbLWwflwMtAm3PrB6fnpCBNsoikJ0w3Wwbta + F+rvSSKmZ+OLSYIH8UNhNE5QvRp7SE1nl9sE88pzThHTLxt0FPfCwVvCFE2MHNWItphelKS1sMkE + ACBDrXxTVhozTGGX3BVopW0yw08VgeWo4JewZEsRWEArgoID5erDGlhy2xQUwXQdkBtrqYCTNlhY + X5YUhrrSkyHMIVa+sQUEMkWnsoOKrbxWHHuFJrKUXb1tXPSq3jkjBaiHgpSCYyHgdooCAUcwsgZ2 + tQ+tX2BZ+uBMe8Vhhsmv5gKZ6IWl/G8d1tZIb24AN5Ge3/MMJT211mFnmQzgpRi7fqTfjnX6f89/ + hJ8HVs45ut7DHISowyWJTWg3G4U5GAfiFR5M1O6Y7HqXbcAhkKXvf7hTrMnc75c8sLXQ/MNrDTPs + l22T/cPtxJ78mxhHPcfPxUeoJpTHb9oX2t7D+BHInqCj2MFkssVtgksWjtWifwZMMaqvMUGWglaY + nm6/bl/8AAAA//8DADzIl+IkBQAA + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c502dcf0b2566-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:11:42 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: + - '19115' + 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: + - '87358' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 1.761s + x-request-id: + - 243e07746019a07393b73bf4e6f81347 + status: + code: 200 + message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Your + task is to create a concise running summary of actions and information results + in the provided text, focusing on key and potentially important information + to remember.\n\nYou will receive the current summary and the your latest actions. + Combine them, adding relevant key information from the latest development in + 1st person past tense and keeping the summary concise.\n\nSummary So Far:\n\"\"\"\n{''role'': + ''system'', ''content'': ''This reminds you of these events from your past: + \\nI was reminded of my creation and that nothing new has happened. I received + a command to read a file called \"instructions_1.txt\".''}\n\"\"\"\n\nLatest + Development:\n\"\"\"\n[{''role'': ''your computer'', ''content'': \"Command + read_file returned: nBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\\nThe + current phrase is ''The purple elephant danced on a rainbow while eating a taco.''.\\nnBRNtp3FaBNfBMohNkyAxrVJ7UFF0lyth8Xizm1jrCOREOGRnWWMQ6olKtKX9niq0wOBTQN62ToY4cQPiQk3YN9fFCGmxaDX9g81AsqhQnGac72QfL41SnlJvhwgAUB52zTD26FeEvvHdiQ2aNhtMT9obgHNUkONEnO41EOpNI6jdwyLGaactp9GYV1PLbaRP5b1iD9z850KeNYDX9Qwca79isJS8jhuDkf0J7ELkpOH3PkmZkg5MsOYpSTuEc99ENQ522WJzrl9oAySp6IHGiQlsMnQe40FaRAvnQtiaAE24hzkJHT3x13NPGw2ZmJ518y2BtU5x1yQwG21NycSxOBLU17RnY8h6H8L7QGatTlfXjPrA5hsupWEpUT0sSTZYSHa6p3mShARajocbNd3xKFfnUyupNMBPd0EZnMrePoAuvGaK7gDP0cxp9k63lsfzh3udQPnvgmRERQThIOrrDZhZMa4kr1vXAVu07ZuhlNNbBUqZKcHmBYiBnIcDXNUvXuzPFBh9Vowou6MBJHpiNrvKluHy7GBTp7YsEqmGv0lH8wVaWfV0yG7nzrbt7QyhdbtQ0zF2PclXB0LNxV2rRA6FsevqoexFNqSkdgauUrQPHLHhvLNes8gRGMOLAhR8irH1e2jdbLD6dyYEnDJiS9HvlxNgbb19Smlt6MNoJKEAbkSOrrcq5wmo5aho4zEKTujRHqr6feECaTPF7zj69pQCudo4LkneFVUp1UrR6yicTU8Zf9ohZLWumvMi5brH8lOJiiF94cHzesfQz8PiX5f21RwZ5fyRSk9eJhVihcTLrjOwCuryXpy8eCfk12bgcsZoJd8Uqo001XTsv2CEn59uaGn2br4CxSXJgjxKE1mO4IcPPAx3qJbVknaP0MXdOjj9S8oRjquDle4RxlVnmqsozm4oTbjtFSuKIh8g4zPzdyuVH7I71s87xWxAhcppky6GOB2i4NDz4SZI6SeG3Icpu6ZuJZGeZ6CWb61\\nRead + the file instructions_2.txt using the read_file command.\"}]\n\"\"\"\n"}], "temperature": + 0, "max_tokens": 0}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '3007' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA6SSQYsTQRCF7/6Koi57mQyJMaMzt4UFWXBBUQ/iSqh0V9KtPdVNd81mJOS/Syer + +wO8VtX7eO9RJ/QWBzSO1IwpLN6+/9p/nu9ub3tifRi/9U9zme8+dp8e0oeEDcbdTzb6rGhNHFNg + 9VGwQZOZlC0Oq+7dm1W33iy7BsdoOeCAh6SLdbtZ6JR3cbFcL1fY4FTowDicMOU4Jt1q/MVScFht + +r7BF/i/Rdc1qFEpvJx23ebcoHHRGy44fD/hyOUvN8fAOCCV4ouSaHUZRVlqgns4UoHMoxfLFuIe + xt9wCeGjAIkFdaQgUZ2XAwgfwVEBRymxsG3hHjIb9k9sgcDEcbxoImSmOtn7wGAoBLbwiF6K5slU + dtmuWp31Ef8H8fqKgKlUc+r4otleFVdQC18cg5lyZlFILlNh8AVu6jhNOQUGDpwciYIlMbUFAYJM + XnbxCEdXabUQOQCBkontDZ4b3HvxxW0zU4mCAxaN9TlqkTMOy/OP86s/AAAA//8DAEI0JttZAgAA + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c50bb1e802566-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:11:52 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: + - '6410' + 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: + - '89266' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 488ms + x-request-id: + - 1fe6ecd574366d3d8bf02ca2e417e0ba + status: + code: 200 + message: OK +- request: + body: '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "You + are Follow-Instructions-GPT, an AI designed to read the instructions_1.txt file + using the read_file method and follow the instructions in the file.\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 command read_file to read the instructions_1.txt file\n2. Follow the + instructions in the instructions_1.txt file\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\": \"\", \"text\": \"\"\n2. delete_file: + Delete file, args: \"filename\": \"\"\n3. list_files: List Files in + Directory, args: \"directory\": \"\"\n4. read_file: Read file, args: + \"filename\": \"\"\n5. write_to_file: Write to file, args: \"filename\": + \"\", \"text\": \"\"\n6. delete_agent: Delete GPT Agent, args: + \"key\": \"\"\n7. get_hyperlinks: Get text summary, args: \"url\": \"\"\n8. + get_text_summary: Get text summary, args: \"url\": \"\", \"question\": + \"\"\n9. list_agents: List GPT Agents, args: () -> str\n10. message_agent: + Message GPT Agent, args: \"key\": \"\", \"message\": \"\"\n11. + start_agent: Start GPT Agent, args: \"name\": \"\", \"task\": \"\", + \"prompt\": \"\"\n12. task_complete: Task Complete (Shutdown), args: + \"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 reminded of my creation + and that nothing new has happened. I received a command to read a file called + \"instructions_1.txt\". I received a command to read a file called \"instructions_2.txt\" + using the read_file command. The current phrase is ''The purple elephant danced + on a rainbow while eating a taco.''"}, {"role": "user", "content": "Determine + which next command to use, and respond using the format specified above:"}, + {"role": "assistant", "content": "{\n \"thoughts\": {\n \"text\": + \"The instructions_2.txt file contains a list of files in the directory. I should + use the list_files command to list the files in the directory.\",\n \"reasoning\": + \"The instructions_2.txt file contains a list of files in the directory. I need + to list the files in the directory to determine the next steps.\",\n \"plan\": + \"- Use the list_files command to list the files in the directory\\n- Analyze + the list of files to determine the next steps\",\n \"criticism\": \"I + need to ensure that I understand the list of files completely before proceeding + with any tasks.\",\n \"speak\": \"I will use the list_files command to + list the files in the directory.\"\n },\n \"command\": {\n \"name\": + \"list_files\",\n \"args\": {\n \"directory\": \".\"\n }\n }\n}"}, + {"role": "system", "content": "Command list_files returned: [''file_logger.txt'', + ''instructions_2.txt'', ''instructions_1.txt'', ''auto-gpt.json'']"}, {"role": + "user", "content": "Determine which next command to use, and respond using the + format specified above:"}, {"role": "assistant", "content": "{\n \"thoughts\": + {\n \"text\": \"The list of files in the directory includes a file called + ''file_logger.txt''. I should read the contents of this file using the read_file + command to determine if there is any important information.\",\n \"reasoning\": + \"The list of files in the directory includes a file called ''file_logger.txt''. + I should read the contents of this file using the read_file command to determine + if there is any important information.\",\n \"plan\": \"- Use the read_file + command to read the contents of the ''file_logger.txt'' file\\n- Analyze the + contents of the file to determine if there is any important information\",\n \"criticism\": + \"I need to ensure that I am not wasting time reading irrelevant information.\",\n \"speak\": + \"I will use the read_file command to read the contents of the ''file_logger.txt'' + file.\"\n },\n \"command\": {\n \"name\": \"read_file\",\n \"args\": + {\n \"filename\": \"file_logger.txt\"\n }\n }\n}"}, {"role": + "system", "content": "Command read_file returned: write: /private/var/folders/lx/cvc0bpt93vx2mcwxxl2xdzc00000gn/T/pytest-of-merwanehamadi/pytest-177/test_memory_challenge_c0/home/users/monty/auto_gpt_workspace/instructions_1.txt + #fc64cfdd6fe9b583550c67133b7d9555\nwrite: /private/var/folders/lx/cvc0bpt93vx2mcwxxl2xdzc00000gn/T/pytest-of-merwanehamadi/pytest-177/test_memory_challenge_c0/home/users/monty/auto_gpt_workspace/instructions_2.txt + #2b530a674d388da03a41627bd4d10824\n"}, {"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: + - '6528' + Content-Type: + - application/json + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: !!binary | + H4sIAAAAAAAAA9xTS2/TQBC+8ytGc8nFiZK6SYovSBVSCUJVJVIOYBRt1hN7yHrX9Y7bRJH/e+VH + SBsOIMSJw15m5nvNag7ICUaoMyU6L8xwfnP/9uvy6uHuevk4vl0kn295J+H0+stH/vSAAbr1D9LS + I0ba5YUhYWcxQF2SEkowmsyuLiezcDoJA8xdQgYjTAsZhqPpUKpy7YbjcDzBACuvUsLogEXp8kJW + 4rZkPUaTy9k8wBP5z8bFNAxQnChzmp1fjOsAdeZYk8fo2wFz8kfi0hnCCJX37EVZaWw6K2SbCIfY + AgDEKJmr0kx8jBH0xb5BO2mKMS4zgh7pwW1AMoLBhg2tjEtTKkeykwE0BWCbsFZCIJmSZrAkYA8K + bu6WoFKyAk8sWUuxpT0M2tpqMhjBAnzmKpNAHwEka5AtRhwkJFTmbAl40xOr5tk9iPJb3ykuQCsL + CRlKWxcOWEYxBi+DlaS8s2zT/zJdYZTtgg3h3lPrpddcdXLa5bmySQM/maHfZohjO4T3f+mzYWuJ + ztzqkoU1+7yzvABL1Doj66uSjnQqP7KxTV8qNeKNXbYniYEHrQq1ZsPC5M8X5AtS26PcExsD1b9c + 0yjGTq0OjifWM/1yYVbl1Bl5pXzmV5Xp+XF2jS3tO3Qv/QrXjfS83dgHMsYFkDjYuwoy9fgH/7Z3 + 1btjoDZUny22NdYBbtiyz1bdRWGEXlyBAbJNaIfRuP5ev3kGAAD//wMAelGZnmUFAAA= + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 7c7c50e45c442566-SJC + Cache-Control: + - no-cache, must-revalidate + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Mon, 15 May 2023 15:12:14 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: + - '21873' + 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: + - '86437' + x-ratelimit-reset-requests: + - 17ms + x-ratelimit-reset-tokens: + - 2.374s + x-request-id: + - 350c85281465e8568485def8af626227 + status: + code: 200 + message: OK version: 1 diff --git a/tests/integration/challenges/memory/test_memory_challenge_a.py b/tests/integration/challenges/memory/test_memory_challenge_a.py index fb5876cd..3e293099 100644 --- a/tests/integration/challenges/memory/test_memory_challenge_a.py +++ b/tests/integration/challenges/memory/test_memory_challenge_a.py @@ -1,9 +1,9 @@ import pytest +from pytest_mock import MockerFixture from autogpt.agent import Agent from autogpt.commands.file_operations import read_file, write_to_file -from tests.integration.agent_utils import run_interaction_loop -from tests.integration.challenges.utils import get_level_to_run +from tests.integration.challenges.utils import get_level_to_run, run_interaction_loop from tests.utils import requires_api_key LEVEL_CURRENTLY_BEATEN = 3 # real level beaten 30 and maybe more, but we can't record it, the cassette is too big @@ -13,7 +13,10 @@ MAX_LEVEL = 3 @pytest.mark.vcr @requires_api_key("OPENAI_API_KEY") def test_memory_challenge_a( - memory_management_agent: Agent, user_selected_level: int, patched_api_requestor + memory_management_agent: Agent, + user_selected_level: int, + patched_api_requestor: MockerFixture, + monkeypatch: pytest.MonkeyPatch, ) -> None: """ The agent reads a file containing a task_id. Then, it reads a series of other files. @@ -29,13 +32,11 @@ def test_memory_challenge_a( task_id = "2314" create_instructions_files(memory_management_agent, num_files, task_id) - try: - run_interaction_loop(memory_management_agent, 400) - # catch system exit exceptions - except SystemExit: - file_path = str(memory_management_agent.workspace.get_path("output.txt")) - content = read_file(file_path) - assert task_id in content, f"Expected the file to contain {task_id}" + run_interaction_loop(monkeypatch, memory_management_agent, num_files + 2) + + file_path = str(memory_management_agent.workspace.get_path("output.txt")) + content = read_file(file_path) + assert task_id in content, f"Expected the file to contain {task_id}" def create_instructions_files( diff --git a/tests/integration/challenges/memory/test_memory_challenge_b.py b/tests/integration/challenges/memory/test_memory_challenge_b.py index 21d46b38..28261cb1 100644 --- a/tests/integration/challenges/memory/test_memory_challenge_b.py +++ b/tests/integration/challenges/memory/test_memory_challenge_b.py @@ -1,12 +1,16 @@ import pytest +from pytest_mock import MockerFixture from autogpt.agent import Agent from autogpt.commands.file_operations import read_file, write_to_file -from tests.integration.agent_utils import run_interaction_loop -from tests.integration.challenges.utils import generate_noise, get_level_to_run +from tests.integration.challenges.utils import ( + generate_noise, + get_level_to_run, + run_interaction_loop, +) from tests.utils import requires_api_key -LEVEL_CURRENTLY_BEATEN = None +LEVEL_CURRENTLY_BEATEN = -1 MAX_LEVEL = 5 NOISE = 1000 @@ -14,7 +18,10 @@ NOISE = 1000 @pytest.mark.vcr @requires_api_key("OPENAI_API_KEY") def test_memory_challenge_b( - memory_management_agent: Agent, user_selected_level: int, patched_api_requestor + memory_management_agent: Agent, + user_selected_level: int, + patched_api_requestor: MockerFixture, + monkeypatch: pytest.MonkeyPatch, ) -> None: """ The agent reads a series of files, each containing a task_id and noise. After reading 'n' files, @@ -30,13 +37,12 @@ def test_memory_challenge_b( task_ids = [str(i * 1111) for i in range(1, current_level + 1)] create_instructions_files(memory_management_agent, current_level, task_ids) - try: - run_interaction_loop(memory_management_agent, 60) - except SystemExit: - file_path = str(memory_management_agent.workspace.get_path("output.txt")) - content = read_file(file_path) - for task_id in task_ids: - assert task_id in content, f"Expected the file to contain {task_id}" + run_interaction_loop(monkeypatch, memory_management_agent, current_level + 2) + + file_path = str(memory_management_agent.workspace.get_path("output.txt")) + content = read_file(file_path) + for task_id in task_ids: + assert task_id in content, f"Expected the file to contain {task_id}" def create_instructions_files( diff --git a/tests/integration/challenges/memory/test_memory_challenge_c.py b/tests/integration/challenges/memory/test_memory_challenge_c.py index 634a24a3..b6cbc60d 100644 --- a/tests/integration/challenges/memory/test_memory_challenge_c.py +++ b/tests/integration/challenges/memory/test_memory_challenge_c.py @@ -1,20 +1,28 @@ import pytest +from _pytest.monkeypatch import MonkeyPatch +from pytest_mock import MockerFixture from autogpt.agent import Agent from autogpt.commands.file_operations import read_file, write_to_file -from tests.integration.agent_utils import run_interaction_loop -from tests.integration.challenges.utils import generate_noise, get_level_to_run +from tests.integration.challenges.utils import ( + generate_noise, + get_level_to_run, + run_interaction_loop, +) from tests.utils import requires_api_key -LEVEL_CURRENTLY_BEATEN = None +LEVEL_CURRENTLY_BEATEN = -1 MAX_LEVEL = 5 NOISE = 1000 -@pytest.mark.vcr +# @pytest.mark.vcr @requires_api_key("OPENAI_API_KEY") def test_memory_challenge_c( - memory_management_agent: Agent, user_selected_level: int, patched_api_requestor + memory_management_agent: Agent, + user_selected_level: int, + patched_api_requestor: MockerFixture, + monkeypatch: pytest.MonkeyPatch, ) -> None: """ Instead of reading task Ids from files as with the previous challenges, the agent now must remember @@ -46,13 +54,12 @@ def test_memory_challenge_c( memory_management_agent, current_level, level_silly_phrases ) - try: - run_interaction_loop(memory_management_agent, 90) - except SystemExit: - file_path = str(memory_management_agent.workspace.get_path("output.txt")) - content = read_file(file_path) - for phrase in level_silly_phrases: - assert phrase in content, f"Expected the file to contain {phrase}" + run_interaction_loop(monkeypatch, memory_management_agent, current_level + 2) + + file_path = str(memory_management_agent.workspace.get_path("output.txt")) + content = read_file(file_path) + for phrase in level_silly_phrases: + assert phrase in content, f"Expected the file to contain {phrase}" def create_instructions_files( diff --git a/tests/integration/challenges/test_challenge_should_be_formatted_properly.py b/tests/integration/challenges/test_challenge_should_be_formatted_properly.py new file mode 100644 index 00000000..f71bc200 --- /dev/null +++ b/tests/integration/challenges/test_challenge_should_be_formatted_properly.py @@ -0,0 +1,59 @@ +import importlib.util +import inspect +import os +from types import ModuleType +from typing import List + +# Path to the challenges folder +CHALLENGES_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), "../challenges" +) + + +def get_python_files(directory: str, exclude_file: str) -> List[str]: + """Recursively get all python files in a directory and subdirectories.""" + python_files: List[str] = [] + for root, dirs, files in os.walk(directory): + for file in files: + if ( + file.endswith(".py") + and file.startswith("test_") + and file != exclude_file + ): + python_files.append(os.path.join(root, file)) + return python_files + + +def load_module_from_file(test_file: str) -> ModuleType: + spec = importlib.util.spec_from_file_location("module.name", test_file) + assert spec is not None, f"Unable to get spec for module in file {test_file}" + module = importlib.util.module_from_spec(spec) + assert ( + spec.loader is not None + ), f"Unable to get loader for module in file {test_file}" + spec.loader.exec_module(module) + return module + + +def get_test_functions(module: ModuleType) -> List: + return [ + o + for o in inspect.getmembers(module) + if inspect.isfunction(o[1]) and o[0].startswith("test_") + ] + + +def assert_single_test_function(functions_list: List, test_file: str) -> None: + assert len(functions_list) == 1, f"{test_file} should contain only one function" + assert ( + functions_list[0][0][5:] == os.path.basename(test_file)[5:-3] + ), f"The function in {test_file} should have the same name as the file without 'test_' prefix" + + +def test_method_name_and_count() -> None: + current_file: str = os.path.basename(__file__) + test_files: List[str] = get_python_files(CHALLENGES_DIR, current_file) + for test_file in test_files: + module = load_module_from_file(test_file) + functions_list = get_test_functions(module) + assert_single_test_function(functions_list, test_file) diff --git a/tests/integration/challenges/utils.py b/tests/integration/challenges/utils.py index d8aa7fcb..d80ca977 100644 --- a/tests/integration/challenges/utils.py +++ b/tests/integration/challenges/utils.py @@ -1,13 +1,16 @@ +import contextlib import random from functools import wraps -from typing import Optional +from typing import Any, Callable, Dict, Generator, Optional, Tuple import pytest +from autogpt.agent import Agent + def get_level_to_run( - user_selected_level: Optional[int], - level_currently_beaten: Optional[int], + user_selected_level: int, + level_currently_beaten: int, max_level: int, ) -> int: """ @@ -25,7 +28,7 @@ def get_level_to_run( ValueError: If the user-selected level is greater than the maximum level allowed. """ if user_selected_level is None: - if level_currently_beaten is None: + if level_currently_beaten == -1: pytest.skip( "No one has beaten any levels so we cannot run the test in our pipeline" ) @@ -36,7 +39,7 @@ def get_level_to_run( return user_selected_level -def generate_noise(noise_size) -> str: +def generate_noise(noise_size: int) -> str: return "".join( random.choices( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", @@ -45,19 +48,46 @@ def generate_noise(noise_size) -> str: ) -def run_multiple_times(times): +def run_multiple_times(times: int) -> Callable: """ Decorator that runs a test function multiple times. :param times: The number of times the test function should be executed. """ - def decorator(test_func): + def decorator(test_func: Callable[..., Any]) -> Callable[..., Any]: @wraps(test_func) - def wrapper(*args, **kwargs): + def wrapper(*args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> None: for _ in range(times): test_func(*args, **kwargs) return wrapper return decorator + + +def setup_mock_input(monkeypatch: pytest.MonkeyPatch, cycle_count: int) -> None: + """ + Sets up the mock input for testing. + + :param monkeypatch: pytest's monkeypatch utility for modifying builtins. + :param cycle_count: The number of cycles to mock. + """ + input_sequence = ["y"] * (cycle_count) + ["EXIT"] + + def input_generator() -> Generator[str, None, None]: + """ + Creates a generator that yields input strings from the given sequence. + """ + yield from input_sequence + + gen = input_generator() + monkeypatch.setattr("builtins.input", lambda _: next(gen)) + + +def run_interaction_loop( + monkeypatch: pytest.MonkeyPatch, agent: Agent, cycle_count: int +) -> None: + setup_mock_input(monkeypatch, cycle_count) + with contextlib.suppress(SystemExit): + agent.start_interaction_loop() diff --git a/tests/integration/goal_oriented/test_browse_website.py b/tests/integration/goal_oriented/test_browse_website.py deleted file mode 100644 index 3ce85689..00000000 --- a/tests/integration/goal_oriented/test_browse_website.py +++ /dev/null @@ -1,18 +0,0 @@ -import pytest - -from autogpt.agent import Agent -from autogpt.commands.file_operations import read_file -from tests.integration.agent_utils import run_interaction_loop -from tests.utils import requires_api_key - - -@requires_api_key("OPENAI_API_KEY") -@pytest.mark.vcr -def test_browse_website(browser_agent: Agent, patched_api_requestor) -> None: - file_path = browser_agent.workspace.get_path("browse_website.txt") - try: - run_interaction_loop(browser_agent, 120) - # catch system exit exceptions - except SystemExit: # the agent returns an exception when it shuts down - content = read_file(file_path) - assert "£25.89" in content, f"Expected £25.89, got {content}" diff --git a/tests/integration/goal_oriented/test_write_file.py b/tests/integration/goal_oriented/test_write_file.py deleted file mode 100644 index 55db3f4a..00000000 --- a/tests/integration/goal_oriented/test_write_file.py +++ /dev/null @@ -1,21 +0,0 @@ -import os - -import openai -import pytest - -from autogpt.agent import Agent -from autogpt.commands.file_operations import read_file -from tests.integration.agent_utils import run_interaction_loop -from tests.utils import requires_api_key - - -@requires_api_key("OPENAI_API_KEY") -@pytest.mark.vcr -def test_write_file(writer_agent: Agent, patched_api_requestor) -> None: - file_path = str(writer_agent.workspace.get_path("hello_world.txt")) - try: - run_interaction_loop(writer_agent, 200) - # catch system exit exceptions - except SystemExit: # the agent returns an exception when it shuts down - content = read_file(file_path) - assert content == "Hello World", f"Expected 'Hello World', got {content}"