Bird
0
0

What is missing in this RAG chain initialization that causes an error?

medium📝 Debug Q6 of 15
LangChain - RAG Chain Construction
What is missing in this RAG chain initialization that causes an error?
rag_chain = RetrievalQA.from_chain_type(llm=llm)
AThe retriever parameter is not provided
BThe llm parameter should be a string, not an object
CThe from_chain_type method requires a prompt parameter
DThe retriever must be set to None explicitly
Step-by-Step Solution
Solution:
  1. Step 1: Check required parameters

    The RetrievalQA.from_chain_type method requires both an llm and a retriever to function.
  2. Step 2: Identify missing argument

    In the code, the retriever parameter is missing, which is essential for retrieval.
  3. Final Answer:

    The retriever parameter is not provided -> Option A
  4. Quick Check:

    Retriever is mandatory for RAG chain setup [OK]
Quick Trick: Retriever must be included when initializing RAG chain [OK]
Common Mistakes:
  • Assuming llm alone is sufficient
  • Thinking prompt is mandatory in from_chain_type
  • Setting retriever to None instead of providing a retriever

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes