Bird
0
0

Which of the following is the correct way to create a ConversationChain in LangChain that uses question reformulation with history?

easy📝 Syntax Q12 of 15
LangChain - Conversational RAG
Which of the following is the correct way to create a ConversationChain in LangChain that uses question reformulation with history?
Achain = ConversationChain(llm=llm, memory=ConversationBufferMemory())
Bchain = ConversationChain(memory=llm, llm=ConversationBufferMemory())
Cchain = ConversationChain(llm=llm, history=ConversationBufferMemory())
Dchain = ConversationChain(buffer=llm, memory=ConversationBufferMemory())
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct parameter names

    ConversationChain expects an LLM instance as 'llm' and a memory object as 'memory'.
  2. Step 2: Match the correct syntax

    chain = ConversationChain(llm=llm, memory=ConversationBufferMemory()) correctly assigns 'llm=llm' and 'memory=ConversationBufferMemory()'. Others mix parameter names or use incorrect ones.
  3. Final Answer:

    chain = ConversationChain(llm=llm, memory=ConversationBufferMemory()) -> Option A
  4. Quick Check:

    Correct parameters = llm and memory [OK]
Quick Trick: Remember 'llm' and 'memory' are required parameters [OK]
Common Mistakes:
  • Swapping 'llm' and 'memory' parameters
  • Using 'history' instead of 'memory'
  • Passing wrong argument names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes