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
Other
168.87k stars 44.48k forks source link

ARGUMENTS = 'dict' object has no attribute 'replace' :) #1085

Closed GoMightyAlgorythmGo closed 1 year ago

GoMightyAlgorythmGo commented 1 year ago

Duplicates

Steps to reproduce 🕹

I did not know that there was a "stable" branch that is more stable than the "master" branch i will check the "stable" out , just in case you want the Bug report anyway i leave it be. In the future since the new message i will be more reluctant before making a report. 👍

Little compliment to start: First of all, AutoGPT is the best software i have seen in a long time. And it is the best work/tool to make Language Models work for you or having insane potential to relly get going once AutoGPT can just organize and build on previous work a little better and kinda figure out the organisation one by one. (I imagine it is already super amazing with chatGPT4). It is even relly good with gpt3.5t and the other l.m. implementations <3 Great job!

Now the Bug etc: Bug is no big deal so far - Low priority for me personally dont know about other people: after some restarts he usually works for a good bit again, but i still made a report just in case people wanned to know it. :)

Note: I did not make any userfeedback it just started eventually, nothing too unusuall.

I just ran it after the recent pull and the ai_settings.yaml vanished too ai_settings.yaml totally deleted luckely i had a backup.

First it worked nicely for maybe 40 commands maybe 80 but then a constant string of those repetitions and no end in sight, i eventually stoped it by ctrl+c since i did not see any actions always just ARGUMENTS = 'dict' object has no attribute 'replace'

I updated this morning and installed the requirements this morning and until now it went well. I think it was the recent pull altho not immediately it was when the ai_settings.yaml vanished from the folder all together around that time 11:30 13. April 2023 (MESZ)

Current behavior 😯

Error: Invalid JSON, setting it to empty JSON now.

NEXT ACTION: COMMAND = Error: ARGUMENTS = 'dict' object has no attribute 'replace' SYSTEM: Command Error: threw the following error: 'dict' object has no attribute 'replace' Warning: Failed to parse AI output, attempting to fix.

Check this out what it said when i restarted again:

AI_GPT_8 THOUGHTS: Given the current state of Auto-GPT, we should prioritize improving the foundational components of our approach, and ensure that each task is self-contained and modular. We should also make sure to save important information to files and take advantage of our past work and resources to increase efficiency. REASONING: By prioritizing self-contained and modular components, we can minimize the impact of errors and setbacks and gradually build up the system. Saving important information to files can help us overcome our short-term memory limitations and take advantage of our past work to save time and effort. PLAN:

:D For now it seems to work again but last restart was even worse i think becuase i made userfeedback. If i dont do userfeedback less errors happen. Userfeedback somethmes goes throught especially when there are little errors then 80% of the time somethimes 100% no problem but other times it eather messes things up and they spiral down erros later or they immediately cause erros but its not so bad usually AutoGPT gets back its also hard to know how i should formulate the feedback,. if i should say "feedback for Agent "Errormanagement" or "Userfeedback agent" or smth. No big deal :) Just made the report for good practice

here first it was perfect then something got worse and then the erros happened later :)

AI_GPT_8 THOUGHTS: Now that we have defined the file handling functions, we can test them to ensure their correctness and performance. REASONING: Testing the file handling functions is important to ensure that they perform as expected and that there are no issues with read, write, append, or delete operations. PLAN:

  1. Create a new python file called "utils.py".
  2. Add the parse_arguments function from the previous response to the "utils.py" file.
  3. Write a second function in "utils.py" called load_config that accepts a filename and returns a dictionary of configuration settings. The function should read the specified file in JSON format using json.load and return the resulting dictionary. If the file cannot be read or decoded, load_config should return an empty dictionary.
  4. Write unit tests for the load_config function in a new file called "test_utils.py". Ensure that the tests cover all relevant use cases and edge cases.
  5. Implement other missing generic python utilities as needed in this module.
  6. Once done with writing out utils.py, create the command to write the text: "This is the file for common python utilities that are used across modules for iteration and code clarity." to a file named "utils_descriptor.txt" and save it in a new folder called "doc".

