报错
使用langchain时,import langchain时报错内容如下:
python
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.
For further information visit https://errors.pydantic.dev/2.7/u/root-validator-pre-skip
解决
pydantic的版本问题,将pydantic库的版本降低到1.10.13,pydantic_core等相关依赖库的版本也会自动降低。
python
pip install pydantic==1.10.13 -i https://pypi.tuna.tsinghua.edu.cn/simple