Bird
0
0

Why does this code raise an error?

medium📝 Debug Q7 of 15
LangChain - Conversational RAG
Why does this code raise an error?
memory = ConversationBufferMemory()
chain = ConversationChain(memory=memory)
chain.run("What is Python?")
Allm parameter is missing when creating ConversationChain
BMemory should not be passed to ConversationChain
Crun method requires two arguments
DConversationBufferMemory cannot be used with ConversationChain
Step-by-Step Solution
Solution:
  1. Step 1: Check required parameters for ConversationChain

    llm (language model) is required to process questions.
  2. Step 2: Identify missing llm parameter

    Code omits llm, so chain cannot run properly, causing error.
  3. Final Answer:

    llm parameter is missing when creating ConversationChain -> Option A
  4. Quick Check:

    llm is mandatory for ConversationChain [OK]
Quick Trick: Always provide llm when creating ConversationChain [OK]
Common Mistakes:
  • Omitting llm parameter
  • Passing wrong memory type
  • Misusing run method arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes