langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Error using TimeWeightedVectorStoreRetriever.get_relevant_documents with FAISS: 'FAISS' object has no attribute 'similarity_search_with_relevance_scores'

Open nomeyer opened this issue 1 year ago • 3 comments

I'm exploring this great notebook and trying to produce something similar, however I get an error when fetch_memories calls self.memory_retriever.get_relevant_documents(observation):

AttributeError: 'FAISS' object has no attribute 'similarity_search_with_relevance_scores'

I'm running langchain 0.0.144 and I've installed faiss using conda install -c conda-forge faiss-cpu (as indicated here) which installed version 1.7.2. Also running python 3.10.

Poking inside faiss.py I indeed can't find a method called similarity_search_with_relevance_scores, only one called _similarity_search_with_relevance_scores.

Which version(s) of langchain and faiss should I be running for this to work?

Any help would be greatly appreciated, thanks 🙏

nomeyer avatar Apr 19 '23 19:04 nomeyer

Same here using Weaviate. And that's not all. The example for "vectorstores" and babyagi for example flat out does not work because the core of langchain isn't keeping track of the new features put in and make sure the old functionality still works. PRs without a single automated test are getting merged to master. The ones that do have tests don't cover the example code in the notebook. I like jupyter but it's getting way overused by everyone at the moment. It's not a substitute for documentation or a real life functioning example. At this moment the dev experience is not great, because with every error I get I don't know if it's my code, or langchain that's causing the issue.

Ryangr0 avatar Apr 20 '23 09:04 Ryangr0

Hey @Ryangr0 for what it's worth I managed to resolve my issue by re-installing all my dependencies in a fresh conda environment 😅

nomeyer avatar Apr 20 '23 17:04 nomeyer

This is actually still not working for me, and I know why. Weaviate doesn't have this implemented either. Is there any way for me to get this under attention?

Ryangr0 avatar Apr 22 '23 18:04 Ryangr0

Hi, @nomeyer! 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.

Based on my understanding of the issue, you were experiencing an AttributeError when calling fetch_memories because the FAISS object did not have the attribute similarity_search_with_relevance_scores. You mentioned that you were running langchain version 0.0.144 and faiss version 1.7.2, and you were looking for guidance on which versions of langchain and faiss are compatible. Another user, @Ryangr0, mentioned that they are also experiencing issues with langchain and mentioned that PRs without automated tests are getting merged. You mentioned that you resolved your issue by reinstalling dependencies in a fresh conda environment. However, @Ryangr0 commented that the issue is still not resolved for them and asked for a way to get attention to the issue.

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 cooperation!

dosubot[bot] avatar Sep 17 '23 17:09 dosubot[bot]

I'm no longer facing this issue, thanks. Not sure about @Ryangr0.

nomeyer avatar Sep 18 '23 09:09 nomeyer

Thank you for your response, @nomeyer! We're glad to hear that you're no longer facing the issue. We'll go ahead and close this issue now. If @Ryangr0 is still experiencing the issue, please let us know so we can assist further.

dosubot[bot] avatar Sep 18 '23 09:09 dosubot[bot]