I was trying to follow this guid on RAG chatbot from pinecone – https://docs.pinecone.io/guides/get-started/build-a-rag-chatbot
Instead of using OpenAI I was using alternatives like SentenceTransformerEmbeddings for embeddings and LaMini Model instead of mentioned gpt3.5 turbo in the guide
When building the RetrievalQA chain I faced this error
ValidationError: 2 validation errors for LLMChain llm instance of Runnable expected (type=type_error.arbitrary_type; expected_arbitrary_type=Runnable) llm instance of Runnable expected (type=type_error.arbitrary_type; expected_arbitrary_type=Runnable)
This is my current code:
The error occurs on line -:
qa = RetrievalQA.from_chain_type
from langchain.chains import RetrievalQA
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
from transformers import pipeline
import torch
checkpoint = "LaMini-Flan-T5-783M"
print(f"Checkpoint path: {checkpoint}") # Add this line for debugging
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
base_model = AutoModelForSeq2SeqLM.from_pretrained(
checkpoint,
torch_dtype=torch.float32
)
qa = RetrievalQA.from_chain_type(
llm=base_model,
chain_type="stuff",
retriever=docsearch.as_retriever()
)
For reference
docsearch = PineconeVectorStore.from_documents(
documents=pdf_text,
index_name=index_name,
embedding=embeddings,
namespace=namespace,
)
I have tried updating langchain but same issue