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
相关推荐
掘我的金15 小时前
15_LangChain自定义Callback组件
langchain
东方不败之鸭梨的测试笔记1 天前
智能测试用例生成工具设计
人工智能·ai·langchain
堆栈future2 天前
LangGraph实践-构建AI工作流:创建一本大模型应用开发书籍
langchain·llm·aigc
大志说编程2 天前
LangChain框架入门15:深度解析Retrievers检索器组件
python·langchain·llm
堆栈future3 天前
Google Agent白皮书:深度解析生成式AI Agent
langchain·llm·aigc
ai绘画-安安妮3 天前
零基础学LangChain:核心概念与基础组件解析
人工智能·学习·ai·程序员·langchain·大模型·转行
掘我的金3 天前
13_LangChain向量管理高阶指南
langchain
欧阳码农4 天前
langgraph开发Deep Research智能体-项目搭建
前端·后端·langchain
大志说编程4 天前
LangChain框架入门14:深入解析向量存储组件VectorStore
python·langchain·ai编程
王国强20095 天前
LangChain 设计原理分析¹² | LangGraph 解构——持久化、有状态协作与长时间任务
langchain