truera / trulens

Evaluation and Tracking for LLM Experiments
https://www.trulens.org/
MIT License
2.19k stars 189 forks source link

Import Error from Optional Requirements (LiteLLM) #897

Closed makoto-velux closed 9 months ago

makoto-velux commented 9 months ago

Hello, I'm encountering this issue of ImportError.

from trulens_eval import Tru

ImportError                               Traceback (most recent call last)
----> [5](vscode-notebook-cell:?execution_count=12&line=5) from trulens_eval import Tru

File [~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:83](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:83)
      [1](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:1) """
      [2](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:2) # Trulens-eval LLM Evaluation Library
      [3](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:3) 
   (...)
     [78](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:78) 
     [79](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:79) """
     [81](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:81) __version__ = "0.21.0"
---> [83](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:83) from trulens_eval.feedback import Feedback
     [84](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:84) from trulens_eval.feedback import Huggingface
     [85](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/__init__.py:85) from trulens_eval.feedback import Langchain

File [~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:6](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:6)
      [4](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:4) from trulens_eval.utils.imports import OptionalImports
      [5](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:5) from trulens_eval.utils.imports import REQUIREMENT_BEDROCK
----> [6](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:6) from trulens_eval.utils.imports import REQUIREMENT_LITELLM
      [7](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:7) from trulens_eval.utils.imports import REQUIREMENT_OPENAI
      [9](https://file+.vscode-resource.vscode-cdn.net/Users/mm/repos//~/repos//.venv/lib/python3.10/site-packages/trulens_eval/feedback/__init__.py:9) logger = logging.getLogger(__name__)

ImportError: cannot import name 'REQUIREMENT_LITELLM' from 'trulens_eval.utils.imports' (/Users/mm/repos//.venv/lib/python3.10/site-packages/trulens_eval/utils/imports.py)

python version 3.10.13 here is a list of dependencies from poetry that I'm using

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
azure-identity = "1.15.0"
streamlit = "1.30.0"
streamlit-chat = "0.1.1"
openai = "0.28.1"
tenacity = "8.2.3"
python-dotenv = "1.0.0"
langchain = ">=0.0.354"
faiss-cpu = "1.7.4"
pypdf2 = "3.0.1"
tiktoken = "0.5.1"
requests = "2.31.0"
pyarrow = "14.0.1"
azure-storage-blob = "12.19.0"
azure-storage-file-share = "12.15.0"
azure-storage-file-datalake = "12.14.0"
azure-storage-queue = "12.8.0"
pydantic = "2.5.1"
python-docx = "1.1.0"
python-pptx = "0.6.23"
pillow = "9.4.0"
ipykernel = "^6.29.0"
pytest = "^8.0.0"
streamlit-mock = "^0.0.1"
langchain-community = "^0.0.19"
pypdf = "^4.0.1"
trulens-eval = "0.22.2"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Can anybody point me to the cause of the problem and possible solutions? Thanks!

piotrm0 commented 9 months ago

Hi, looks like there might have been an installation problem when installing trulens_eval. I see in your stack trace that the version of trulens you have in your env is 0.21.0 but your poetry config states it should be 0.22.2 . Can you try uninstalling and reinstalling trulens_eval?

yuvneshtruera commented 9 months ago

@makoto-velux Did reinstalling work for you? Please let us know.