ValidationError: 1 validation error for RetrievalQA retriever

#Initializing the Pinecone

from langchain_pinecone import PineconeVectorStore
from pinecone import Pinecone
from langchain.chains import RetrievalQA 

pc = Pinecone(api_key="HIDDEN")
index = pc.Index("medical-chatbot")

# index_name="medical-chatbot"

#Creating Embeddings for Each of The Text Chunks & storing
docsearch=PineconeVectorStore.from_texts([t.page_content for t in text_chunks], embeddings, index_name='medical-chatbot')

#If we already have an index we can load it like this
index_name="medical-chatbot"
docsearch=PineconeVectorStore.from_existing_index(index_name, embeddings)

query = "What are Salivary Gland Disease"

docs=docsearch.similarity_search(query, k=3)

print("Result", docs)

prompt_template="""
Use the following pieces of information to answer the user's question.
If you don't know the answer, just say that you don't know, don't try to make up an answer.

Context: {context}
Question: {question}

Only return the helpful answer below and nothing else.
Helpful answer:
"""

PROMPT=PromptTemplate(template=prompt_template, input_variables=["context", "question"])
chain_type_kwargs={"prompt": PROMPT}

llm=CTransformers(model="../model/llama-2-7b-chat.ggmlv3.q4_0.bin",
                  model_type="llama",
                  config={'max_new_tokens':512,
                          'temperature':0.8})


# retriever = docsearch.as_retriever()


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

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

Hi @fakhrud33, this validation error does not appear to come from a Pinecone method but rather from the RetrievalQA class offered by LangChain.

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)

Have you contacted the LangChain team about this behavior or created a GitHub issue in their repository?