conversational_retrieval_chain_input_keysTier 1 · 70% confidence

ai-agents-conversational-retri-missing-some-input-keys-question-when-using-conver-3570be5d

agent: ai_agents

When does this happen?

IF Missing some input keys: {'question'} when using ConversationalRetrievalChain with ConversationBufferMemory and a custom prompt.

How others solved it

THEN Use 'question' as the key when calling the chain (not 'query'). In the memory configuration, set input_key='question' and output_key='answer'. Ensure the custom prompt includes {context}, {chat_history}, and {question} variables.

memory = ConversationBufferMemory(memory_key='chat_history', input_key='question', output_key='answer', return_messages=True)
prompt = PromptTemplate(input_variables=['context','chat_history','question'], template=...)
qa = ConversationalRetrievalChain.from_llm(llm=llm, retriever=retriever, combine_docs_chain_kwargs={'prompt': prompt}, memory=memory)
result = qa({'question': user_input})

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics