langchain icon indicating copy to clipboard operation
langchain copied to clipboard

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

Open Sohojoe opened this issue 2 years ago • 2 comments

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 https://github.com/hwchase17/langchain/pull/991 by @Hase-U

Sohojoe avatar Feb 16 '23 21:02 Sohojoe

https://github.com/hwchase17/langchain/pull/1101

Hase-U avatar Feb 16 '23 23:02 Hase-U

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

Hase-U avatar Feb 17 '23 00:02 Hase-U

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[bot] avatar Sep 09 '23 16:09 dosubot[bot]