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
相关推荐
带刺的坐椅3 小时前
LangChain4j 比 SolonAI 强在哪?弱在哪?
java·ai·langchain·solon·mcp
Kay_Liang4 小时前
大语言模型如何精准调用函数—— Function Calling 系统笔记
java·大数据·spring boot·笔记·ai·langchain·tools
沐雪架构师17 小时前
乐学LangChain(1):总体架构和核心组件
langchain·学习方法
马尚来21 小时前
helloworld入门【从0到1,LangChain+RAG全链路实战AI知识库】
langchain
马尚来21 小时前
从0到1,LangChain+RAG全链路实战AI知识库
langchain
叼菠萝1 天前
AI 应用开发三剑客系列:LangChain 如何撑起 LLM 应用开发基石?
python·langchain
MichaelIp1 天前
基于MCP协议的多AGENT文章自动编写系统
语言模型·langchain·prompt·ai写作·llamaindex·langgraph·mcp
玲小珑1 天前
LangChain.js 完全开发手册(十六)实战综合项目二:AI 驱动的代码助手
前端·langchain·ai编程
viperrrrrrrrrr72 天前
Agent向量存储中的记忆衰退与记忆过载解决方案
langchain·大模型·agent·rag
爱喝白开水a3 天前
LangChain 基础系列之 Prompt 工程详解:从设计原理到实战模板_langchain prompt
开发语言·数据库·人工智能·python·langchain·prompt·知识图谱