Skip to content

AttributeError: 'OpenAIEmbeddings' object has no attribute 'embedding_ctx_length' #1100

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

Closed
Sohojoe opened this issue Feb 16, 2023 · 3 comments

Comments

@Sohojoe
Copy link

Sohojoe commented Feb 16, 2023

since updating to v0.88 i get this error

AttributeError: 'OpenAIEmbeddings' object has no attribute 'embedding_ctx_length

Note: my faiss data and doc.index where create with an older version

my code is simple.

    index = faiss.read_index("docs.index")

    with open("faiss_store.pkl", "rb") as f:
        store = pickle. Load(f)
    store. Index = index
    
    docs = store.similarity_search_with_score(
            prompt, k=4
    )

it looks like it is releated to this PR #991 by @Hase-U

@Hase-U
Copy link
Contributor

Hase-U commented Feb 16, 2023

#1101

@Hase-U
Copy link
Contributor

Hase-U commented Feb 17, 2023

@Sohojoe
I excluded codes that guarantee backward compatibility according to langchain's policy.
However, this problem can be avoided by using hasattr like this

hwchase17 pushed a commit that referenced this issue Feb 17, 2023
#1100
When faiss data and doc.index are created in past versions, error occurs
that say there was no attribute. So I put hasattr in the check as a
simple solution.

However, increasing the number of such checks is not good for
conservatism, so I think there is a better solution.


Also, the code for the batch process was left out, so I put it back in.
zachschillaci27 pushed a commit to zachschillaci27/langchain that referenced this issue Mar 8, 2023
langchain-ai#1100
When faiss data and doc.index are created in past versions, error occurs
that say there was no attribute. So I put hasattr in the check as a
simple solution.

However, increasing the number of such checks is not good for
conservatism, so I think there is a better solution.


Also, the code for the batch process was left out, so I put it back in.
mikeknoop pushed a commit to zapier/langchain-nla-util that referenced this issue Mar 9, 2023
langchain-ai/langchain#1100
When faiss data and doc.index are created in past versions, error occurs
that say there was no attribute. So I put hasattr in the check as a
simple solution.

However, increasing the number of such checks is not good for
conservatism, so I think there is a better solution.


Also, the code for the batch process was left out, so I put it back in.
ZinedineDumas added a commit to ZinedineDumas/React-Python that referenced this issue Jul 17, 2023
langchain-ai/langchain#1100
When faiss data and doc.index are created in past versions, error occurs
that say there was no attribute. So I put hasattr in the check as a
simple solution.

However, increasing the number of such checks is not good for
conservatism, so I think there is a better solution.


Also, the code for the batch process was left out, so I put it back in.
@dosubot
Copy link

dosubot bot commented Sep 9, 2023

Hi, @Sohojoe. I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you encountered an AttributeError after updating to version 0.88 of LangChain. Hase-U made a pull request that seems to address this issue by suggesting the use of hasattr. They provided a link to their pull request for reference.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your understanding and contribution to the LangChain project.

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 9, 2023
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants