vanna-ai / vanna

🤖 Chat with your SQL database 📊. Accurate Text-to-SQL Generation via LLMs using RAG 🔄.
https://vanna.ai/docs/
MIT License
11.04k stars 862 forks source link

ZhipuAI broken? #322

Closed andreped closed 6 months ago

andreped commented 6 months ago

Describe the bug When I try to run tests using ZhipuAI I observed that imports seemed broken at launch.

To Reproduce

pip install vanna zhipuai

python -c "from zhipuai import ZhipuAI"

Error logs/Screenshots

(venv) apedersen@AM-W09FC9N7R4 vanna % python -c "from zhipuai import ZhipuAI"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/andreped/workspace/vanna/venv/lib/python3.10/site-packages/zhipuai/__init__.py", line 2, in <module>
    from ._client import ZhipuAI
  File "/Users/andreped/workspace/vanna/venv/lib/python3.10/site-packages/zhipuai/_client.py", line 9, in <module>
    from .core._http_client import HttpClient, ZHIPUAI_DEFAULT_MAX_RETRIES
  File "/Users/andreped/workspace/vanna/venv/lib/python3.10/site-packages/zhipuai/core/_http_client.py", line 21, in <module>
    from ._request_opt import ClientRequestParam, UserRequestInput
  File "/Users/andreped/workspace/vanna/venv/lib/python3.10/site-packages/zhipuai/core/_request_opt.py", line 25, in <module>
    class ClientRequestParam(pydantic.BaseModel):
  File "pydantic/main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 504, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 434, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 550, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 661, in pydantic.fields.ModelField._type_analysis
  File "pydantic/fields.py", line 806, in pydantic.fields.ModelField._create_sub_type
  File "pydantic/fields.py", line 434, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 555, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 829, in pydantic.fields.ModelField.populate_validators
  File "pydantic/validators.py", line 765, in find_validators
RuntimeError: no validator found for <class 'zhipuai.core._base_type.NotGiven'>, see `arbitrary_types_allowed` in Config

Desktop (please complete the following information where):

andreped commented 6 months ago

Oh, it seems to be a bug inside ZhipuAI it self. I managed to reproduce the issue by running:

python -c "import zhipuai"
andreped commented 6 months ago

Apprently, downgrading pydantic fixes the issue.

So do this to fix the issue:

pip install pydantic==2.5.2
python -c "import zhipuai"

I can make a PR to try to limit pydantic versions that can be used to support all agents.

andreped commented 6 months ago

Hmm, actually simply reinstalling pydantic (even to latest) seems to have resolved the issue:

pip install pydantic --upgrade --force-reinstall

Are anyone able to reproduce the issue?

zainhoda commented 6 months ago

I'm not sure about having a native ZhipuAI integration. This was contributed by a community member but it might be worth considering the work necessary to support it going forward. Ideally I'd like to include all major options as part of the basic integration tests and I'm a little skeptical about supporting this one.

Perhaps we need to consider having something like "community" features that aren't "officially" supported?

andreped commented 6 months ago

I'm not sure about having a native ZhipuAI integration.

Sounds fine not to maintain it if the ZhipuAI integration is not commonly used with Vanna, but who knows.

Perhaps we need to consider having something like "community" features that aren't "officially" supported?

Thats a cool idea. It is quite common to do in larger projects. Like making a repo called vanna-contrib and people could contribute modules and implementations that are not thaaat relevant for everyone, but still easily accessible (pip install vanna-contrib).

I guess this could be achieved by depending on vanna and its vanna.base to allow adding different types of clients and whatnot. Then again I am not sure Vanna is ready for that move. Seems like a lot of users are mainly interested in core features and core features being improved. Do you want to maintain both repos? :P

andreped commented 6 months ago

As the issue was related to pydantic versioning, which can be easily solved with reinstalling it, and that ZhipuAI is not that critical for Vanna nor actively used, I am closing this issue.