Closed OannesGPT closed 1 year ago
Can't comment on the first error yet, but the second (NameError: name 'cfg' is not defined`) is being addressed on #1600 and others.
If you want to temporarily resolve it yourself, you'll need to import Config in autogpt\json_fixes\auto_fix.py:
"""This module contains the function to fix JSON strings using GPT-3."""
import json
from autogpt.llm_utils import call_ai_function
from autogpt.logs import logger
from autogpt.config import Config
cfg = Config()
def fix_json(json_str: str, schema: str) -> str:
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.
This issue was closed automatically because it has been stale for 10 days with no activity.
Duplicates
Steps to reproduce 🕹
I experience an error I hadn't before the re-organsation error
I set as first goal to read my instructions: "Read {''file'': instructions.txt} and follow and follow any instructions in that"
Instructions.txt contains:
Develop a game app heads and tails in python that works offline in the browser, the Python module where to save this code will be called
main.py'. Here are the game rules: "In the game of Heads and Tails, a coin is flipped and the player must guess whether it will land on heads or tails. If the player guesses correctly, they win. If they guess incorrectly, they lose. The game can be played with any number of players, and the winner is the player with the highest number of correct guesses at the end of the designated number of rounds. In the event of a tie, the players can either share the victory or play a tiebreaker round."Use your commands such as write_file, append, evaluate, execute, improve. Do not delete the .txt file instructions.txt by any means `
Current behavior 😯
`Error: Traceback (most recent call last): File "C:\Users\Hannes\Documents\GitHub\Auto-GPT\autogpt\json_fixes\parsing.py", line 105, in fix_and_parse_json return json.loads(maybe_fixed_json) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Hannes\AppData\Local\Programs\Python\Python311\Lib\json__init__.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Hannes\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Hannes\AppData\Local\Programs\Python\Python311\Lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) ^^^^^^^^^^^^^^^^^^^^^^ json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 13 column 9 (char 2324)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\Hannes\Documents\GitHub\Auto-GPT\autogpt\logs.py", line 211, in print_assistant_thoughts assistant_reply_json = fix_and_parse_json(assistant_reply) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Hannes\Documents\GitHub\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:\Users\Hannes\Documents\GitHub\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:\Users\Hannes\Documents\GitHub\Auto-GPT\autogpt\json_fixes\auto_fix.py", line 24, in fix_json function_string, args, description_string, model=cfg.fast_llm_model ^^^ NameError: name 'cfg' is not defined`
Expected behavior 🤔
Before the latest pull he didn't run into this error
Your prompt 📝