3 validation errors for ConversationalRetrievalChain

I’m trying to learn building a RAG application by testing a python script with chromaDB and using local LLM for querying some pdf. Here is my code

import os
from langchain.document_loaders import PyPDFLoader, TextLoader, Docx2txtLoader
from langchain.text_splitter import CharacterTextSplitter
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import Chroma
from langchain.chains import ConversationalRetrievalChain
from langchain.memory import ConversationBufferMemory
from gpt4all import GPT4All

# Set your Hugging Face API key as an environment variable
os.environ["HUGGINGFACE_API_KEY"] = "abc"

# Create a directory for documents if it doesn't exist
docs_dir = './docs'
if not os.path.exists(docs_dir):
    os.makedirs(docs_dir)

# Load documents from the 'docs' directory
document = []
for file in os.listdir(docs_dir):
    if file.endswith(".pdf"):
        pdf_path = os.path.join(docs_dir, file)
        loader = PyPDFLoader(pdf_path)
        document.extend(loader.load())
    elif file.endswith('.docx') or file.endswith('.doc'):
        doc_path = os.path.join(docs_dir, file)
        loader = Docx2txtLoader(doc_path)
        document.extend(loader.load())
    elif file.endswith('.txt'):
        text_path = os.path.join(docs_dir, file)
        loader = TextLoader(text_path)
        document.extend(loader.load())

# Split documents into chunks
document_splitter = CharacterTextSplitter(separator='n', chunk_size=500, chunk_overlap=50)
document_chunks = document_splitter.split_documents(document)

# Initialize embeddings
embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L6-v2')

# Initialize vector database (automatic persistence)
vectordb = Chroma.from_documents(document_chunks, embedding=embeddings, persist_directory='./data')

# Initialize local GPT4All model
model_path = "/Users/rayman/Library/Application Support/nomic.ai/GPT4All/nous-hermes-llama2-13b.Q4_0.gguf"
local_model = GPT4All(model_path)

# Initialize memory for conversation
memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)

# Create conversational QA Chain directly with GPT4All
pdf_qa = ConversationalRetrievalChain(llm=local_model,
                                       retriever=vectordb.as_retriever(search_kwargs={'k': 6}),
                                       verbose=False, memory=memory)

# Welcome message
print('---------------------------------------------------------------------------------')
print('Welcome to the DocBot. You are now ready to start interacting with your documents')
print('---------------------------------------------------------------------------------')

# Interactive loop
while True:
    query = input(f"Prompt:")
    if query.lower() in ["exit", "quit", "q", "f"]:
        print('Exiting')
        break
    if query == '':
        continue
    result = pdf_qa({"question": query})
    print(f"Answer: " + result["answer"])

but there is an error:

pydantic.v1.error_wrappers.ValidationError: 3 validation errors for ConversationalRetrievalChain
combine_docs_chain
  field required (type=value_error.missing)
question_generator
  field required (type=value_error.missing)
llm
  extra fields not permitted (type=value_error.extra)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật