microsoft / OpenAIWorkshop

workshop materials to build intelligent solutions on Open AI
MIT License
473 stars 275 forks source link

Facing issue in HR/Payroll Copilot application in Azure #158

Closed shashankms9 closed 8 months ago

shashankms9 commented 9 months ago

Hi @james-tn we are facing an issue in HR/Payroll Copilot application in Azure, after creating the web app we have encountered an issue ModuleNotFoundError: No module named 'openai.embeddings_utils'

we were able to resolve this issue after installing OpenAI 0.28 package, we were able to view the interface but when we try to enter an example question it is throwing an issue

APIRemovedInV1: You tried to access openai.ChatCompletion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API. You can run openai migrate to automatically upgrade your codebase to use the 1.0.0 interface. Alternatively, you can pin your installation to the old version, e.g. pip install openai==0.28 A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742 Traceback: File "/tmp/8dbecead775ee88/antenv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script exec(code, module.dict) File "/tmp/8dbecead775ee88/hr_copilot.py", line 79, in stream_out, query_used, history, agent_response = hr_agent.run(user_input=user_input, conversation=history, stream=True) File "/tmp/8dbecead775ee88/utils.py", line 234, in run response = openai.ChatCompletion.create( File "/tmp/8dbecead775ee88/antenv/lib/python3.10/site-packages/openai/_utils/_proxy.py", line 22, in getattr File "/tmp/8dbecead775ee88/antenv/lib/python3.10/site-packages/openai/_utils/_proxy.py", line 43, in __get_proxied File "/tmp/8dbecead775ee88/antenv/lib/python3.10/site-packages/openai/lib/_old_api.py", line 33, in load__

please find the image for references

image

image

james-tn commented 9 months ago

Looks like you still have the later version of openai library (they recently changed the API). Can you update the requirement file to fix openai to 0.28? Like this streamlit openai==0.28.0 streamlit-extras python-dotenv plotly scipy scikit-learn azure-search-documents==11.4.0b9 faiss-cpu

shashankms9 commented 9 months ago

hi @james-tn thank you for your help, issue has been fixed after updating the requirement file in scenarios/incubations/copilot/employee_support/requirements.txt