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
相关推荐
meilindehuzi_a4 小时前
LangChain.js 对话 Memory 实战:History 持久化、截断与摘要压缩
java·javascript·langchain
梦在远山后9 小时前
Python 中两种 Queue 的区别
python·langchain
花间相见1 天前
【LangChain组件03】—— LangChain Agents 执行与状态:工作流程与状态管理实战
java·前端·langchain
Darling噜啦啦1 天前
LLM 记忆管理三剑客:截断、总结、检索,彻底搞懂 Agent 的 Memory 系统
langchain·llm·agent
beyond谚语1 天前
六、LangChain——StrOutputParser和JsonOutputParser
langchain·rag·ollama
带鱼吃猫1 天前
LangChain:提示词模板与少样本提示功能
服务器·数据库·langchain
阿黎梨梨1 天前
AI也有记忆?LangChain Memory 管理指南
langchain·node.js·llm
Daisygirl1 天前
审批系统接入 AI 润色后,如何拦截用户乱输入的文本?
langchain
大连好光景1 天前
【AI Agent案例开发项目01解读】
chrome·python·langchain
未若君雅裁1 天前
自定义中间件:Node-style 与 Wrap-style 钩子全解析
python·中间件·langchain