Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A ton of Bugs after OpenAI API update today #12956

Closed
14 tasks
Vanekkk1 opened this issue Nov 6, 2023 · 9 comments
Closed
14 tasks

A ton of Bugs after OpenAI API update today #12956

Vanekkk1 opened this issue Nov 6, 2023 · 9 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: embeddings Related to text embedding models module Ɑ: models Related to LLMs or chat model modules

Comments

@Vanekkk1
Copy link

Vanekkk1 commented Nov 6, 2023

System Info

all last versions as of 6/11/2023

Who can help?

No response

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

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 no ChatCompletion attribute, this is likely due to an old version of the openai package. Try upgrading it with pip install --upgrade openai. (type=value_error)

Copy link

dosubot bot commented Nov 6, 2023

🤖

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.

@dosubot dosubot bot added Ɑ: embeddings Related to text embedding models module Ɑ: models Related to LLMs or chat model modules 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Nov 6, 2023
Copy link

dosubot bot commented Nov 6, 2023

🤖

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.

Sources


This 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.

@msunkarahend
Copy link

@dosu-bot
even if i upgrade the openai to openai==1.1.0 version (latest). the issue is not resolved.

@vanduyta
Copy link

vanduyta commented Nov 7, 2023

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...

@dosuken123
Copy link
Contributor

I checked in #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.

@msunkarahend
Copy link

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

ericmjl added a commit to ericmjl/llamabot that referenced this issue Nov 7, 2023
- Limited the version of openai dependency to <=0.28.1 in pyproject.toml

This is a temporary change. See LangChain: langchain-ai/langchain#12956 for more context.
tl;dr: OpenAI's update breaks a lot of LangChain.
@Bijas48
Copy link

Bijas48 commented Nov 8, 2023

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

@m-cavazza
Copy link

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:
openai/openai-python#631
However, with Langchain we have no such access, and are getting this kind of error:
Langchain

@PilotGFX
Copy link

PilotGFX commented Dec 11, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: embeddings Related to text embedding models module Ɑ: models Related to LLMs or chat model modules
Projects
None yet
Development

No branches or pull requests

7 participants