This guide walks through the process of implementing a LangChain integration package. Integration packages are Python packages that can be installed with pip install <your-package>, which contain classes that are compatible with LangChain’s core interfaces. This guide covers:
  1. (Optional) How to bootstrap a new integration package
  2. How to implement components, such as chat models and vector stores, that adhere to the LangChain interface

(Optional) bootstrapping a new integration package

In this section, there are two options for bootstrapping a new integration package, but you can use other tools if you prefer.
  1. langchain-cli: This is a command-line tool that can be used to bootstrap a new integration package with a template for LangChain components and Poetry for dependency management.
  2. Poetry: This is a Python dependency management tool that can be used to bootstrap a new Python package with dependencies. You can then add LangChain components to this package.

Push your package to a public Github repository

This is only required if you want to publish your integration in the LangChain documentation.
  1. Create a new repository on GitHub.
  2. Push your code to the repository.
  3. Confirm that your repository is viewable by the public (e.g., in a private browsing window, where you’re not logged into GitHub).

Implementing LangChain components

LangChain components are subclasses of base classes in langchain-core. Examples include chat models, vector stores, tools, embedding models, and retrievers. Your integration package will typically implement a subclass of at least one of these components. Expand the tabs below to see details on each.
You can start from the following template or langchain-cli command:
langchain-cli integration new \
    --name parrot-link \
    --name-class ParrotLink \
    --src integration_template/chat_models.py \
    --dst langchain_parrot_link/chat_models.py
You can find example starter chat model code here.

Next steps

Now that you’ve implemented your package, you can move on to testing your integration.