Table of Contents
- LangChain Core
- LangChain Community
- Official Provider Implementations
- Main LangChain Library
- Putting It All Together
- Further Reading
1. LangChain Core
Thelangchain_core package defines the abstract base classes, types, and interfaces that power every higher-level component.
- AIMessage & HumanMessage: generic chat message classes
- ChatPromptTemplate & MessagesPlaceholder: prompt templating primitives
- tool: decorator for defining custom tool interfaces
Install the core package before anything else:
2. LangChain Community
Under thelangchain_community namespace, you’ll find community-contributed models, tools, loaders, and callbacks. Each provider lives in its own module for better organization.
- ChatOpenAI & ChatDatabricks: community-maintained wrappers around respective chat APIs
- Gmail tools: comprehensive Gmail API integrations
3. Official Provider Implementations
Concrete classes for popular LLM providers are maintained in their own packages (e.g.,langchain_openai, langchain_anthropic). These implement the methods defined by the core abstractions.
- ChatOpenAI: wraps the OpenAI API, extending
BaseChatModel - Similar packages:
langchain_anthropic,langchain_azure, etc.
4. Main LangChain Library
The primarylangchain package ties together core, community, and official implementations to offer ready-to-use agents, chains, tools, and parsers.
| Component | Description |
|---|---|
| AgentExecutor | Executes agent loops with tools and prompts |
| format_to_openai_function_messages | Converts scratchpads into OpenAI function-calling format |
| OpenAIFunctionsAgentOutputParser | Parses responses from function-calling agents |
| format_tool_to_openai_function | Renders a tool’s signature into OpenAI JSON schema |
Ensure that
langchain, langchain_core, and your provider packages share compatible versions to avoid API mismatches.5. Putting It All Together
In a typical application, you’ll import from all four layers:- langchain_core for base types
- At least one provider package (e.g.,
langchain_openai) to call an LLM - langchain for high-level agents, tools, and chains
- langchain_community (optional) for extended integrations