QwenLM / Qwen-Agent

Agent framework and applications built upon Qwen2, featuring Function Calling, Code Interpreter, RAG, and Chrome extension.
https://pypi.org/project/qwen-agent/
Other
2.51k stars 249 forks source link

TypeError: typing.ClassVar[pydantic.config.ConfigDict] is not valid as type argument #189

Closed delicate00 closed 3 weeks ago

delicate00 commented 3 weeks ago

您好,当我准备启动服务的时候,输入:python run_server.py...... 报错信息为:TypeError: typing.ClassVar[pydantic.config.ConfigDict] is not valid as type argument 是否是因为包的兼容性导致的?我查阅了相关资料却无法得到解决。 我的python版本是3.10.0 库版本如下


accelerate 0.30.1
aiofiles 23.2.1
aiohttp 3.9.5
aiosignal 1.3.1
altair 5.3.0
annotated-types 0.7.0
anyio 4.4.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0 asttokens 2.4.1 async-lru 2.0.4 async-timeout 4.0.3 attrs 23.2.0 Babel 2.15.0 beautifulsoup4 4.12.3 bleach 6.1.0 certifi 2024.2.2 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 comm 0.2.2 contourpy 1.2.1 cryptography 42.0.7 cycler 0.12.1 dashscope 1.19.2 debugpy 1.8.1 decorator 5.1.1 defusedxml 0.7.1 distro 1.9.0 dnspython 2.6.1 einops 0.8.0 email_validator 2.1.1 eval_type_backport 0.2.0 exceptiongroup 1.2.1 executing 2.0.1 fastapi 0.111.0 fastapi-cli 0.0.4 fastjsonschema 2.19.1 ffmpy 0.3.2 filelock 3.14.0 fonttools 4.53.0 fqdn 1.5.1 frozenlist 1.4.1 fsspec 2024.5.0 gradio 4.32.2 gradio_client 0.17.0 h11 0.14.0 html2text 2024.2.26 httpcore 1.0.5 httptools 0.6.1 httpx 0.27.0 huggingface-hub 0.23.2 idna 3.7 importlib_resources 6.4.0 intel-openmp 2021.4.0 ipykernel 6.29.4 ipython 8.25.0 ipywidgets 8.1.3 isoduration 20.11.0 jedi 0.19.1 jieba 0.42.1 Jinja2 3.1.4 json5 0.9.25 jsonlines 4.0.0 jsonpointer 2.4 jsonschema 4.22.0 jsonschema-specifications 2023.12.1 jupyter 1.0.0 jupyter_client 8.6.2 jupyter-console 6.6.3 jupyter_core 5.7.2 jupyter-events 0.10.0 jupyter-lsp 2.2.5 jupyter_server 2.14.1 jupyter_server_terminals 0.5.3 jupyterlab 4.2.1 jupyterlab_pygments 0.3.0 jupyterlab_server 2.27.2 jupyterlab_widgets 3.0.11 kiwisolver 1.4.5 lxml 5.2.2 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.9.0 matplotlib-inline 0.1.7 mdurl 0.1.2 mistune 3.0.2 mkl 2021.4.0 modelscope_studio 0.3.0 mpmath 1.3.0 multidict 6.0.5 nbclient 0.10.0 nbconvert 7.16.4 nbformat 5.10.4 nest-asyncio 1.6.0 networkx 3.3 notebook 7.2.0 notebook_shim 0.2.4 numpy 1.26.4 openai 1.30.5 orjson 3.10.3 overrides 7.7.0 packaging 24.0 pandas 2.2.2 pandocfilters 1.5.1 parso 0.8.4 pdfminer.six 20231228 pdfplumber 0.11.0 pillow 10.3.0 pip 24.0 platformdirs 4.2.2 prometheus_client 0.20.0 prompt_toolkit 3.0.45 psutil 5.9.8 pure-eval 0.2.2 pycparser 2.22 pydantic 2.7.2 pydantic_core 2.18.3 pydub 0.25.1 Pygments 2.18.0 pyparsing 3.1.2 pypdfium2 4.30.0 python-dateutil 2.9.0.post0 python-docx 1.1.2 python-dotenv 1.0.1 python-json-logger 2.0.7 python-multipart 0.0.9 python-pptx 0.6.23 pytz 2024.1 pywin32 306 pywinpty 2.0.13 PyYAML 6.0.1 pyzmq 26.0.3 qtconsole 5.5.2 QtPy 2.4.1 qwen-agent 0.0.4 rank-bm25 0.2.2 referencing 0.35.1 regex 2024.5.15 requests 2.32.3 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rich 13.7.1 rpds-py 0.18.1 ruff 0.4.7 safetensors 0.4.4.dev0 D:\WYN\Qwen\safetensors\bindings\python scipy 1.13.1 seaborn 0.13.2 semantic-version 2.10.0 Send2Trash 1.8.3 setuptools 70.0.0 setuptools-rust 1.9.0 shellingham 1.5.4 six 1.16.0 sniffio 1.3.1 snowballstemmer 2.2.0 soupsieve 2.5 sse-starlette 2.1.0 stack-data 0.6.3 starlette 0.37.2 sympy 1.12.1 tbb 2021.12.0 terminado 0.18.1 tiktoken 0.7.0 tinycss2 1.3.0 tokenizers 0.15.2 tomli 2.0.1 tomlkit 0.12.0 toolz 0.12.1 torch 2.3.0 tornado 6.4 tqdm 4.66.4 traitlets 5.14.3 transformers 4.37.2 transformers-stream-generator 0.0.4 typer 0.12.3 types-python-dateutil 2.9.0.20240316 typing_extensions 4.12.1 tzdata 2024.1 ujson 5.10.0 uri-template 1.3.0 urllib3 2.2.1 uvicorn 0.30.0 watchfiles 0.22.0 wcwidth 0.2.13 webcolors 1.13 webencodings 0.5.1 websocket-client 1.8.0 websockets 11.0.3 wheel 0.43.0 widgetsnbextension 4.0.11 XlsxWriter 3.2.0 yarl 1.9.4