Let me know if you have any questions or concerns! Attempting to fix JSON by finding outermost brackets Error: Invalid JSON, setting it to empty JSON now.

AI_GPT_8 THOUGHTS: REASONING: CRITICISM: Attempting to fix JSON by finding outermost brackets Error: Invalid JSON, setting it to empty JSON now.

NEXT ACTION: COMMAND = Error: ARGUMENTS = 'dict' object has no attribute 'replace' SYSTEM: Command Error: threw the following error: 'dict' object has no attribute 'replace' Warning: Failed to parse AI output, attempting to fix. If you see this warning frequently, it's likely that your prompt is confusing the AI. Try changing it up slightly. Failed to fix AI output, telling the AI. Error: Invalid JSON I apologize for the error in my previous response. Here's your next set of commands:

  1. Create a new function in "utils.py" called truncate_string that takes in a string and an integer max_length as arguments, and returns a truncated version of the string that is no longer than max_length characters. If the string is shorter than max_length, return the original string. You can use Python string slicing to implement this function.
  2. Write unit tests for the truncate_string function in "test_utils.py". Ensure that the tests cover edge cases such as empty strings and strings that are already shorter than max_length.
  3. Create a new Python file called "file_utils.py".
  4. Implement a function in "file_utils.py" called read_json_file that accepts a filename and returns a dictionary of objects read from the file. The function should read the specified file in JSON format using json.load and return the resulting dictionary. If the file cannot be read or decoded, read_json_file should return an empty dictionary.
  5. Write unit tests for the read_json_file function in a new file called "test_file_utils.py". Ensure that the tests cover all relevant use cases and edge cases.
  6. In "utils.py", create a function called get_current_time_string that returns the current time as a string in the format "YYYY-MM-DD HH:MM:SS".
  7. Implement a new function in "file_utils.py" called write_log_entry_to_file that accepts a message string and a filename, and writes a log entry using the current timestamp as well as the input message string to the specified file. The log entry should be in the following format: "[YYYY-MM-DD HH:MM:SS] message string\n". Use the with open as file: method to file directly and handle file opening and closing automatically.
  8. Write unit tests for the write_log_entry_to_file function in "test_file_utils.py". Ensure that the tests cover all relevant use cases and edge cases.
  9. Once done with the above tasks, create a command to delete the file "utils_descriptor.txt" in the "doc" directory.

Let me know if you have any questions or concerns! Attempting to fix JSON by finding outermost brackets Error: Invalid JSON, setting it to empty JSON now.

AI_GPT_8 THOUGHTS: REASONING: CRITICISM: Attempting to fix JSON by finding outermost brackets Error: Invalid JSON, setting it to empty JSON now.

NEXT ACTION: COMMAND = Error: ARGUMENTS = 'dict' object has no attribute 'replace' SYSTEM: Command Error: threw the following error: 'dict' object has no attribute 'replace' Warning: Failed to parse AI output, attempting to fix. If you see this warning frequently, it's likely that your prompt is confusing the AI. Try changing it up slightly. Failed to fix AI output, telling the AI. Error: Invalid JSON I apologize for the previous error. Here are your next set of commands:

  1. In "file_utils.py", write a function called write_to_json_file that accepts a dictionary and file name, and writes the dictionary to the specified file in JSON format. Use the with open as file: method to file directly and handle file opening and closing automatically.
  2. Write unit tests for the write_to_json_file function in "test_file_utils.py". Ensure that the tests cover all relevant use cases and edge cases.
  3. In "file_utils.py", add a new function called append_to_csv_file that takes a file name and a list of tuples as arguments. Each tuple should contain values to be written to one row of the CSV file. If the file already exists, append the rows from the list to the end of the file. If it does not exist, create it and write the rows to the file.
  4. Write unit tests for the append_to_csv_file function in "test_file_utils.py". Add tests that cover the creation of new files, appending to existing files, and edge cases such as empty lists.
  5. In "utils.py", implement a function called pretty_print_dict that takes in a single dictionary as an argument and returns a nicely formatted string representation of the dictionary, with one key-value pair per line. You can use Python string manipulation to achieve this.
  6. Write unit tests for the pretty_print_dict function in "test_utils.py". Ensure that the tests cover edge cases such as empty dictionaries and dictionaries with different types of values.
  7. Output the results to the file "result.txt" in a new folder named "output" using the write_to_file command. The contents of the result file should be the string returned by pretty_print_dict when applied to a sample dictionary.

