gpt-engineer icon indicating copy to clipboard operation
gpt-engineer copied to clipboard

Errors in simple run

Open eliashanna9 opened this issue 1 year ago • 1 comments

Hey, running the same as in the demo, creating a Go DSL parser and got the following error:

Assuming that the codebase is a Go project, the following commands can be used to install dependencies and run the codebase:

1. Install dependencies:
go mod download

2. Run the codebase:
go run *.go

Note: The above commands assume that all the Go files are in the same directory and that the main function is in one of the files. If the main function is in a different file, replace `*.go` with the name of the file containing the main function.
Traceback (most recent call last):

  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,

  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)

  File "/root/dev/gpt-engineer/gpt_engineer/main.py", line 49, in <module>
    app()

  File "/root/dev/gpt-engineer/gpt_engineer/main.py", line 45, in chat
    messages = step(ai, dbs)

  File "/root/dev/gpt-engineer/gpt_engineer/steps.py", line 106, in execute_workspace
    messages = gen_entrypoint(ai, dbs)

  File "/root/dev/gpt-engineer/gpt_engineer/steps.py", line 141, in gen_entrypoint
    [[lang, command]] = parse_chat(messages[-1]["content"])

ValueError: too many values to unpack (expected 1)

Running in an ubuntu container on a M1 Mac

eliashanna9 avatar Jun 21 '23 11:06 eliashanna9

The error message suggests that there is an issue with the parse_chat function in your code. It seems that the function is expected to return a list of lists with one element each, but it is returning more than one element. 🥇 💯

To resolve this issue, you can modify the parse_chat function to ensure that it returns a list of lists with exactly one element each. Here's an example of how you can modify the function:

python

def parse_chat(content): # Your existing implementation of parse_chat

# Instead of returning a single list, return a list of lists with one element each
return [[lang, command] for lang, command in parsed_content]

By using a list comprehension to construct the result, you will create a list of lists, with each inner list containing one language and command pair.

Make sure to apply this modification to the parse_chat function and try running your code again.

Ishaipita avatar Jun 21 '23 12:06 Ishaipita

Is solved now

AntonOsika avatar Jul 08 '23 15:07 AntonOsika