Bird
0
0

Which of the following is the correct way to create a RunnableParallel with two tasks named task1 and task2?

easy📝 Syntax Q12 of 15
LangChain - Chains and LCEL
Which of the following is the correct way to create a RunnableParallel with two tasks named task1 and task2?
ARunnableParallel{task1, task2}
BRunnableParallel(task1, task2)
CRunnableParallel({"task1": task1, "task2": task2})
DRunnableParallel(task1 + task2)
Step-by-Step Solution
Solution:
  1. Step 1: Recall RunnableParallel syntax

    RunnableParallel expects a dictionary {"name": task} as its argument.
  2. Step 2: Match options to syntax

    Only RunnableParallel({"task1": task1, "task2": task2}) passes a dict {"task1": task1, "task2": task2}, others use wrong syntax.
  3. Final Answer:

    RunnableParallel({"task1": task1, "task2": task2}) -> Option C
  4. Quick Check:

    Dict of tasks = {"task1": task1, "task2": task2} [OK]
Quick Trick: Use curly braces {} to pass {"name": task} dictionary [OK]
Common Mistakes:
  • Passing tasks as separate positional arguments
  • Using invalid set syntax {}
  • Trying to add tasks with + operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes