I was cloning this repository to see how LangChain can browse the internet and provide context-based answers based on search results. While running the application, I encountered an AssertionError. I hope the community can help me fix this issue.
Error Message;
Traceback (most recent call last): File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 541, in _run_script exec(code, module.dict) File “/Users/mostafa/Downloads/web-LLM-app/web-explorer/web_explorer.py”, line 103, in result = qa_chain({“question”: question},callbacks=[retrieval_streamer_cb, stream_handler]) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/chains/base.py”, line 243, in call raise e File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/chains/base.py”, line 237, in call self._call(inputs, run_manager=run_manager) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/chains/qa_with_sources/base.py”, line 141, in _call docs = self._get_docs(inputs, run_manager=_run_manager) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/chains/qa_with_sources/retrieval.py”, line 51, in _get_docs docs = self.retriever.get_relevant_documents( File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/schema/retriever.py”, line 181, in get_relevant_documents raise e File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/schema/retriever.py”, line 174, in get_relevant_documents result = self._get_relevant_documents( File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/retrievers/web_research.py”, line 205, in _get_relevant_documents self.vectorstore.add_documents(docs) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/vectorstores/base.py”, line 104, in add_documents return self.add_texts(texts, metadatas, **kwargs) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/vectorstores/faiss.py”, line 153, in add_texts return self.__add(texts, embeddings, metadatas=metadatas, ids=ids, **kwargs) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/langchain/vectorstores/faiss.py”, line 120, in __add self.index.add(vector) File “/Users/mostafa/Downloads/web-LLM-app/venv-web/lib/python3.10/site-packages/faiss/class_wrappers.py”, line 228, in replacement_add assert d == self.d AssertionError
The problem was that the embeddings model you were using was from OpenAI, but I am now using a hugging face embedding model (Sentence Transformers).
By default, the pretrained models output embeddings with size 768 (base-models) or with size 1024 (large-models).
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
Hello there 👋🏻
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.