Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@root_validator error #11749

Closed
1 of 14 tasks
brainer3220 opened this issue Oct 13, 2023 · 3 comments
Closed
1 of 14 tasks

@root_validator error #11749

brainer3220 opened this issue Oct 13, 2023 · 3 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: models Related to LLMs or chat model modules

Comments

@brainer3220
Copy link

System Info

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/langchain/__init__.py", line 8, in <module>
    from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
  File "/usr/local/lib/python3.8/dist-packages/langchain/agents/__init__.py", line 2, in <module>
    from langchain.agents.agent import Agent
  File "/usr/local/lib/python3.8/dist-packages/langchain/agents/agent.py", line 10, in <module>
    from langchain.chains.base import Chain
  File "/usr/local/lib/python3.8/dist-packages/langchain/chains/__init__.py", line 2, in <module>
    from langchain.chains.conversation.base import ConversationChain
  File "/usr/local/lib/python3.8/dist-packages/langchain/chains/conversation/base.py", line 7, in <module>
    from langchain.chains.conversation.memory import ConversationBufferMemory
  File "/usr/local/lib/python3.8/dist-packages/langchain/chains/conversation/memory.py", line 7, in <module>
    from langchain.chains.conversation.prompt import SUMMARY_PROMPT
  File "/usr/local/lib/python3.8/dist-packages/langchain/chains/conversation/prompt.py", line 2, in <module>
    from langchain.prompts.prompt import PromptTemplate
  File "/usr/local/lib/python3.8/dist-packages/langchain/prompts/__init__.py", line 2, in <module>
    from langchain.prompts.base import BasePromptTemplate
  File "/usr/local/lib/python3.8/dist-packages/langchain/prompts/base.py", line 35, in <module>
    class BasePromptTemplate(BaseModel, ABC):
  File "/usr/local/lib/python3.8/dist-packages/langchain/prompts/base.py", line 41, in BasePromptTemplate
    @root_validator()
  File "/usr/local/lib/python3.8/dist-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
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`.

Who can help?

@agola11

import langchain

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

Reproduction

  1. Install langchain latest version on Linux
  2. import langchain

Expected behavior

Nothing.

@dosubot dosubot bot added Ɑ: models Related to LLMs or chat model modules 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Oct 13, 2023
@dosubot
Copy link

dosubot bot commented Oct 13, 2023

🤖

Hello @agola11,

Thank you for providing detailed information about the issue you're facing. The error message you're seeing is related to the Pydantic library, which is a dependency of LangChain.

Based on the traceback you've provided, it seems that the error is being raised because the @root_validator decorator is being used without specifying skip_on_failure=True. This is a requirement in newer versions of Pydantic. However, LangChain v0.0.313 is compatible with Pydantic versions 1 and 2, as specified in the pyproject.toml file of the LangChain repository.

There are a few similar issues that have been resolved in the past. The common solution in these issues was to downgrade the Pydantic library to version 1.10.9. This can be done by running the command pip install pydantic==1.10.9.

Here are the links to the similar issues for your reference:

Please try downgrading Pydantic to version 1.10.9 and let us know if the issue persists. If it does, we'll continue to investigate and find a solution.

Best,
Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@shimilgithub
Copy link

@dosu-bot is there any other solution for this issue instead of downgrading pydantic to v1?

@devstein
Copy link

@shimilgithub As of now Dosu only responds to the issue author. Stay tuned for changes on this in the coming weeks.

Let me know if you have any ideas/feedback on Dosu in the meantime!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: models Related to LLMs or chat model modules
Projects
None yet
Development

No branches or pull requests

3 participants