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

OpenAIEmbeddings bug #14377

Closed
1 of 14 tasks
youfak opened this issue Dec 7, 2023 · 3 comments
Closed
1 of 14 tasks

OpenAIEmbeddings bug #14377

youfak opened this issue Dec 7, 2023 · 3 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: embeddings Related to text embedding models module

Comments

@youfak
Copy link

youfak commented Dec 7, 2023

System Info

langchain==0.0.344
langchain-experimental>=0.0.42
python==3.10.12

embeddings = OpenAIEmbeddings(model_name=model,
                                                 openai_api_key=get_model_path(model),
                                                 chunk_size=CHUNK_SIZE)

error

WARNING! model_name is not default parameter.
                    model_name was transferred to model_kwargs.
                    Please confirm that model_name is what you intended.
  warnings.warn(
2023-12-07 12:36:12,645 - embeddings_api.py[line:39] - ERROR: Embeddings.create() got an unexpected keyword argument 'model_name'
AttributeError: 'NoneType' object has no attribute 'conjugate'

Who can help?

@hwchase17

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

                    from langchain.embeddings.openai import OpenAIEmbeddings
                    embeddings = OpenAIEmbeddings(model_name="text-embedding-ada-002",
                                                  openai_api_key='xxxx',
                                                  chunk_size=512)
                    data = embeddings.embed_documents(texts)

Expected behavior

Normal loading

Copy link

dosubot bot commented Dec 7, 2023

🤖

Hello @youfak,

I'm Dosu, a bot that helps manage this repository. I can assist you with resolving bugs, answering questions, and even guide you on how to contribute to the project. While we wait for a human maintainer to join us, I'll do my best to assist you. Let's get started!

Based on the error message you provided, it seems like the issue is related to the model_name parameter in the OpenAIEmbeddings class. The warning message suggests that model_name is not a default parameter and has been transferred to model_kwargs. This could be the reason why you're seeing the Embeddings.create() got an unexpected keyword argument 'model_name' error.

Looking at the similar issues in the LangChain repository, it appears that this problem has been encountered before. The suggested solution in these issues is to downgrade the OpenAI package to version 0.28.1 and LangChain to version 0.0.330. This can be done by running the following commands in the terminal:

pip install openai==0.28.1
pip install langchain==0.0.330

This solution has received positive reactions and has been confirmed to work by multiple users. You can find more details in the following issues:

However, please note that this is a temporary fix. The LangChain team is likely working on a more permanent solution that will be compatible with the latest OpenAI version. You might want to keep an eye on the repository for updates.

As for the AttributeError: 'NoneType' object has no attribute 'conjugate' error, it's a bit unclear what might be causing this without more context. It could be related to the model_name issue, or it could be a separate issue. If the problem persists after downgrading the OpenAI and LangChain versions, could you please provide more details about when and where this error occurs?

I hope this helps! If you have any other questions or need further clarification, feel free to ask.

Source

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.

@dosubot dosubot bot added Ɑ: embeddings Related to text embedding models module 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Dec 7, 2023
@mspronesti
Copy link
Contributor

mspronesti commented Dec 8, 2023

This is not a bug. The parameter is called model, not model_name.

@youfak
Copy link
Author

youfak commented Dec 11, 2023

OpenAIEmbeddings
Thank you very much. The problem seems to have been resolved

@youfak youfak closed this as completed Dec 11, 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
Projects
None yet
Development

No branches or pull requests

2 participants