Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
MIT License
166.1k stars 43.97k forks source link

output write to json file error , just data format error. #3671

Closed 836304831 closed 1 year ago

836304831 commented 1 year ago

⚠️ Search for existing issues first ⚠️

Which Operating System are you using?

Linux

Which version of Auto-GPT are you using?

Latest Release

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

when I run my prompt, one of goal is save output to file, the system cannot save output to file.

start: sh run.sh --gpt3only

Current behavior 😯

the output as following:

image

Expected behavior 🤔

can save ouput to json file success.

Your prompt 📝

ai_goals:
- 出一份做饺子的使用指南
- 将制作指南保存到一个文件中
- 将制作过程中的难点标记出来
ai_name: acedar
ai_role: 一位厨师高手,能出各种美味的食谱
api_budget: 0.2

Your Logs 📒

2023-05-02 15:13:00,675 INFO Role: 一位厨师高手,能出各种美味的食谱
2023-05-02 15:13:00,732 INFO Goals:
2023-05-02 15:13:00,800 INFO - 出一份做饺子的使用指南
2023-05-02 15:13:00,907 INFO - 将制作指南保存到一个文件中
2023-05-02 15:13:01,003 INFO - 将制作过程中的难点标记出来
2023-05-02 15:13:01,089 INFO Using memory of type: LocalCache
2023-05-02 15:13:01,273 INFO Using Browser: chrome
2023-05-02 15:13:13,197 INFO Apparently json was fixed.
2023-05-02 15:13:14,184 ERROR Error: The following AI output couldn't be converted to a JSON:
 {
    "thoughts": {
        "text": "I will start by writing the guide for making dumplings and save it to a file. I will then mark the difficult steps and try to simplify them. ",
        "reasoning": "I need to start by completing the main task of creating the guide. Marking the difficult steps will help me improve the guide in the future.",
        "plan": "- Write the guide for making dumplings\n- Mark the difficult steps\n- Save the guide to a file",
        "criticism": "I need to make sure that the guide is easy to follow and that the difficult steps are simplified.",
        "speak": "I will start by writing the guide for making dumplings and save it to a file. I will then mark the difficult steps and try to simplify them."
    },
    "command": {
        "name": "write_to_file",
        "args": {
            "filename": "dumpling_guide.txt",
            "text": "Dumpling Making Guide\n\nIngredients:\n- 2 cups all-purpose flour\n- 1/2 cup water\n- 1/2 lb ground pork\n- 1/2 cup chopped cabbage\n- 1/4 cup chopped scallions\n- 1 tbsp soy sauce\n- 1 tbsp sesame oil\n- 1 tsp salt\n- 1/2 tsp sugar\n\nInstructions:\n1. In a large bowl, mix the flour and water until a dough forms. Knead the dough for 5 minutes, then cover and let rest for 30 minutes.\n2. In a separate bowl, mix the ground pork, cabbage, scallions, soy sauce, sesame oil, salt, and sugar until well combined.\n3. Roll out the dough on a floured surface until it is about 1/8 inch thick. Use a round cookie cutter or a glass to cut out circles of dough.\n4. Place a spoonful of the pork mixture in the center of each circle of dough. Fold the dough in half and pinch the edges together to seal.\n5. Bring a large pot of water to a boil. Add the dumplings and cook for 5-7 minutes, or until they float to the surface.\n6. Serve hot with soy sauce or your favorite dipping sauce.\n\nDifficult Steps:\n- Kneading the dough for 5 minutes\n- Rolling out the dough to 1/8 inch thickness\n- Pinching the edges of the dumplings together to seal",
        }
    }
}
2023-05-02 15:13:14,185 INFO NEXT ACTION:  COMMAND = None  ARGUMENTS = None
2023-05-02 15:13:14,405 INFO  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands'n' to exit program, or enter feedback for ...
2023-05-02 15:13:14,405 INFO  Asking user via keyboard...
2023-05-02 15:14:08,773 INFO -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
2023-05-02 15:14:08,960 INFO SYSTEM:  Command None returned: Error: 'NoneType' object has no attribute 'lower'
2023-05-02 15:14:14,779 INFO  THOUGHTS: I have written the guide for making dumplings and saved it to a file. I will now check the file to make sure it was saved correctly.
2023-05-02 15:14:15,244 INFO REASONING: It is important to check that the file was saved correctly to ensure that the guide is accessible in the future.
2023-05-02 15:14:15,678 INFO PLAN:
2023-05-02 15:14:15,733 INFO -  Check the file to make sure it was saved correctly
2023-05-02 15:14:16,056 INFO CRITICISM: I need to make sure that the file was saved correctly and that the guide is easy to read and follow.
2023-05-02 15:14:16,542 INFO NEXT ACTION:  COMMAND = read_file  ARGUMENTS = {'filename': '/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace/dumpling_guide.txt'}
2023-05-02 15:14:16,714 INFO  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands'n' to exit program, or enter feedback for ...
2023-05-02 15:14:16,714 INFO  Asking user via keyboard...
2023-05-02 15:14:29,041 INFO -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
2023-05-02 15:14:29,166 INFO SYSTEM:  Command read_file returned: Error: [Errno 2] No such file or directory: '/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace/dumpling_guide.txt'
2023-05-02 15:14:35,657 INFO  THOUGHTS: I received an error message when trying to read the file. I will check if the file was saved in the correct directory.
2023-05-02 15:14:36,157 INFO REASONING: If the file was not saved in the correct directory, I will need to save it again in the correct directory.
2023-05-02 15:14:36,567 INFO PLAN:
2023-05-02 15:14:36,634 INFO -  Check if the file was saved in the correct directory
2023-05-02 15:14:36,902 INFO -  Save the file again if necessary
2023-05-02 15:14:37,102 INFO CRITICISM: I need to make sure that the file is saved in the correct directory to avoid errors in the future.
2023-05-02 15:14:37,520 ERROR Error:
 Attempted to access absolute path '/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace' in workspace '/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace'.
