Bird
0
0

Which of the following is the correct way to import LangChain's core module in Python?

easy📝 Syntax Q3 of 15
LangChain - Fundamentals
Which of the following is the correct way to import LangChain's core module in Python?
Aimport langchain.core
Bfrom langchain import LLMChain
Cfrom langchain import core
Dimport LangChain
Step-by-Step Solution
Solution:
  1. Step 1: Recall LangChain import syntax

    The common pattern is to import specific classes like LLMChain directly from langchain.
  2. Step 2: Check options for syntax correctness

    from langchain import LLMChain uses correct syntax. Options A and C are incorrect because 'core' is not a direct import. import LangChain is wrong due to case sensitivity and missing module structure.
  3. Final Answer:

    from langchain import LLMChain -> Option B
  4. Quick Check:

    Correct import = from langchain import LLMChain [OK]
Quick Trick: Import specific classes from langchain, not generic modules [OK]
Common Mistakes:
  • Using incorrect module names
  • Ignoring Python case sensitivity
  • Trying to import non-existent submodules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes