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

IndexError: list index out of range #16

Open
ahujaravinder022 opened this issue Jul 27, 2024 · 4 comments
Open

IndexError: list index out of range #16

ahujaravinder022 opened this issue Jul 27, 2024 · 4 comments

Comments

@ahujaravinder022
Copy link

File "C:\Users\Ravinder.Ahuja\Desktop\Generative AI Course wirh contents\Projects\langchain-main (1)\langchain-main\2_news_research_tool_project\mm2\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "C:\Users\Ravinder.Ahuja\Desktop\Generative AI Course wirh contents\Projects\langchain-main (1)\langchain-main\2_news_research_tool_project\main.py", line 43, in
vectorstore_openai = FAISS.from_documents(docs, embeddings)
File "C:\Users\Ravinder.Ahuja\Desktop\Generative AI Course wirh contents\Projects\langchain-main (1)\langchain-main\2_news_research_tool_project\mm2\lib\site-packages\langchain\vectorstores\base.py", line 417, in from_documents
return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File "C:\Users\Ravinder.Ahuja\Desktop\Generative AI Course wirh contents\Projects\langchain-main (1)\langchain-main\2_news_research_tool_project\mm2\lib\site-packages\langchain\vectorstores\faiss.py", line 603, in from_texts
return cls.__from(
File "C:\Users\Ravinder.Ahuja\Desktop\Generative AI Course wirh contents\Projects\langchain-main (1)\langchain-main\2_news_research_tool_project\mm2\lib\site-packages\langchain\vectorstores\faiss.py", line 562, in __from
index = faiss.IndexFlatL2(len(embeddings[0]))

can someone help in resolving this issue.

@AKILSADIK
Copy link

AKILSADIK commented Sep 8, 2024

Facing the same issue. can anyone tell me how to resolve this issue.

Now i had figured it my API key is expired

@ritik7545
Copy link

solve hua kya please koi mujhe ye project bana ke de skta h kya i paying them 1.5 k

@yashraj-dudhe
Copy link

solve hua kya ritik

@lostbeauty69
Copy link

Hi @ahujaravinder022
The issue you're facing is most likely related to faiss or the embeddings you are passing. Ensure that the library is installed correctly using either:
pip install faiss-cpu
pip install faiss-gpu

There might also be an issue with the embeddings array. You can check this by printing the shape of the embeddings with:
print("Embedding shape:", len(embeddings), len(embeddings[0]) if embeddings else "Empty embeddings")
It will help you identify if the embeddings array is empty or has inconsistent dimensions."

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

5 participants