Bird
0
0

Given the code snippet:

medium📝 Predict Output Q4 of 15
LangChain - RAG Chain Construction
Given the code snippet:
from langchain.chains import LCEL
llm = SomeLLM()
retriever = SomeRetriever()
rag_chain = LCEL.from_retriever(llm, retriever)
result = rag_chain.run('What is Langchain?')

What type of output should 'result' contain?
AA list of documents retrieved
BThe retriever object itself
CA generated answer string based on retrieved documents
DAn error because run() is not defined
Step-by-Step Solution
Solution:
  1. Step 1: Understand what LCEL.from_retriever returns

    This creates a RAG chain that uses the retriever to get documents and the LLM to generate an answer.
  2. Step 2: Analyze the run() method output

    Running the chain with a query returns a generated answer string, not raw documents or objects.
  3. Final Answer:

    A generated answer string based on retrieved documents -> Option C
  4. Quick Check:

    run() returns generated answer string [OK]
Quick Trick: run() on RAG chain returns generated answer, not documents [OK]
Common Mistakes:
  • Expecting raw documents as output
  • Confusing retriever object with output
  • Assuming run() is undefined

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes