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
# every integration is: pip install langchain-<provider>, then import its class
from langchain_openai import ChatOpenAI # subclasses BaseChatModel
from langchain_chroma import Chroma # subclasses VectorStoreLining 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.
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 WordEmbeddingsAsking Python about the base class
Then ask Python whether each one is an instance of its base class.
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.
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.
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, yourWordEmbeddings, an installedChromaand an installedSqliteSaverare each an instance of the same base class. - The base class is the contract.
create_agentasks forBaseChatModel, not for your class, which is why swapping one for the other is one line. - Written once, run on either store.
refund_policytook the in-memory store and aChromastore and returned the same document from both.
Which piece has which base
| What you wrote | Its base class | A real one | Package |
|---|---|---|---|
ShopModel, DeskModel | BaseChatModel | ChatOpenAI, ChatGroq | langchain-openai, langchain-groq |
WordEmbeddings | Embeddings | OpenAIEmbeddings | langchain-openai |
InMemoryVectorStore | VectorStore | Chroma, QdrantVectorStore | langchain-chroma, langchain-qdrant |
InMemorySaver | BaseCheckpointSaver | SqliteSaver, PostgresSaver | langgraph-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.
Chroma without pip install langchain-chroma raises ModuleNotFoundError, not a LangChain error, so read the missing package name and install that one.Related
- Previous: Testing the desk agent
- Next: The desk on a hosted model
- Reference: Provider integrations
- Run the same
issubclasscheck againstInMemoryVectorStoreandInMemorySaver. - Print
Chroma.__mro__and findVectorStorein the list. - Install
langchain-qdrantand check its store againstVectorStoretoo.
You understood something today that you didn't yesterday.