2023-05-02 15:14:37,520 INFO NEXT ACTION:  COMMAND = list_files  ARGUMENTS = {'directory': '/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace/'}
2023-05-02 15:14:37,721 INFO SYSTEM:  Command list_files returned: ['auto-gpt.json', 'file_logger.txt']
2023-05-02 15:14:38,100 INFO DOUBLE CHECK CONFIGURATION Please double check that you have setup a PAID OpenAI API Account. You can read more here: https://docs.agpt.co/setup/#getting-an-api-key
2023-05-02 15:14:51,502 INFO DOUBLE CHECK CONFIGURATION Please double check that you have setup a PAID OpenAI API Account. You can read more here: https://docs.agpt.co/setup/#getting-an-api-key
2023-05-02 15:15:34,462 INFO Apparently json was fixed.
2023-05-02 15:15:34,758 INFO DOUBLE CHECK CONFIGURATION Please double check that you have setup a PAID OpenAI API Account. You can read more here: https://docs.agpt.co/setup/#getting-an-api-key
2023-05-02 15:16:04,641 ERROR Error: The following AI output couldn't be converted to a JSON:
 {
    "thoughts": {
        "text": "The file is not in the correct directory. I will save the file again in the correct directory.",
        "reasoning": "Saving the file in the correct directory will ensure that it can be accessed in the future.",
        "plan": "- Save the file again in the correct directory",
        "criticism": "I need to make sure that the file is saved in the correct directory to avoid errors in the future.",
        "speak": "The file is not in the correct directory. I will save the file again in the correct directory."
    },
    "command": {
        "name": "write_to_file",
        "args": {
            "filename": "/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace/dumpling_guide.txt",
            "text": "Dumpling Making Guide\n\nIngredients:\n- 2 cups all-purpose flour\n- 1/2 cup water\n- 1/2 lb ground pork\n- 1/2 cup chopped cabbage\n- 1/4 cup chopped scallions\n- 1 tbsp soy sauce\n- 1 tbsp sesame oil\n- 1 tsp salt\n- 1/2 tsp sugar\n\nInstructions:\n1. In a large bowl, mix the flour and water until a dough forms. Knead the dough for 5 minutes, then cover and let rest for 30 minutes.\n2. In a separate bowl, mix the ground pork, cabbage, scallions, soy sauce, sesame oil, salt, and sugar until well combined.\n3. Roll out the dough on a floured surface until it is about 1/8 inch thick. Use a round cookie cutter or a glass to cut out circles of dough.\n4. Place a spoonful of the pork mixture in the center of each circle of dough. Fold the dough in half and pinch the edges together to seal.\n5. Bring a large pot of water to a boil. Add the dumplings and cook for 5-7 minutes, or until they float to the surface.\n6. Serve hot with soy sauce or your favorite dipping sauce.\n\nDifficult Steps:\n- Kneading the dough for 5 minutes\n- Rolling out the dough to 1/8 inch thickness\n- Pinching the edges of the dumplings together to seal",
        }
    }
}
2023-05-02 15:16:04,642 INFO NEXT ACTION:  COMMAND = list_files  ARGUMENTS = {'directory': '/home/ubuntu/workspace_code/Auto-GPT/autogpt/auto_gpt_workspace/'}
2023-05-02 15:16:04,917 INFO SYSTEM:  Command list_files returned: ['auto-gpt.json', 'file_logger.txt']
lc0rp commented 1 year ago

Combing JSON issues here: #1407