Can't instantiate abstract class BaseRetriever with abstract methods when try to retreive from pinecone

    llm=llm, 
    chain_type="stuff", 
    retriever=docsearch.as_retriever(search_kwargs={'k': 2}),
    return_source_documents=True, 
    chain_type_kwargs=chain_type_kwargs)

above code gives below error.

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)

i have this problem too

Hello @mkt.mohit and @aenodehi,

Welcome to the Pinecone forums. To help us debug this further, can you answer the following questions please:

  • What versions of the libraries are you using?
  • Can you provide a full code snippet that is triggering the error?

requirements.txt:
ctransformers==0.2.5

sentence-transformers==2.2.2

pinecone-client[grpc]

langchain==0.0.225

flask

pypdf

langchain_pinecone

pinecone-client

pydantic

code:
qa = RetrievalQA.from_chain_type(
llm=llm,
chain_type=“stuff”,
retriever=retriever,
return_source_documents=True,
chain_type_kwargs=chain_type_kwargs
)

error:
{
“name”: “ValidationError”,
“message”: “1 validation error for RetrievalQA
retriever
Can’t instantiate abstract class BaseRetriever with abstract methods _aget_relevant_documents, _get_relevant_documents (type=type_error)”,
“stack”: "---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
Cell In[42], line 1
----> 1 qa = RetrievalQA.from_chain_type(
2 llm=llm,
3 chain_type="stuff", # Chain type used for loading the QA
4 retriever=retriever,
5 chain_type_kwargs=chain_type_kwargs # Custom prompt
6 )

File c:\Users\Mahum Shahab\.conda\envs\dchatbott\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:\Users\Mahum Shahab\.conda\envs\dchatbott\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:\Users\Mahum Shahab\.conda\envs\dchatbott\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)"
}

I have this problem. Can you please help me that how to fix this?