Bird
0
0

You want to build a SequentialChain that first extracts keywords from text, then summarizes those keywords. Which approach correctly sets up this workflow?

hard📝 Application Q15 of 15
LangChain - Chains and LCEL
You want to build a SequentialChain that first extracts keywords from text, then summarizes those keywords. Which approach correctly sets up this workflow?
ACreate two chains: keyword_extractor outputs 'keywords'; summary_chain takes 'keywords' as input; combine with SequentialChain passing these variables
BCreate one chain that does both extraction and summary in one step
CRun keyword_extractor and summary_chain separately without chaining outputs
DUse SequentialChain but ignore passing variables between chains
Step-by-Step Solution
Solution:
  1. Step 1: Identify the workflow steps

    First extract keywords, then summarize them, so output of first is input of second.
  2. Step 2: Use SequentialChain with proper variable passing

    Set keyword_extractor to output 'keywords', summary_chain to input 'keywords', then chain them sequentially.
  3. Final Answer:

    Create two chains: keyword_extractor outputs 'keywords'; summary_chain takes 'keywords' as input; combine with SequentialChain passing these variables -> Option A
  4. Quick Check:

    SequentialChain passes outputs as inputs [OK]
Quick Trick: Chain outputs must match next chain inputs [OK]
Common Mistakes:
  • Trying to do both steps in one chain
  • Not passing outputs to next chain
  • Ignoring variable names in chaining

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes