trulens icon indicating copy to clipboard operation
trulens copied to clipboard

[BUG] ValidationError: 1 validation error for DataSource component_type subclass of BaseComponent expected (type=type_error.subclass; expected_class=BaseComponent)

Open guybartal opened this issue 11 months ago • 5 comments

Bug Description What happened? trying to import Feedback and got an error message

To Reproduce install python 3.10.13

pip install the following: mercurial==6.3.2 setuptools==66.1.1 six==1.16.0 wheel==0.38.4 python-dotenv==1.0.1 numpy==1.26.4 nest-asyncio==1.6.0 trulens_eval==0.24.1 llama-index==0.10.15 tensoflow keras trulens

Expected behavior should import correctly

Relevant Logs/Tracebacks


---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[1], [line 1](vscode-notebook-cell:?execution_count=1&line=1)
----> [1](vscode-notebook-cell:?execution_count=1&line=1) import utils

File [~/repos/learn/llama/rag/utils.py:16](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:16)
     [12](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:12)     _ = load_dotenv(find_dotenv())
     [14](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:14)     return os.getenv("OPENAI_API_KEY")
---> [16](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:16) from trulens_eval import (
     [17](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:17)     Feedback,
     [18](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:18)     TruLlama,
     [19](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:19)     OpenAI
     [20](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:20) )
     [22](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:22) from trulens_eval.feedback import Groundedness
     [24](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/repos/learn/llama/rag/utils.py:24) def get_prebuilt_trulens_recorder(query_engine, app_id):

File [~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:101](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:101)
     [97](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:97) from trulens_eval.utils.imports import check_imports
     [99](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:99) check_imports()
--> [101](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:101) from trulens_eval.feedback import Feedback
    [102](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:102) from trulens_eval.feedback import Langchain
    [103](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/__init__.py:103) from trulens_eval.feedback.provider import Provider

File [~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:2](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:2)
      [1](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:1) # Specific feedback functions:
...
    [343](https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/gubert/repos/learn/llama/rag/~/.pyenv/versions/3.10.13/envs/rag/lib/python3.10/site-packages/pydantic/v1/main.py:343)     object_setattr(__pydantic_self__, '__dict__', values)

ValidationError: 1 validation error for DataSource
component_type
  subclass of BaseComponent expected (type=type_error.subclass; expected_class=BaseComponent)

Environment:

  • OS: [WSL 2 on Windows 11]
  • Python Version = 3.10.13
  • TruLens version 0.13.4
  • Versions of other relevant installed libraries

Additional context Add any other context about the problem here.

guybartal avatar Mar 03 '24 21:03 guybartal

The ValidationError you're encountering seems to be related to the DataSource component in the trulens_eval package. The error message suggests that a subclass of BaseComponent is expected for the component_type of DataSource. This could mean that there's a mismatch between the expected type and the actual type being used in your environment.

Given that you've installed the correct versions of the required packages, this issue might be due to a compatibility issue with Python 3.10.13, WSL 2, or Windows 11. However, without more specific details about the error message or the contents of the requirements.txt and requirements.optional.txt files, it's difficult to provide a more precise diagnosis.

Here are some steps you can take to troubleshoot this issue:

  1. Check the dependencies: Ensure all dependencies listed in trulens_eval/requirements.txt and trulens_eval/requirements.optional.txt are correctly installed in your environment. You can do this by running pip freeze in your environment and comparing the output with the contents of these files.

  2. Check for compatibility issues: Look for any known compatibility issues with the dependencies on Python 3.10.13, WSL 2, or Windows 11. This can be done by searching for similar issues in the respective repositories of the dependencies.

  3. Look for additional error messages: Check if there are any additional error messages or stack traces that accompany the ValidationError. This could provide clues about which part of the import or setup process is failing.

If these steps don't resolve the issue, could you please provide the full stack trace of the error and the contents of requirements.txt and requirements.optional.txt files? This would help in diagnosing the issue more accurately.

For more information, you can refer to the trulens_eval/setup.py file in the TruLens repository.

Sources

About Dosu

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.

dosubot[bot] avatar Mar 03 '24 21:03 dosubot[bot]

Hey,

Could you please clarify what version of trulens-eval are you on? The above message seems to say 0.24.1 at one place and 0.13.4 at another.

avinashmaheshjoshi avatar Mar 04 '24 17:03 avinashmaheshjoshi

@guybartal This may be due to a conflict with some existing package in your environment. Can you try installing in a fresh python environment?

joshreini1 avatar Mar 08 '24 16:03 joshreini1

@guybartal Please let us know if you were able to do fresh install of python environment.

yuvneshtruera avatar Mar 11 '24 16:03 yuvneshtruera

Sure, I'll validate that and update you, thanks.🙏

guybartal avatar Mar 11 '24 16:03 guybartal

Validated, it works on a bare new python 3.10.13

guybartal avatar Mar 21 '24 00:03 guybartal