我收到此错误
ValidationError: 1 validation error for StuffDocumentsChain __root__ document_variable_name context was not found in llm_chain input_variables: ['chat_history', 'user_query', 'relevant_context'] (type=value_error)
在使用load_qa_chain
时,我搜索了此错误,但没有找到与此相关的任何内容。谁能告诉我这里缺少什么。
代码:
template = """You are a chatbot having a conversation with a human.
Given the following extracted parts of a long document and a question, create a final answer.
{relevant_context}
{chat_history}
Human: {user_query}
Chatbot:"""
prompt = PromptTemplate(
input_variables=["chat_history", "user_query", "relevant_context"],
template=template
)
memory = ConversationBufferMemory(memory_key="chat_history", input_key="user_query")
llm = OpenAI()
llm_chain = LLMChain(
llm=llm,
prompt=prompt,
memory=memory,
)
chain = load_qa_chain(
llm, chain_type="stuff", memory=memory, prompt=prompt
)