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
相关推荐
新知图书1 小时前
用于 HR FAQ 场景的AI Agent原型演示
人工智能·langchain
.柒宇.1 小时前
AI-Agent入门实战-AI私厨
人工智能·python·langchain·agent·fastapi
默子昂1 小时前
langchain 基本使用
开发语言·python·langchain
网络工程小王2 小时前
【LangGraph 子图(Subgraph)详解】学习笔记
java·服务器·数据库·人工智能·langchain
狐狐生风3 小时前
LangGraph 工具调用集成
python·langchain·prompt·agent·langgraph
swipe4 小时前
别把 Agent 写成一团 Prompt:用 LangGraph 把多 Agent 系统变成可控状态机
后端·langchain·llm
专职4 小时前
02-Langchain大模型提示词工程应用实践
langchain
code bean5 小时前
【LangChain】DashScope 与 LangChain 的协作关系
langchain
Lazy_zheng5 小时前
LangChain + RAG 入门实战:从模型调用到完整 RAG 流水线
langchain·llm·agent
ftpeak6 小时前
LangGraph Agent 开发指南(1~概述)
人工智能·ai·langchain·langgraph