Bird
0
0

Given the code:

medium📝 state output Q4 of 15
LangChain - Chains and LCEL
Given the code:
parallel = RunnableParallel([taskA, taskB])
results = parallel.invoke()
print(results)

What will results contain?
AA list with outputs of taskA and taskB in order
BA single output from taskA only
CAn error because invoke() needs arguments
DA dictionary with task names as keys
Step-by-Step Solution
Solution:
  1. Step 1: Understand invoke() on RunnableParallel

    invoke() runs all tasks in parallel and returns their outputs as a list in the same order.
  2. Step 2: Analyze the code's output

    Since two tasks are passed, results will be a list with both outputs, matching A list with outputs of taskA and taskB in order.
  3. Final Answer:

    A list with outputs of taskA and taskB in order -> Option A
  4. Quick Check:

    invoke() returns list of results [OK]
Quick Trick: invoke() returns list of all task outputs in order [OK]
Common Mistakes:
  • Expecting a single output instead of a list
  • Thinking invoke() requires extra arguments
  • Assuming output is a dictionary

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes