ValidationError: 1 validation error for RetrievalQA retriever #21179
Replies: 1 comment 1 reply
-
The error you're encountering with To address this, ensure that the object returned by Additionally, double-check that all parameters passed to If you're following examples or documentation, ensure they are up to date with the version of Lastly, ensure your environment is correctly set up with all necessary dependencies and that there are no conflicts between package versions that might cause unexpected behavior.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am using pinecone vector database for storing the veactors of the text chunks, then I am imlementing similarity search to get similar document after that I am loading my llm model and using the retrieveralQA chain I am trying to use "from langchain.chains import RetrievalQA " for my chatbot but I am always getting a validation error in RetrieveralQA.from_chain_type.
this is the error Message
ValidationError Traceback (most recent call last)
Cell In[49], line 5
1 from langchain.chains import RetrievalQA
2 # retriever = docsearch.as_retriever()
----> 5 qa=RetrievalQA.from_chain_type(
6 llm=llm,
7 chain_type=“stuff”,
8 retriever=docsearch.as_retriever(search_kwargs={‘k’: 2}),
9 return_source_documents=True,
10 chain_type_kwargs=chain_type_kwargs)
File c:\End-to-end-Medical-Chatbot-using-Llama2-main\myenv\lib\site-packages\langchain\chains\retrieval_qa\base.py:95, in BaseRetrievalQA.from_chain_type(cls, llm, chain_type, chain_type_kwargs, **kwargs)
91 _chain_type_kwargs = chain_type_kwargs or {}
92 combine_documents_chain = load_qa_chain(
93 llm, chain_type=chain_type, **_chain_type_kwargs
94 )
—> 95 return cls(combine_documents_chain=combine_documents_chain, **kwargs)
File c:\End-to-end-Medical-Chatbot-using-Llama2-main\myenv\lib\site-packages\langchain\load\serializable.py:74, in Serializable.init(self, **kwargs)
73 def init(self, **kwargs: Any) → None:
—> 74 super().init(**kwargs)
75 self._lc_kwargs = kwargs
File c:\End-to-end-Medical-Chatbot-using-Llama2-main\myenv\lib\site-packages\pydantic\main.py:341, in pydantic.main.BaseModel.init()
ValidationError: 1 validation error for RetrievalQA
retriever
Can’t instantiate abstract class BaseRetriever with abstract methods _aget_relevant_documents, _get_relevant_documents (type=type_error)
System Info
langchain==0.1.16
langchain-chroma==0.1.0
langchain-community==0.0.34
langchain-core==0.1.46
langchain-pinecone==0.1.0
langchain-text-splitters==0.0.1
langchainplus-sdk==0.0.20
langsmith==0.1.51
sentence-transformers==2.2.2
sentencepiece==0.2.0
transformers==4.40.1
python 3.9.0
system windows 10
Beta Was this translation helpful? Give feedback.
All reactions