Valdecy / pyDecision

pyDecision is a comprehensive Python library that encompasses a wide array of Multi-Criteria Decision Analysis (MCDA) methods. These powerful and versatile tools assist in making effective decisions by comparing alternatives based on multiple criteria, making it a valuable resource for researchers, analysts, and decision-makers.
Other
256 stars 61 forks source link

Problem with openai dependency #18

Closed ao-codes closed 11 months ago

ao-codes commented 11 months ago

Hi Valdecy,

There seems to be an issue with the openai-dependency in pyDecision:

I installed the latest version in a clean virtual Environment. When I execute your AHP-example i get the follwing error:

Traceback (most recent call last):
  File "/home/alex/Schreibtisch/test_pyDecision/pyD_error.py", line 2, in <module>
    from pyDecision.algorithm import ahp_method
  File "/home/alex/Schreibtisch/test_pyDecision/venv/lib/python3.11/site-packages/pyDecision/algorithm/__init__.py", line 52, in <module>
    from .p_v           import promethee_v
  File "/home/alex/Schreibtisch/test_pyDecision/venv/lib/python3.11/site-packages/pyDecision/algorithm/p_v.py", line 7, in <module>
    from pyDecision.util.ga import genetic_algorithm
  File "/home/alex/Schreibtisch/test_pyDecision/venv/lib/python3.11/site-packages/pyDecision/util/__init__.py", line 2, in <module>
    from .LLM import ask_chatgpt_corr, ask_chatgpt_rank, ask_chatgpt_weights 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/Schreibtisch/test_pyDecision/venv/lib/python3.11/site-packages/pyDecision/util/LLM.py", line 7, in <module>
    from openai import OpenAI
ImportError: cannot import name 'OpenAI' from 'openai' (/home/alex/Schreibtisch/test_pyDecision/venv/lib/python3.11/site-packages/openai/__init__.py)

Solution: I updated openai from 0.28.1 to the latest version 1.3.7 by executing:

pip install openai --upgrade

After that it worked fine. So you could raise the version of openai in your setup.py.

Best regards! Alex

Valdecy commented 11 months ago

Hello Alex! Thanks for noticing this problem; now, in version 4.3.9, all Openai versions should work just fine.

Thanks Again, and Regards!