Skip to main content

Quiz: Building RAG Pipelines

Test your knowledge about LangChain, LlamaIndex, and RAG pipeline construction.

30 questions - Click on each question to reveal the correct answer.


Question 1-10: LangChain​

Question 1: What is LCEL in LangChain?

Answer: LangChain Expression Language - a composable, declarative way to build chains using the pipe (|) operator.

Question 2: What does the "stuff" chain type do?

Answer: Puts all retrieved documents into a single prompt - best for small contexts that fit in the LLM's context window.

Question 3: When should you use map_reduce chain type?

Answer: When dealing with large datasets that don't fit in a single prompt - it processes documents separately then combines results.

Question 4: What is ConversationBufferMemory used for?

Answer: To maintain conversation history in chatbot-style RAG applications.

Question 5: What does RunnablePassthrough do in LCEL?

Answer: Passes the input through unchanged - useful for including the original query in chain compositions.

Question 6: How do you create a retriever from a vector store in LangChain?

Answer: Using vectorstore.as_retriever() method.

Question 7: What is the purpose of ChatPromptTemplate?

Answer: To create reusable prompt templates with variable placeholders for dynamic content.

Question 8: What does StrOutputParser do?

Answer: Parses the LLM output to extract just the string content from the response.

Question 9: What is the "refine" chain type best for?

Answer: Complex queries where iteratively refining the answer with each document improves quality.

Question 10: How do you add streaming to a LangChain chain?

Answer: Use chain.stream() instead of chain.invoke() to get an iterator of response chunks.


Question 11-20: LlamaIndex​

Question 11: What was LlamaIndex formerly called?

Answer: GPT Index

Question 12: What is the main index type in LlamaIndex?

Answer: VectorStoreIndex - stores documents with their embeddings for similarity search.

Question 13: How do you create a query engine from an index?

Answer: Using index.as_query_engine() method.

Question 14: What is a chat engine in LlamaIndex?

Answer: A query engine with built-in conversation memory for multi-turn interactions.

Question 15: What does "compact" response mode do?

Answer: Fits all context into a single prompt - the default and most efficient mode.

Question 16: What is tree_summarize response mode?

Answer: Hierarchically summarizes documents, useful for very large result sets.

Question 17: What is SimpleDirectoryReader?

Answer: A utility to load all documents from a directory with automatic file type detection.

Question 18: What does similarity_top_k parameter control?

Answer: The number of similar documents to retrieve for each query.

Question 19: What is SummaryIndex used for?

Answer: Creating summaries over documents rather than similarity search.

Question 20: How does LlamaIndex differ from LangChain in focus?

Answer: LlamaIndex focuses on data indexing and querying, while LangChain is more general-purpose for building chains.


Question 21-30: General & Custom RAG​

Question 21: When should you build a custom RAG instead of using frameworks?

Answer: When you need fine-grained control, minimal dependencies, or have specific performance requirements.

Question 22: What are the three core steps in any RAG system?

Answer: 1) Embed the query, 2) Retrieve relevant documents, 3) Generate response with context.

Question 23: Why might custom RAG be faster than frameworks?

Answer: Less overhead, no abstraction layers, optimized for specific use case.

Question 24: What is the main drawback of custom RAG?

Answer: More development work and maintenance - you build everything yourself.

Question 25: How do you add caching to a custom RAG?

Answer: Use techniques like @lru_cache for embedding caching or Redis for result caching.

Question 26: What is streaming useful for in RAG?

Answer: Providing real-time response output to users without waiting for complete generation.

Question 27: Which framework is better for rapid prototyping?

Answer: LlamaIndex for simple document Q&A, LangChain for more complex pipelines.

Question 28: What is the minimum you need for a basic RAG system?

Answer: Embeddings model, vector store, LLM, and code to connect them.

Question 29: How do you handle errors in production RAG?

Answer: Try-catch blocks, fallback responses, logging, and monitoring.

Question 30: What determines RAG response quality most?

Answer: Retrieval quality - if you retrieve the right documents, the LLM can generate good answers.


Results​

ScoreLevel
27-30Excellent - Strong understanding of RAG frameworks
21-26Good - Some review recommended
15-20Average - Review the chapters again
Below 15Needs comprehensive review

Back to Module 6 | Continue to Module 7