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:
Step 1: Recall LangChain import syntax
The common pattern is to import specific classes like LLMChain directly from langchain.
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.
Final Answer:
from langchain import LLMChain -> Option B
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
Master "Fundamentals" in LangChain
9 interactive learning modes - each teaches the same concept differently