Graded Quiz: Introduction to LangChain in GenAI applications :Develop Generative AI Applications: Get Started (BM RAG and Agentic AI Professional Certificate) Answers 2025
Which output parser should Dana use to convert an LLM response into CSV-like comma-separated values?
❌ JSONOutputParser
❌ PandaDataFrameParser
❌ XMLParser
✅ CommaSeparatedListOutputParser
Explanation:CommaSeparatedListOutputParser converts output into comma-separated formats, suitable for CSV-like data.
Question 2
Correct sequence for creating an LCEL pattern:
❌ Option 1
❌ Option 2
❌ Option 3
✅ Define a template with variables → Create a PromptTemplate → Build a chain using the pipe operator → Invoke with input values
Explanation:
LCEL workflow:
-
Write template with
{variables} -
Create
PromptTemplate -
Chain using
| -
Run with inputs
Question 3
How does an agent integrate with external tools?
❌ Stores inputs
❌ Runs predefined commands only
❌ Creates a new tool per request
✅ Uses LLM to decide actions, then queries databases/websites via tools
Explanation:
Agents reason using the LLM and then call tools to fetch real data (APIs, DBs, search, etc.).
Question 4
Why is text splitting important for long documents?
❌ Aesthetics
❌ Remove duplicates
❌ Reduce token cost (side effect, not main reason)
✅ Break documents into chunks that fit within model context window
Explanation:
Models have context limits; splitting ensures each chunk fits and can be processed properly.
Question 5
Purpose of FewShotPromptTemplate:
❌ Store conversation history
❌ Visualize data
❌ Execute without examples
✅ Provide examples (“shots”) to guide the LLM output
Explanation:
Few-shot templates give sample inputs and outputs to steer the model’s behavior.
Question 6
How does LangChain use memory?
❌ Stores only final output
❌ Uses “sophisticated algorithms”
❌ Alters devices
✅ Reads and writes memory to maintain continuity across interactions
Explanation:
Memory tracks past messages so the LLM behaves consistently in a conversation.
Question 7
Correct LCEL syntax for chaining components:
❌ >>
✅ prompt_template | llm | output_parser
❌ .connect()
❌ Array notation
Explanation:
LCEL uses the pipe operator (|) to link components in a readable chain.
🧾 Summary Table
| Q No. | Correct Answer | Key Concept |
|---|---|---|
| 1 | CommaSeparatedListOutputParser | CSV-like output |
| 2 | Define → Create → Chain → Invoke | LCEL process |
| 3 | LLM decides + tool calls | Agent workflow |
| 4 | Fit chunks in context window | Text splitting |
| 5 | Provide examples to LLM | Few-shot prompting |
| 6 | Memory for continuity | LangChain memory |
| 7 | prompt | llm |