(qwentongyi) D:\Qwen-Agent-main>python run_server.py --llm qwen-plus --model_server dashscope --workstation_port 7864 --api_key Traceback (most recent call last): File "D:\WYN\Qwen-Agent-main\run_server.py", line 144, in main() File "D:\WYN\Qwen-Agent-main\run_server.py", line 100, in main from qwen_agent.utils.utils import append_signal_handler, get_local_ip, logger File "D:\WYN\Qwen-Agent-main\qwen_agent__init.py", line 2, in from .agent import Agent File "D:\WYN\Qwen-Agent-main\qwen_agent\agent.py", line 7, in from qwen_agent.llm import get_chat_model File "D:\WYN\Qwen-Agent-main\qwen_agent\llm__init__.py", line 6, in from .oai import TextChatAtOAI File "D:\WYN\Qwen-Agent-main\qwen_agent\llm\oai.py", line 5, in import openai File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\openai__init.py", line 8, in from . import types File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\openai\types\init__.py", line 5, in from .batch import Batch as Batch File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\openai\types\batch.py", line 7, in from .._models import BaseModel File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\openai_models.py", line 77, in class BaseModel(pydantic.BaseModel): File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\pydantic_internal_model_construction.py", line 197, in new__ set_model_fields(cls, bases, config_wrapper, types_namespace) File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\pydantic_internal_model_construction.py", line 474, in set_model_fields fields, class_vars = collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map=typevars_map) File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\pydantic_internal_fields.py", line 131, in collect_model_fields type_hints = get_cls_type_hints_lenient(cls, types_namespace) File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\pydantic_internal_typing_extra.py", line 226, in get_cls_type_hints_lenient hints[name] = eval_type_lenient(value, globalns, localns) File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\pydantic_internal_typing_extra.py", line 238, in eval_type_lenient return eval_type_backport(value, globalns, localns) File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\site-packages\pydantic_internal_typing_extra.py", line 254, in eval_type_backport return typing._eval_type( # type: ignore File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\typing.py", line 332, in _eval_type return t._evaluate(globalns, localns, recursive_guard) File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\typing.py", line 698, in evaluate type = _type_check( File "C:\ProgramData\Anaconda3\envs\qwentongyi\lib\typing.py", line 172, in _type_check raise TypeError(f"{arg} is not valid as type argument") TypeError: typing.ClassVar[pydantic.config.ConfigDict] is not valid as type argument