AutoGPT
AutoGPT copied to clipboard
NameError: name 'cfg' is not defined
Error: Traceback (most recent call last): File "C:\Auto-GPT\autogpt\json_fixes\parsing.py", line 101, in fix_and_parse_json brace_index = json_to_load.index("{") ^^^^^^^^^^^^^^^^^^^^^^^ ValueError: substring not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Auto-GPT\autogpt\logs.py", line 211, in print_assistant_thoughts assistant_reply_json = fix_and_parse_json(assistant_reply) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Auto-GPT\autogpt\json_fixes\parsing.py", line 107, in fix_and_parse_json return try_ai_fix(try_to_fix_with_gpt, e, json_to_load) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Auto-GPT\autogpt\json_fixes\parsing.py", line 136, in try_ai_fix ai_fixed_json = fix_json(json_to_load, JSON_SCHEMA) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Auto-GPT\autogpt\json_fixes\auto_fix.py", line 24, in fix_json result_string = call_ai_function(
NameError: name 'cfg' is not defined
This error message indicates that there is a problem with the code in a program that you are running. Specifically, the code is trying to access a variable or function that has not been defined.
The first part of the error message suggests that the program is trying to parse a JSON string and failing because it can't find a substring (in this case, an opening brace character) that it expects to find. The second part of the error message suggests that the program is trying to fix the JSON string by applying some kind of AI-based algorithm, but it is encountering a NameError because it cannot find the definition of a variable named 'cfg'.
To fix this error, you need to examine the code and identify where the variable 'cfg' is defined. It is possible that it has not been defined at all, or that it has been defined in a different module or file that is not being imported correctly. Once you have identified the location where 'cfg' is defined, you can ensure that it is properly imported and accessible from the current module or file.
Config is not imported. Working on a fix.
The fix for this issue is in review - https://github.com/Significant-Gravitas/Auto-GPT/pull/1600
Move cfg = Config() up above the following in autogpt/memory/base.py:
# try to import sentence transformers, if it fails, default to ada
Fixed with #1600