Bird
0
0

Which of the following is the correct way to initialize a memory-augmented retriever in langchain?

easy📝 Syntax Q12 of 15
LangChain - Conversational RAG
Which of the following is the correct way to initialize a memory-augmented retriever in langchain?
Aretriever = MemoryRetriever(base_retriever, memory_store)
Bretriever = MemoryRetriever(memory=memory_store, retriever=base_retriever)
Cretriever = MemoryRetriever(memory_store, base_retriever)
Dretriever = MemoryRetriever()
Step-by-Step Solution
Solution:
  1. Step 1: Check langchain retriever initialization pattern

    The MemoryRetriever requires named parameters for memory and retriever to work properly.
  2. Step 2: Identify correct syntax

    retriever = MemoryRetriever(memory=memory_store, retriever=base_retriever) uses named parameters memory= and retriever= which matches the expected pattern.
  3. Final Answer:

    retriever = MemoryRetriever(memory=memory_store, retriever=base_retriever) -> Option B
  4. Quick Check:

    Use named args memory= and retriever= [OK]
Quick Trick: Look for named parameters memory= and retriever= in constructor [OK]
Common Mistakes:
  • Passing positional arguments instead of named
  • Omitting required parameters
  • Using empty constructor without arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes