full trace :
Uncaught app exception
Traceback (most recent call last):
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.dict)
File "/mount/src/chatkobi.ai/main.py", line 4, in
from load_model import Chainer
File "/mount/src/chatkobi.ai/load_model.py", line 2, in
from llm_rs.langchain import RustformersLLM
File "/home/adminuser/venv/lib/python3.9/site-packages/llm_rs/langchain/init.py", line 1, in
from .langchain import RustformersLLM
File "/home/adminuser/venv/lib/python3.9/site-packages/llm_rs/langchain/langchain.py", line 18, in
class RustformersLLM(LLM,Embeddings):
File "/home/adminuser/venv/lib/python3.9/site-packages/llm_rs/langchain/langchain.py", line 74, in RustformersLLM
@root_validator()
File "/home/adminuser/venv/lib/python3.9/site-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.
Description
When attempting to use the llm-rs[langchain] library with pydantic v2, an uncaught app exception is occurring. This is due to the usage of the deprecated @root_validator method without specifying skip_on_failure=True in the llm_rs/langchain/langchain.py file. As a result, the error is raised as mentioned in the full trace.
Steps to Reproduce:
Install the llm-rs library with the following command:
This will automatically install latest version of pydantic.
pip install llm-rs[langchain]
Attempt to use the library in a script or application.
Expected Behavior:
The library should work without raising any errors related to the deprecated @root_validator usage.
Actual Behavior:
An uncaught app exception occurs due to the deprecated @root_validator usage.
Tested Fix:
Add the following import to line 12 in llm_rs/langchain/langchain.py:
# line 12 on llm_rs/langchain/langchain.py
from pydantic.v1 import root_validator
Summary:
The issue is primarily caused by the deprecated usage of @root_validator without specifying skip_on_failure=True. This error occurs when pydantic v2 is installed automatically as a dependency of the llm-rs[langchain] library.
full trace : Uncaught app exception Traceback (most recent call last): File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.dict) File "/mount/src/chatkobi.ai/main.py", line 4, in
from load_model import Chainer
File "/mount/src/chatkobi.ai/load_model.py", line 2, in
from llm_rs.langchain import RustformersLLM
File "/home/adminuser/venv/lib/python3.9/site-packages/llm_rs/langchain/init.py", line 1, in
from .langchain import RustformersLLM
File "/home/adminuser/venv/lib/python3.9/site-packages/llm_rs/langchain/langchain.py", line 18, in
class RustformersLLM(LLM,Embeddings):
File "/home/adminuser/venv/lib/python3.9/site-packages/llm_rs/langchain/langchain.py", line 74, in RustformersLLM
@root_validator()
File "/home/adminuser/venv/lib/python3.9/site-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 specifyskip_on_failure=True
. Note that@root_validator
is deprecated and should be replaced with@model_validator
.Description
When attempting to use the
llm-rs[langchain]
library withpydantic v2
, an uncaught app exception is occurring. This is due to the usage of the deprecated@root_validator
method without specifyingskip_on_failure=True
in thellm_rs/langchain/langchain.py
file. As a result, the error is raised as mentioned in the full trace.Steps to Reproduce:
Install the
llm-rs
library with the following command: This will automatically install latest version of pydantic.Attempt to use the library in a script or application.
Expected Behavior:
The library should work without raising any errors related to the deprecated
@root_validator
usage.Actual Behavior:
An uncaught app exception occurs due to the deprecated
@root_validator
usage.Tested Fix:
Add the following import to line 12 in llm_rs/langchain/langchain.py:
Summary:
The issue is primarily caused by the deprecated usage of
@root_validator
without specifyingskip_on_failure=True
. This error occurs whenpydantic v2
is installed automatically as a dependency of thellm-rs[langchain]
library.