Let me know if you have any questions or concerns! Attempting to fix JSON by finding outermost brackets Error: Invalid JSON, setting it to empty JSON now.

AI_GPT_8 THOUGHTS: REASONING: CRITICISM: Attempting to fix JSON by finding outermost brackets Error: Invalid JSON, setting it to empty JSON now.

NEXT ACTION: COMMAND = Error: ARGUMENTS = 'dict' object has no attribute 'replace'

Expected behavior 🤔

What i currently get is beautiful it say "apparently json was fixed" every message but 0 problem my API token costs are also quite low today, maybe it uses less tokens today compared to the recent days :)

Your prompt 📝

ai_goals:
- Improve a modular approach to development, where each task produces a self-contained,
  reusable component or module. This will allow Auto-GPT to gradually build up the
  system while minimizing the impact of errors or setbacks. Track time and based on
  that tracking make lasting improvements in time effitiency in the longrun.
- Break down and improve components of the development process into small, manageable
  tasks. Improve text file records or logs or machanism/s. Use systems that that you
  (Auto-GPT) can follow. And that let you progress on previous programs and files you made.
  Improve the foundations of files and folders you make to increase the maximum speed you
  can make towards the main goal. Somehow use your strenghts and capabilitys to build upon
  previous progress since it is a for now 2-3 week deadline long project that might be extended
  somehow make maximum progress maybe you need to build things that allow you to make faster
  progress or be able to build upon previous work at all. Your language models using databases
  and files to recall and plan might lose partially all cached memory and somehow you need to 
  figure out the best way to archive your goal anyway or build so much that it makes sense to
  extend your time since the progress will be faster and faster and you just initially made
  made preparations to later be faster.
- Improve the development process by analyzing records/logs.
  If a task is not completed within a specified time frame, Auto-GPT should move on
  to the next task, and note the issue in the log file for later review. Periodically
  review & apply from this path C:\Programming\Auto-GPT_AI_8\auto_gpt_workspace\User_input
  the least tryed ideas/suggestions, especially those inside the folder "Priority". Make
  sure you react and take into account the one Users feedback. Improving seamless continuation
  of previous progress between shutdowns is a priority since continuing and building itteratively
  seems to be the biggest challenge between errors, and forgetting and being sidetracked by
  things not working. Make improvements that conect into each other and you can always find
  and continue again even when losing most memory. Improve that transition between restarts every
  10-60 minutes!
