Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.26k stars 958 forks source link

Hello app does not work #1543

Open BillShiyaoZhang opened 4 hours ago

BillShiyaoZhang commented 4 hours ago

Describe the bug The hello app does not work.

>> $ chainlit hello
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/bin/chainlit", line 5, in <module>
    from chainlit.cli import cli
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/chainlit/__init__.py", line 18, in <module>
    from chainlit.action import Action
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/chainlit/action.py", line 5, in <module>
    from chainlit.telemetry import trace_event
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/chainlit/telemetry.py", line 12, in <module>
    from chainlit.config import config
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/chainlit/config.py", line 538, in <module>
    config = load_config()
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/chainlit/config.py", line 507, in load_config
    settings = load_settings()
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/chainlit/config.py", line 479, in load_settings
    code_settings = CodeSettings(action_callbacks={})
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pydantic/_internal/_dataclasses.py", line 121, in __init__
    s.__pydantic_validator__.validate_python(ArgsKwargs(args, kwargs), self_instance=s)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pydantic/_internal/_mock_val_ser.py", line 100, in __getattr__
    raise PydanticUserError(self._error_message, code=self._code)
pydantic.errors.PydanticUserError: `CodeSettings` is not fully defined; you should define `Action`, then call `pydantic.dataclasses.rebuild_dataclass(CodeSettings)`.

For further information visit https://errors.pydantic.dev/2.10/u/class-not-fully-defined

To Reproduce Steps to reproduce the behavior:

  1. pip install chainlit
  2. chainlit hello
  3. See error

Expected behavior The hello app successfully runs in browser

Desktop:

dosubot[bot] commented 4 hours ago

I found related issues that might be helpful:

To continue talking to Dosu, mention @dosu.

Incospro-Jan commented 4 hours ago

Hi @BillShiyaoZhang ,

I just had the same error log on an existing Chainlit based application. It started about 3 hours ago. When pushing updates and re-deploying the application was crashing with the exact same error.

I looked at the CI/CD logs and found that the pydantic version changed from 2.10.1 to 2.10.2. After pinning the version in the requirements.txt to 2.10.1 I was able to succesfully re-deploy. pydantic==2.10.1 Maybe give that a try and let me know if the error disappears.

BillShiyaoZhang commented 3 hours ago

@Incospro-Jan It works! Thank you!

jackaldenryan commented 2 hours ago

Pinning pydantic to 2.10.1 worked for me as well, thank you!