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_store = None
retriever = MemoryRetriever(memory=memory_store, base_retriever=SomeRetriever())
ABecause base_retriever cannot be passed as a parameter.
BBecause memory cannot be None; it must be a valid memory store instance.
CBecause MemoryRetriever does not accept keyword arguments.
DBecause SomeRetriever() is not imported.
Step-by-Step Solution
Solution:
  1. Step 1: Check parameter validity

    Memory parameter must be a valid memory store, not None.
  2. Step 2: Understand why None causes error

    Passing None means no memory to augment retrieval, causing failure.
  3. Final Answer:

    Because memory cannot be None; it must be a valid memory store instance. -> Option B
  4. Quick Check:

    Memory must be a valid store, not None [OK]
Quick Trick: Memory parameter cannot be None [OK]
Common Mistakes:
  • Ignoring that None is invalid for memory
  • Blaming base_retriever parameter
  • Assuming missing imports cause this error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes