Bird
0
0

Examine the following code snippet for memory-augmented retrieval in langchain. What is the primary issue causing an error?

medium📝 Debug Q6 of 15
LangChain - Conversational RAG
Examine the following code snippet for memory-augmented retrieval in langchain. What is the primary issue causing an error?
memory_store = SimpleMemory()
retriever = MemoryRetriever(memory_store, base_retriever=SomeRetriever())
ASimpleMemory() is not a valid memory store class in langchain.
BMemoryRetriever requires the memory parameter to be passed as a keyword argument.
CSomeRetriever() cannot be used as a base retriever with MemoryRetriever.
DMemoryRetriever does not accept any parameters during initialization.
Step-by-Step Solution
Solution:
  1. Step 1: Review MemoryRetriever initialization

    MemoryRetriever expects keyword arguments for memory and retriever.
  2. Step 2: Identify error in code

    Passing memory_store as a positional argument causes an error.
  3. Final Answer:

    MemoryRetriever requires the memory parameter to be passed as a keyword argument. -> Option B
  4. Quick Check:

    Always use keyword args for MemoryRetriever init. [OK]
Quick Trick: Pass memory as keyword argument: memory=... [OK]
Common Mistakes:
  • Passing memory as positional argument
  • Assuming SimpleMemory is invalid
  • Misunderstanding retriever compatibility

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes