Closed Vanekkk1 closed 11 months ago
🤖
Hello @Vanekkk1,
Great to see you back here! I hope you're doing well. I'm already on your issue and will provide a thorough response shortly.
🤖
Based on the information provided, it seems like the OpenAI package might be outdated. The error message suggests that the 'ChatCompletion' attribute is not found in the 'openai' package. This could be due to an older version of the package being used. You can resolve this by upgrading the OpenAI package. You can do this by running the following command in your terminal:
pip install --upgrade openai
This solution was suggested in a similar issue openai
has no ChatCompletion
attribute in the LangChain repository.
As for the 'ValidationError' in 'main.py', there is no context provided for this error in the given context. Therefore, I cannot provide a solution for this error.
Please provide the relevant context or code snippet where the 'ValidationError' is occurring for further assistance.
As for the changes in the latest OpenAI API update that could have caused these bugs, I wasn't able to find specific information within the LangChain repository. It's possible that the update introduced changes that are incompatible with the current version of LangChain. It would be helpful to review the OpenAI API update notes to understand what changes were made.
openai
has no ChatCompletion
attributeThis 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.
@dosu-bot even if i upgrade the openai to openai==1.1.0 version (latest). the issue is not resolved.
Hi, the same happened to me since I did not have fixed versions in requirements file. What worked was to install openai 0.28.1 langchain 0.0.330 Good luck and good night after this wonderful evening with errors...
I checked in https://github.com/langchain-ai/langchain/issues/12967 that using openai==v0.28.1
https://github.com/openai/openai-python/releases/tag/v0.28.1 mitigates this issue for now.
openai-python might have changed their API at the recent v1 bump.
Hi, the same happened to me since I did not have fixed versions in requirements file. What worked was to install openai 0.28.1 langchain 0.0.330 Good luck and good night after this wonderful evening with errors...
Thanks @vanduyta and @dosuken123. it worked for me too
Hi, the same happened to me since I did not have fixed versions in requirements file. What worked was to install openai 0.28.1 langchain 0.0.330 Good luck and good night after this wonderful evening with errors...
Its work, thanks man
This could be due to the new 'client' model of the OpenAI API in v1.1.0+ On the regular API where you would previously write: openai.ChatCompletion.create the syntax is now: openai.chat.completions.create check also: https://github.com/openai/openai-python/discussions/631 However, with Langchain we have no such access, and are getting this kind of error:
My issue was: ValueError: Expected EmbeddingFunction.call to have the following signature: odict_keys(['self', 'input']), got odict_keys(['self', 'args', 'kwargs']) force installing langchain 0.0.335 and openai 1.3.0 works here. i have not tried all releases. for info i can disclose openai 0.28 is from september the 26th 2023 and openai 1.3.0 is from november 15th 2023.
System Info
all last versions as of 6/11/2023
Who can help?
No response
Information
Related Components
Reproduction
Run anything with OpeanAI ChatCompletions and Embeddings
Expected behavior
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langchain/embeddings/openai.py", line 284, in validate_environment values["client"] = openai.Embedding ^^^^^^^^^^^^^^^^ AttributeError: module 'openai' has no attribute 'Embedding'. Did you mean: 'embeddings'?
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langchain/load/serializable.py", line 97, in init super().init(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pydantic/v1/main.py", line 341, in init raise validation_error pydantic.v1.error_wrappers.ValidationError: 1 validation error for ChatOpenAI root
openai
has noChatCompletion
attribute, this is likely due to an old version of the openai package. Try upgrading it withpip install --upgrade openai
. (type=value_error)