pydantic.errors.PydanticUserError: If you use `@root_validator`

报错

使用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
相关推荐
我爱学Python!1 天前
基于 LangChain 的自动化测试用例的生成与执行
人工智能·自然语言处理·langchain·自动化·llm·测试用例·大语言模型
贪玩懒悦2 天前
用langchain+streamlit应用RAG实现个人知识库助手搭建
人工智能·ai·语言模型·langchain·aigc
AI-智能2 天前
《开源大模型食用指南》,一杯奶茶速通大模型!新增Examples最佳实践!
人工智能·自然语言处理·langchain·开源·prompt·ai大模型
AI知识分享官6 天前
大模型增量训练--基于transformer制作一个大模型聊天机器人
人工智能·深度学习·算法·数据挖掘·langchain·机器人·transformer
weijie.zwj8 天前
LLM基础概念:Prompt
人工智能·python·langchain
玩转AI大模型8 天前
AI产品经理学习路径:从零基础到精通,从此篇开始!
人工智能·学习·语言模型·自然语言处理·langchain·transformer·产品经理
高垚淼9 天前
如何构建智能应用:深入探索Langchain的强大功能与应用潜力
人工智能·python·langchain
AI-入门9 天前
AI大模型:是走向新的巅峰还是陷入发展的僵局?
数据库·人工智能·缓存·langchain·prompt·agi
weijie.zwj10 天前
11. LCEL:LangChain Expression Language
人工智能·langchain
weijie.zwj10 天前
9. LangChain流式输出
人工智能·python·langchain