Bird
0
0

What is wrong with this code snippet?

medium📝 Debug Q14 of 15
LangChain - Chains and LCEL
What is wrong with this code snippet?
parallel = RunnableParallel(task1, task2)
results = parallel.invoke()
ARunnableParallel requires tasks inside a dictionary, not separate arguments
Binvoke() method does not exist on RunnableParallel
CYou must call run() instead of invoke()
DRunnableParallel cannot run more than one task
Step-by-Step Solution
Solution:
  1. Step 1: Check RunnableParallel constructor usage

    RunnableParallel expects a dictionary of tasks, not separate positional arguments.
  2. Step 2: Identify the error in code

    Passing task1, task2 as separate positional arguments causes a TypeError.
  3. Final Answer:

    RunnableParallel requires tasks inside a dictionary, not separate arguments -> Option A
  4. Quick Check:

    Tasks must be in a dictionary [OK]
Quick Trick: Always use a dictionary or named kwargs for RunnableParallel tasks [OK]
Common Mistakes:
  • Passing tasks as separate positional arguments
  • Using wrong method name instead of invoke()
  • Thinking RunnableParallel runs only one task

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes