Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the code fails after giving additional information at the questions. #754

Closed
tomhermans opened this issue Oct 2, 2023 · 20 comments · Fixed by #769
Closed

the code fails after giving additional information at the questions. #754

tomhermans opened this issue Oct 2, 2023 · 20 comments · Fixed by #769
Labels
bug Something isn't working

Comments

@tomhermans
Copy link

Policy and info

  • Maintainers will close issues that have been stale for 14 days if they contain relevant answers.
  • Adding the label "sweep" will automatically turn the issue into a coded pull request. Works best for mechanical tasks. More info/syntax at: https://docs.sweep.dev/

Expected Behavior

That I get some feedback, e.g. code that I can use.

Current Behavior

Fails after the additional questions.

Failure Information

Nothing more to clarify.
Traceback (most recent call last):

File "/Users/tom/Library/Python/3.9/bin/gpt-engineer", line 8, in
sys.exit(app())

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/gpt_engineer/main.py", line 96, in main
messages = step(ai, dbs)

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/gpt_engineer/steps.py", line 192, in gen_clarified_code
messages = AI.deserialize_messages(dbs.logs[clarify.name])

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/gpt_engineer/ai.py", line 216, in deserialize_messages
return list(messages_from_dict(json.loads(jsondictstr))) # type: ignore

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/langchain/schema/messages.py", line 351, in messages_from_dict
return [_message_from_dict(m) for m in messages]

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/langchain/schema/messages.py", line 351, in
return [_message_from_dict(m) for m in messages]

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/langchain/schema/messages.py", line 331, in _message_from_dict
return AIMessage(**message["data"])

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/langchain/load/serializable.py", line 90, in init
super().init(**kwargs)

File "/Users/tom/Library/Python/3.9/lib/python/site-packages/pydantic/v1/main.py", line 341, in init
raise validation_error

pydantic.v1.error_wrappers.ValidationError: 1 validation error for AIMessage
is_chunk
unexpected value; permitted: False (type=value_error.const; given=True; permitted=(False,))

python --version
Python 3.11.6

chatgpt API, 3.5-turbo

Possibly related waring/issue I get is:
Users/tom/Library/Python/3.9/lib/python/site-packages/urllib3/init.py:34: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: urllib3/urllib3#3020

Steps to Reproduce

If possible, provide detailed steps for reproducing the issue.

  1. I have a prompt file (no extension) in a folder
  2. I run gpt-engineer folder
  3. I get additional questions
  4. After that, it fails everytime, tried 3 different folders with different prompts, I once skipped the questions, other times I answered them all.. fail everytime.

Failure Logs

Any relevant log snippets or files here.

@tomhermans tomhermans added bug Something isn't working triage Interesting but stale issue. Will be close if inactive for 3 more days after label added. labels Oct 2, 2023
@ayozehd
Copy link

ayozehd commented Oct 3, 2023

stuck in same bug 👍

@nevoodoo
Copy link

nevoodoo commented Oct 3, 2023

Same issue, bumping!

@bharat-pk-codebase
Copy link

same here .

@guglielmo
Copy link

Same here

@Rafaellavatt
Copy link

Rafaellavatt commented Oct 3, 2023

Same for me.

running gpt-3.5-turbo and have tried python 3.9.18 and 3.11.5. same error in both.
looking into my pip installation I find pydantic 2.4.2

@Gushley110
Copy link

Gushley110 commented Oct 4, 2023

Same

python version 3.11.3
model gpt-4

@reckenreb
Copy link

reckenreb commented Oct 4, 2023

Same, tried stepping back to python version 3.11.5, got the same error message.
Tried gpt-4 and gpt-3.5-turbo, but based on the error message it's a problem with pydantic, so the model shouldn't be a concern.

@pralad-p
Copy link
Contributor

pralad-p commented Oct 4, 2023

Same, tried stepping back to python version 3.11.5, got the same error message. Tried gpt-4 and gpt-3.5-turbo, but based on the error message it's a problem with pydantic, so the model shouldn't be a concern.

Actually might originate from Langchain, since return AIMessage(**message["data"]) is somehow assigning is_chunk to true. Could just be a default property mismatch.

@Tobiasonline
Copy link

Same issue here...

@jslomkowski
Copy link

install development version via pip install -e . instead of python -m pip install gpt-engineer I assume this will be fixed soon

@Donneker
Copy link

Donneker commented Oct 4, 2023

install development version via pip install -e . instead of python -m pip install gpt-engineer I assume this will be fixed soon

this works, thank you

@tomhermans
Copy link
Author

tomhermans commented Oct 5, 2023

@jslomkowski @Donneker is this normal ? (noob python user here). I'm on Mac ventura 13.0.1).
(Thanks for the info btw.)
It speaks about requirement already satisfied but those seem to be 3.9 versions and the last messages seem to indicate that some packages are not found...

