Bird
0
0

You wrote this code:

medium📝 Debug Q14 of 15
LangChain - RAG Chain Construction
You wrote this code:
rag_chain = LCEL.RAGChain.from_documents("doc.txt", llm)
answer = rag_chain.run("Explain the content.")

But it raises an error. What is the likely problem?
AThe llm variable is not defined
BLCEL.RAGChain does not have from_documents method
CThe run method requires two arguments
DThe documents argument should be a list, not a filename string
Step-by-Step Solution
Solution:
  1. Step 1: Check documents argument type

    from_documents expects a list of document strings, not a filename string.
  2. Step 2: Identify error cause

    Passing "doc.txt" as a string causes an error because it is not a list of documents.
  3. Final Answer:

    The documents argument should be a list, not a filename string -> Option D
  4. Quick Check:

    Documents must be list, not filename string [OK]
Quick Trick: Pass list of docs, not filename string [OK]
Common Mistakes:
  • Passing filename instead of document list
  • Assuming run needs two arguments
  • Thinking from_documents method is missing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes