IvanIsCoding / ResuLLMe

Enhance your résumé with Large Language Models
https://resullme.streamlit.app/
MIT License
323 stars 90 forks source link

Getting an AttributeError: module 'openai' has no attribute 'error' when running from docker #16

Closed DevOpsAzurance closed 1 year ago

DevOpsAzurance commented 1 year ago

Full stack is:

File "/usr/local/lib/python3.10/dist-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script exec(code, module.dict) File "/app/src/Main.py", line 104, in except openai.error.RateLimitError as e:

I assume it is related to the version of openai in the requirements file:

openai
langchain
pdfminer-six
python-docx
streamlit==1.21.0
Jinja2
docx2txt
streamlit-ext==0.1.7
stqdm==0.0.5

Since it is not hard coding the version, it may be using a newer version that is being affected by the ratelimiter.

IvanIsCoding commented 1 year ago

Can you try with the latest commit? I think we just had to change the import path

DevOpsAzurance commented 1 year ago

getting the following now:

An error occurred while generating the resume. Please try again.

AttributeError: module 'openai' has no attribute 'ChatCompletion' Traceback: File "/app/src/Main.py", line 71, in json_resume = generate_json_resume(text, openai_api_key) File "/app/src/prompt_engineering/init.py", line 186, in generate_json_resume response = openai.ChatCompletion.create(

The stack seems to end at create as pasted above. Additionally in Docker:

2023-11-12 15:03:30 resullme-main-resullme-1 | 2023-11-12 15:03:30 resullme-main-resullme-1 | Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False. 2023-11-12 15:03:30 resullme-main-resullme-1 | 2023-11-12 15:03:30 resullme-main-resullme-1 | 2023-11-12 15:03:30 resullme-main-resullme-1 | You can now view your Streamlit app in your browser. 2023-11-12 15:03:30 resullme-main-resullme-1 | 2023-11-12 15:03:30 resullme-main-resullme-1 | Network URL: http://8501 2023-11-12 15:03:30 resullme-main-resullme-1 | External URL: http://:8501 2023-11-12 15:03:30 resullme-main-resullme-1 | 2023-11-12 15:04:32 resullme-main-resullme-1 | module 'openai' has no attribute 'ChatCompletion' 2023-11-12 15:04:32 resullme-main-resullme-1 | Failed to tailor resume. 2023-11-12 15:04:32 resullme-main-resullme-1 |

IvanIsCoding commented 1 year ago

I completely missed https://github.com/openai/openai-python/discussions/742, looks like they released a new API version. I haven't touched this in a while but I will try to fix it

IvanIsCoding commented 1 year ago

I can confirm the app is fixed. Thanks for reporting it, I wouldn't have caught the API change alone!