Defaulting to user installation because normal site-packages is not writeable
Obtaining file:///Users/tom/00_sites/04_test/gpt-engineer/gpt-engineer
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: black==23.3.0 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (23.3.0)
Requirement already satisfied: click>=8.0.0 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (8.1.7)
Requirement already satisfied: mypy==1.3.0 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (1.3.0)
Requirement already satisfied: openai==0.27.8 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.27.8)
Requirement already satisfied: pre-commit==3.3.3 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (3.3.3)
Requirement already satisfied: pytest==7.3.1 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (7.3.1)
Requirement already satisfied: ruff==0.0.272 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.0.272)
Requirement already satisfied: termcolor==2.3.0 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (2.3.0)
Requirement already satisfied: typer>=0.3.2 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.9.0)
Requirement already satisfied: rudder-sdk-python==2.0.2 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (2.0.2)
Requirement already satisfied: dataclasses-json==0.5.7 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.5.7)
Requirement already satisfied: tiktoken>=0.0.4 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.5.1)
Requirement already satisfied: tabulate==0.9.0 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.9.0)
Requirement already satisfied: python-dotenv>=0.21.0 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.21.1)
Requirement already satisfied: langchain>=0.0.240 in /Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.0.306)
INFO: pip is looking at multiple versions of gpt-engineer to determine which version is compatible with other requirements. This could take a while.
ERROR: Ignored the following versions that require a different python version: 1.0.1 Requires-Python >=3.10,<4.0.0
ERROR: Could not find a version that satisfies the requirement agent-protocol==1.0.1 (from gpt-engineer) (from versions: 1.0.0)
ERROR: No matching distribution found for agent-protocol==1.0.1

@Donneker
Copy link

Donneker commented Oct 5, 2023

You are right, I had not exactly the same error as you had. but the version installed via pip install did not work.
it is more like the issue linked above: #769
additional questions asked got the routine to break

so what I did is, check the source project gpt-engineer out from github in a new directory
then created a new virtual env there
then I installed the gpt-engineer via this source as @jslomkowski said above
pip install -e .
that worked, installed the gpt-engineer local, and this version then worked fine for myself.

I use python 3.11.5 and have installed the following packages
`$ pip list
Package Version Editable project location


agent-protocol 1.0.1
aiofiles 23.2.1
aiohttp 3.8.5
aiosignal 1.3.1
annotated-types 0.5.0
anyio 3.7.1
async-timeout 4.0.3
attrs 23.1.0
backoff 2.2.1
black 23.3.0
certifi 2023.7.22
cfgv 3.4.0
charset-normalizer 3.3.0
click 8.1.7
colorama 0.4.6
dataclasses-json 0.5.7
deprecation 2.0.7
distlib 0.3.7
fastapi 0.100.1
filelock 3.12.4
frozenlist 1.4.0
gpt-engineer 0.0.9 C:\local\git\gpt-engineer
greenlet 3.0.0
h11 0.14.0
h2 4.1.0
hpack 4.0.0
hypercorn 0.14.4
hyperframe 6.0.1
identify 2.5.30
idna 3.4
iniconfig 2.0.0
jsonpatch 1.33
jsonpointer 2.4
langchain 0.0.308
langsmith 0.0.41
marshmallow 3.20.1
marshmallow-enum 1.5.1
monotonic 1.6
multidict 6.0.4
mypy 1.3.0
mypy-extensions 1.0.0
nodeenv 1.8.0
numpy 1.26.0
openai 0.27.8
packaging 23.2
pathspec 0.11.2
pip 23.2.1
platformdirs 3.11.0
pluggy 1.3.0
pre-commit 3.3.3
priority 2.0.0
pydantic 1.10.13
pydantic_core 2.10.1
pytest 7.3.1
python-dateutil 2.8.2
python-dotenv 0.21.1
python-multipart 0.0.6
PyYAML 6.0.1
regex 2023.10.3
requests 2.31.0
rudder-sdk-python 2.0.2
ruff 0.0.272
setuptools 68.2.2
six 1.16.0
sniffio 1.3.0
SQLAlchemy 2.0.21
starlette 0.27.0
tabulate 0.9.0
tenacity 8.2.3
termcolor 2.3.0
tiktoken 0.5.1
tqdm 4.66.1
typer 0.9.0
typing_extensions 4.8.0
typing-inspect 0.9.0
urllib3 2.0.6
virtualenv 20.24.5
wheel 0.41.2
wsproto 1.2.0
yarl 1.9.2
`

as you can see above the gpt-engineer package is taken locally from where I checked out the sources -> C:\local\git\gpt-engineer

@pralad-p
Copy link
Contributor

pralad-p commented Oct 5, 2023

Also found that in the clarify logs during deserialization, the is_chunk is implicitly set to True which is not allowed according to Langchain. I've implemented a fix to explicitly set this value to False in #769 (hopefully it gets approved soon). 😄

@Donneker
Copy link

Donneker commented Oct 5, 2023

Good work @pralad-p
I have some hint for your problem @tomhermans
you seem to have multiple python installations in your system.

you reported, when you execute, you get
python --version
Python 3.11.6

but, in the stacktrace of your error it clearly states from the directories you see in there, that the version looks like beeing 3.9
/Users/tom/Library/Python/3.9/lib/python/site-packages (from gpt-engineer==0.0.9) (0.0.306)
INFO: pip is looking at multiple versions of gpt-engineer to determine which version is compatible with other requirements. This could take a while.
ERROR: Ignored the following versions that require a different python version: 1.0.1 Requires-Python >=3.10,<4.0.0

the last error also shows, it seems not to be python 3.10 or greater, where that stack trace comes from.

I would assume, you clean the older python installation, or you make sure, that you work with your newer installed python version.
if you cannot remove the old, you can try creating a python virtual environment with the venv package, which could help you to sort such issues out and make sure you use the correct version you wanna use with your command.

@tomhermans
Copy link
Author

Thanks @Donneker I'll try that.

@ATheorell ATheorell removed the triage Interesting but stale issue. Will be close if inactive for 3 more days after label added. label Oct 6, 2023
@ATheorell
Copy link
Collaborator

Would be awesome if you tried the fix and report whether the issue persists.

@arnaudlacour
Copy link

I just installed everything and started from scratch today and am running into the same issue.
Python 3.10.12
pip 22.0.2

I did:

python 3 -m venv .
. bin/activate
pip3 install gpt-engineer

I then create a sub-directory, put my prompt, run gpt-engineer and:

Summary of areas that need clarification:

1. The specific standard format for the UUID.
2. The structure of the JSON output when the "format" parameter is set to "json".
3. The default behavior when the "format" parameter is not provided in the GET request.
4. The behavior of the API when an invalid value is provided for the "format" parameter.

Clarifying question: Could you please specify the exact structure of the JSON output when the "format" parameter is set to "json"?
(answer in text, or "c" to move on)
the json output should be a json array with a single element 

Remaining unclear areas: 
1. The specific standard format for the UUID.
2. The default behavior when the "format" parameter is not provided in the GET request.
3. The behavior of the API when an invalid value is provided for the "format" parameter.

Next question: Could you please specify the exact standard format for the UUID that the API should generate?
(answer in text, or "c" to move on)
version 4 UUID

Remaining unclear areas: 
1. The default behavior when the "format" parameter is not provided in the GET request.
2. The behavior of the API when an invalid value is provided for the "format" parameter.

Next question: What should be the default behavior when the "format" parameter is not provided in the GET request?
(answer in text, or "c" to move on)
the default should be text

Remaining unclear area: 
1. The behavior of the API when an invalid value is provided for the "format" parameter.

Next question: What should be the behavior of the API when an invalid value is provided for the "format" parameter?
(answer in text, or "c" to move on)
return the text version

Nothing more to clarify.
Traceback (most recent call last):

  File "/home/arno/workspace/gpt-engineer/bin/gpt-engineer", line 8, in <module>
    sys.exit(app())

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/gpt_engineer/main.py", line 96, in main
    messages = step(ai, dbs)

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/gpt_engineer/steps.py", line 192, in gen_clarified_code
    messages = AI.deserialize_messages(dbs.logs[clarify.__name__])

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/gpt_engineer/ai.py", line 216, in deserialize_messages
    return list(messages_from_dict(json.loads(jsondictstr)))  # type: ignore

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/langchain/schema/messages.py", line 351, in messages_from_dict
    return [_message_from_dict(m) for m in messages]

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/langchain/schema/messages.py", line 351, in <listcomp>
    return [_message_from_dict(m) for m in messages]

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/langchain/schema/messages.py", line 331, in _message_from_dict
    return AIMessage(**message["data"])

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/langchain/load/serializable.py", line 97, in __init__
    super().__init__(**kwargs)

  File "/home/arno/workspace/gpt-engineer/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in __init__
    raise validation_error

pydantic.v1.error_wrappers.ValidationError: 1 validation error for AIMessage
is_chunk
  unexpected value; permitted: False (type=value_error.const; given=True; permitted=(False,))

@ATheorell
Copy link
Collaborator

@arnaudlacour
Thank you for reporting.
This was fixed in #769

The reason why that you are still getting it is that the fix still hasn't been propagated to pypi, which it will be in the next release (soon). For now, installing the main branch from github will fix the problem.

@arnaudlacour
Copy link

@arnaudlacour Thank you for reporting. This was fixed in #769

The reason why that you are still getting it is that the fix still hasn't been propagated to pypi, which it will be in the next release (soon). For now, installing the main branch from github will fix the problem.

Thanks for the clarification, using the main branch worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.