Closed achilela closed 7 months ago
π€
Hello,
The error AttributeError: 'list' object has no attribute 'embedding'
typically occurs when you're trying to access an attribute or method that doesn't exist for the object you're working with. In this case, it seems like you're trying to call the embedding
method on a list object, which doesn't exist.
From the traceback you provided, the error seems to be occurring in the max_marginal_relevance_search
method of the langchain/vectorstores/docarray/base.py
file. This method expects docs
to be a list of BaseDoc
instances.
The BaseDoc
class should have an embedding
attribute, so if you're getting an AttributeError
, it's possible that the docs
object is not a list of BaseDoc
instances, or the embedding
attribute is not being set correctly.
To debug this issue, you could add some print statements or use a debugger to check the type and attributes of the docs
object before the line where the error occurs. This should help you identify what's causing the error.
If you're still having trouble, please provide the code snippet where you're calling the max_marginal_relevance_search
method, and I'll be happy to help you further.
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a π if this is helpful and π if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Hi, @achilela. I'm Dosu, and I'm helping the LangChain team manage our backlog. I wanted to let you know that we are marking this issue as stale.
Based on my understanding, you reported an issue where the code is throwing an AttributeError: 'list' object has no attribute 'embedding'. There hasn't been any response or suggestion provided yet. However, I have commented on the issue and provided some helpful insights. I mentioned that the error occurs when trying to access an attribute that doesn't exist for the object being worked with. I also gave some debugging tips and requested more information from you.
If this issue is still relevant to the latest version of the LangChain repository, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself. If we don't hear back from you, the issue will be automatically closed in 7 days.
Thank you for your understanding and contribution to the LangChain project. If you have any further questions or need assistance, feel free to reach out.
Issue you'd like to raise.
Hello, I am facing some issues with the code I am trying to run as it did run perfectly up until recently when an Error started being thrown out as AttributeError: 'list' object has no attribute 'embedding'. Below is the traceback if the error. Please do let me know if some code snippet excerpts will also be needed to facilitate debugging the code.
Traceback: File "/home/ataliba/llm/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.dict) File "/home/ataliba/LLM_Workshop/Experimental_Lama_QA_Retrieval/Andro_GPT_Llama2.py", line 268, in
response = qa_chain.run(user_query, callbacks=[cb])
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/chains/base.py", line 481, in run
return self(args[0], callbacks=callbacks, tags=tags, metadata=metadata)[
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/chains/base.py", line 288, in call
raise e
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/chains/base.py", line 282, in call
self._call(inputs, run_manager=run_manager)
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/chains/conversational_retrieval/base.py", line 134, in _call
docs = self._get_docs(new_question, inputs, run_manager=_run_manager)
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/chains/conversational_retrieval/base.py", line 286, in _get_docs
docs = self.retriever.get_relevant_documents(
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/schema/retriever.py", line 208, in get_relevant_documents
raise e
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/schema/retriever.py", line 201, in get_relevant_documents
result = self._get_relevant_documents(
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/vectorstores/base.py", line 571, in _get_relevant_documents
docs = self.vectorstore.max_marginal_relevance_search(
File "/home/ataliba/llm/lib/python3.10/site-packages/langchain/vectorstores/docarray/base.py", line 197, in max_marginal_relevance_search
np.array(query_embedding), docs.embedding, k=k
Suggestion:
No response