Bird
0
0

Which of the following is the correct way to create a simple chain in LangChain?

easy📝 Syntax Q12 of 15
LangChain - Chains and LCEL
Which of the following is the correct way to create a simple chain in LangChain?
Achain = LLMChain(llm=llm, prompt=prompt)
Bchain = Chain(llm, prompt)
Cchain = create_chain(llm, prompt)
Dchain = LLMChain(prompt)
Step-by-Step Solution
Solution:
  1. Step 1: Recall LangChain syntax for creating a simple chain

    The correct syntax uses named parameters like llm= and prompt= when creating an LLMChain.
  2. Step 2: Check each option

    chain = LLMChain(llm=llm, prompt=prompt) matches the correct syntax. The other options use incorrect function or class names or miss the llm parameter.
  3. Final Answer:

    chain = LLMChain(llm=llm, prompt=prompt) -> Option A
  4. Quick Check:

    Use named parameters for LLMChain [OK]
Quick Trick: Use named parameters when creating chains [OK]
Common Mistakes:
  • Omitting required parameters
  • Using wrong class or function names
  • Passing parameters without names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes