LangChainLangChain 1.4 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
46 small wins to finish your pathNext lesson →

Integrations: real base classes

An integration package is a pip-installed package, named langchain- and a provider, whose classes subclass the base classes you already met. That is why a hosted model or store drops into the desk by one line.

Last updated: 27 Sep, 2026 · LangChain 1.4

A provider is a company that hosts models or runs a service. LangChain publishes a package per provider, named langchain- and the provider's name: langchain-openai, langchain-anthropic, langchain-chroma. There are over a thousand of them, and they are all the same shape.

The shape is this: each package holds classes that subclass the base classes you have already met. Two of the four below are packages you have never imported, and the check says the same thing about all four.

Installing and importing an integration

python
# every integration is: pip install langchain-<provider>, then import its class
from langchain_openai import ChatOpenAI   # subclasses BaseChatModel
from langchain_chroma import Chroma       # subclasses VectorStore

Lining up each class with its base

Line up each class you wrote with the base class it extends. Two of the four names below come from packages you have never imported.

python
from langchain_chroma import Chroma
from langchain_core.embeddings import Embeddings
from langchain_core.language_models import BaseChatModel
from langchain_core.vectorstores import VectorStore
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.checkpoint.sqlite import SqliteSaver
from desk_model import DeskModel
from word_embeddings import WordEmbeddings

Asking Python about the base class

Then ask Python whether each one is an instance of its base class.

python
for cls, base in [(DeskModel, BaseChatModel), (WordEmbeddings, Embeddings),
                  (Chroma, VectorStore), (SqliteSaver, BaseCheckpointSaver)]:
    print(f"{cls.__name__:16} is a {base.__name__}: {issubclass(cls, base)}")

Checking each class against its base

The imports and the check in one file, ready to run.

Example
from langchain_chroma import Chroma
from langchain_core.embeddings import Embeddings
from langchain_core.language_models import BaseChatModel
from langchain_core.vectorstores import VectorStore
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.checkpoint.sqlite import SqliteSaver
from desk_model import DeskModel
from word_embeddings import WordEmbeddings

for cls, base in [(DeskModel, BaseChatModel), (WordEmbeddings, Embeddings),
                  (Chroma, VectorStore), (SqliteSaver, BaseCheckpointSaver)]:
    print(f"{cls.__name__:16} is a {base.__name__}: {issubclass(cls, base)}")

DeskModel and Chroma are both chat model and vector store to the same code that uses them. That is why swapping one for the other is a line: create_agent asks for the base class, not for your class.

The same function, either store

Code written against a base class does not care which one it is handed. This function is given the store you have used all along, and then one from a package you have never imported.

Example
from langchain_chroma import Chroma
from langchain_core.vectorstores import InMemoryVectorStore
from policies import chunks
from word_embeddings import WordEmbeddings


def refund_policy(store):
    store.add_documents(chunks)
    found = store.similarity_search("how long does a refund take", k=1)
    return f"{type(store).__name__:22} {found[0].metadata['source']}"


print(refund_policy(InMemoryVectorStore(WordEmbeddings())))
print(refund_policy(Chroma(collection_name="either-store", embedding_function=WordEmbeddings())))

Same question, same document, two different stores, and refund_policy was written once. Everything in the three lessons after this is that, applied to the desk.

What the base classes guarantee

  • All four say True. Your DeskModel, your WordEmbeddings, an installed Chroma and an installed SqliteSaver are each an instance of the same base class.
  • The base class is the contract. create_agent asks for BaseChatModel, not for your class, which is why swapping one for the other is one line.
  • Written once, run on either store. refund_policy took the in-memory store and a Chroma store and returned the same document from both.

Which piece has which base

What you wroteIts base classA real onePackage
ShopModel, DeskModelBaseChatModelChatOpenAI, ChatGroqlangchain-openai, langchain-groq
WordEmbeddingsEmbeddingsOpenAIEmbeddingslangchain-openai
InMemoryVectorStoreVectorStoreChroma, QdrantVectorStorelangchain-chroma, langchain-qdrant
InMemorySaverBaseCheckpointSaverSqliteSaver, PostgresSaverlanggraph-checkpoint-sqlite, langgraph-checkpoint-postgres

Middleware is an integration point too. The guardrail slot that held your no_passwords check is where LangChain's own middleware plugs in, such as SummarizationMiddleware, ModelFallbackMiddleware and HumanInTheLoopMiddleware from earlier lessons, each a real class you import and add.

A hosted service reads its credentials from the environment, the way lesson 1 set OPENROUTER_API_KEY in .env. The three lessons after this one take the rows in order: the model, the store, and the saver.

When you move to a provider package

  • Moving from a stand-in to a hosted model, store or saver when you go from learning to running for real.
  • Choosing between providers, since every one of them presents the same base class to your code.
Watch out. Each provider is a separate install. Importing Chroma without pip install langchain-chroma raises ModuleNotFoundError, not a LangChain error, so read the missing package name and install that one.
Try it yourself
  • Run the same issubclass check against InMemoryVectorStore and InMemorySaver.
  • Print Chroma.__mro__ and find VectorStore in the list.
  • Install langchain-qdrant and check its store against VectorStore too.

You understood something today that you didn't yesterday.