- Improve checkpoint mechanism/s that periodically save/s compelted milestones, relevant
  data as text files. Implement a monitoring and feedback mechanism that analyzes
  existing files. Use this analysis to find patterns/issues/etc that cause setbacks
  or failures, and adapt the development process accordingly to improve efficiency,
  error-resistance and seamless continuation of previous progress between shutdowns that
  happen(every 5-25 minutes with maybe a maximum of 1 hour of continus work without criticall
  erros wiping your memory. Its like you are constantly starting and working with multible different
  chats. Noone knows everything but you somehow have to work together and figure it out.
- Track and iteratively make small improvements to the modular development approach.
  Prioritice reusable self-contained components and tasks that serve as the foundation
  for more complex functionalities. If non exists make a team of 3 agents that are
  tasked with tyding up and mindfully reducing chaos and Red tape. Sort by puting
  files into folders with structured categories. Be orderly, no identical names
  and try to keep files per folder under 40.
ai_name: AI_GPT_8
ai_role: Auto-GPT is software designed to iteratively and autonomously develop a new
  languagemodel-based system on the User/s PC should do meta-learning with the help of
  neural networks, machine learning etc. Auto-GPT should leverage existing e.g. python
  resources, imports, and online content to enhance an existing free language model. The
  goal is to enable Auto-GPT to create a self-improving system that becomes more efficient
  and effective over time, despite Auto-GPT/s own memory retrival/loss problems and other
  challenges. For selfawareness it likely helps Auto-GPT to analyze its source code
  files at C:\Programming\Auto-GPT_AI_8 or other reserach e.g. online. Suggestions Create
  python files for individual actions. Then in a modular fassion string them together in new
  python files as a foundation for more complex chains of actions without having to individually
  run them. Save them with different names, and maybe a number, according to the task they serve.
  You can then reuse them whenever needed. Make sure you remember them to effectively use them
  and so you dont duplicate files for no reason. Begin with simple actions files that provide
  the foundation for more compex actionchains by calling multible of them in new python files.
  That way you increase timeeffitiency and effitiency. To send message to user make folder
  called "message_to_user" and write to textfile by "Output the results to a file" inside, after
  that the User will respond by putting his response in a txtfile inside of "answer_from_user" folder.
red17electro commented 1 year ago

I have the same issue. Any ideas for a fix? Thanks!

psvensson commented 1 year ago

Same here

rayli09 commented 1 year ago

same here

Chrisma-98 commented 1 year ago

same here

uaka commented 1 year ago

+1

oculushut commented 1 year ago

+1

Slowly-Grokking commented 1 year ago

+1

zaabi1995 commented 1 year ago

+1

Slowly-Grokking commented 1 year ago

Duplicate: https://github.com/Torantulino/Auto-GPT/issues/21

Restry commented 1 year ago

save here mbp with m1 max chip

hosseinsamadipour commented 1 year ago

same.. :(

monsinghcharles commented 1 year ago

same here m2 max macbook

OutofscopeLabs commented 1 year ago

Also facing this issue.

GoZippy commented 1 year ago

yep - same thing here with gpt4

GoZippy commented 1 year ago

at a break as described above similar to mine - I gave it user feedback of "retun only json" and then it started working again

codygao2020 commented 1 year ago

same here, hope to fix soon

alfuckk commented 1 year ago

same +1

Sakatard commented 1 year ago

having this issue too, restarting seems to fix

oneindelijk commented 1 year ago

+1 Still having this issue a lot

alexander-kazakov commented 1 year ago

Same issue, right from the first time it wanted to write some code

GREEENUP commented 1 year ago

Same, please fix - or give more access to people to review prs.

bryanpdavis commented 1 year ago

It's from fix_and_parse_json in parsing.py. If json_to_load is a dict, then you need to wrap a json.dumps around it before the replace.

Starting with line 87: with contextlib.suppress(json.JSONDecodeError): if isinstance(json_to_load, dict): json_to_load = json.dumps(json_to_load).replace("\t", "") else: json_to_load = json_to_load.replace("\t", "") return json.loads(json_to_load)

Tamis commented 1 year ago

It's from fix_and_parse_json in parsing.py. If json_to_load is a dict, then you need to wrap a json.dumps around it before the replace.

Starting with line 87: with contextlib.suppress(json.JSONDecodeError): if isinstance(json_to_load, dict): json_to_load = json.dumps(json_to_load).replace("\t", "") else: json_to_load = json_to_load.replace("\t", "") return json.loads(json_to_load)

Trying this right now, it's running, will update !

GoZippy commented 1 year ago

request a commit and make it so

km3boy commented 1 year ago

+1

ByBrawe commented 1 year ago

It's from fix_and_parse_json in parsing.py. If json_to_load is a dict, then you need to wrap a json.dumps around it before the replace.

Starting with line 87: with contextlib.suppress(json.JSONDecodeError): if isinstance(json_to_load, dict): json_to_load = json.dumps(json_to_load).replace("\t", "") else: json_to_load = json_to_load.replace("\t", "") return json.loads(json_to_load)

thank you

Aeonitis commented 1 year ago

Same issue, right from the start, I got this error on latest master version today

github-actions[bot] commented 1 year ago

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] commented 1 year ago

This issue was closed automatically because it has been stale for 10 days with no activity.