!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}(),document.documentElement.setAttribute("data-announcement-bar-initially-dismissed",function(){try{return"true"===localStorage.getItem("docusaurus.announcement.dismiss")}catch(t){}return!1}())

[Skip to main content](#__docusaurus_skipToContent_fallback)

You are viewing the **preview** v0.2 docs. View the **stable** v0.1 docs [here](/v0.1/docs/get_started/introduction/). Leave feedback on the v0.2 docs [here](https://github.com/langchain-ai/langchainjs/discussions/5386).

[

![🦜️🔗 Langchain](/v0.2/img/brand/wordmark.png)![🦜️🔗 Langchain](/v0.2/img/brand/wordmark-dark.png)

](/v0.2/)[Integrations](/v0.2/docs/integrations/platforms/)[API Reference](https://v02.api.js.langchain.com)

[More](#)

*   [People](/v0.2/docs/people/)
*   [Community](/v0.2/docs/community)
*   [Tutorials](/v0.2/docs/additional_resources/tutorials)
*   [Contributing](/v0.2/docs/contributing)

[v0.2](#)

*   [v0.2](/v0.2/docs/introduction)
*   [v0.1](https://js.langchain.com/v0.1/docs/get_started/introduction)

[🦜🔗](#)

*   [LangSmith](https://smith.langchain.com)
*   [LangSmith Docs](https://docs.smith.langchain.com)
*   [LangChain Hub](https://smith.langchain.com/hub)
*   [LangServe](https://github.com/langchain-ai/langserve)
*   [Python Docs](https://python.langchain.com/)

[Chat](https://chatjs.langchain.com)[](https://github.com/langchain-ai/langchainjs)

Search

*   [Contributing](/v0.2/docs/contributing/)
    
    *   [Welcome Contributors](/v0.2/docs/contributing/)
    *   [Repository Structure](/v0.2/docs/contributing/repo_structure)
    *   [Contribute Code](/v0.2/docs/contributing/code)
    *   [Testing](/v0.2/docs/contributing/testing)
    *   [Documentation](/v0.2/docs/contributing/documentation/style_guide)
        
    *   [Contribute Integrations](/v0.2/docs/contributing/integrations)
    *   [FAQ](/v0.2/docs/contributing/faq)

*   [](/v0.2/)
*   Contributing
*   Contribute Integrations

On this page

Contribute Integrations
=======================

TODO rewrite for JS[​](#todo-rewrite-for-js "Direct link to TODO rewrite for JS")
---------------------------------------------------------------------------------

To begin, make sure you have all the dependencies outlined in guide on [Contributing Code](/v0.2/docs/contributing/code/).

There are a few different places you can contribute integrations for LangChain:

*   **Community**: For lighter-weight integrations that are primarily maintained by LangChain and the Open Source Community.
*   **Partner Packages**: For independent packages that are co-maintained by LangChain and a partner.

For the most part, new integrations should be added to the Community package. Partner packages require more maintenance as separate packages, so please confirm with the LangChain team before creating a new partner package.

In the following sections, we'll walk through how to contribute to each of these packages from a fake company, `Parrot Link AI`.

Community package[​](#community-package "Direct link to Community package")
---------------------------------------------------------------------------

The `@langchain/community` package is in `libs/community` and contains most integrations.

It can be installed with `pip install langchain-community`, and exported members can be imported with code like

    from langchain_community.chat_models import ChatParrotLinkfrom langchain_community.llms import ParrotLinkLLMfrom langchain_community.vectorstores import ParrotLinkVectorStore

The `community` package relies on manually-installed dependent packages, so you will see errors if you try to import a package that is not installed. In our fake example, if you tried to import `ParrotLinkLLM` without installing `parrot-link-sdk`, you will see an `ImportError` telling you to install it when trying to use it.

Let's say we wanted to implement a chat model for Parrot Link AI. We would create a new file in `libs/community/langchain_community/chat_models/parrot_link.py` with the following code:

    from langchain_core.language_models.chat_models import BaseChatModelclass ChatParrotLink(BaseChatModel):    """ChatParrotLink chat model.    Example:        .. code-block:: python            from langchain_community.chat_models import ChatParrotLink            model = ChatParrotLink()    """    ...

And we would write tests in:

*   Unit tests: `libs/community/tests/unit_tests/chat_models/test_parrot_link.py`
*   Integration tests: `libs/community/tests/integration_tests/chat_models/test_parrot_link.py`

And add documentation to:

*   `docs/docs/integrations/chat/parrot_link.ipynb`

Partner package in LangChain repo[​](#partner-package-in-langchain-repo "Direct link to Partner package in LangChain repo")
---------------------------------------------------------------------------------------------------------------------------

Partner packages can be hosted in the `LangChain` monorepo or in an external repo.

Partner package in the `LangChain` repo is placed in `libs/partners/{partner}` and the package source code is in `libs/partners/{partner}/langchain_{partner}`.

A package is installed by users with `pip install langchain-{partner}`, and the package members can be imported with code like:

    from langchain_{partner} import X

### Set up a new package[​](#set-up-a-new-package "Direct link to Set up a new package")

To set up a new partner package, use the latest version of the LangChain CLI. You can install or update it with:

    pip install -U langchain-cli

Let's say you want to create a new partner package working for a company called Parrot Link AI.

Then, run the following command to create a new partner package:

    cd libs/partnerslangchain-cli integration new> Name: parrot-link> Name of integration in PascalCase [ParrotLink]: ParrotLink

This will create a new package in `libs/partners/parrot-link` with the following structure:

    libs/partners/parrot-link/  langchain_parrot_link/ # folder containing your package    ...  tests/    ...  docs/ # bootstrapped docs notebooks, must be moved to /docs in monorepo root    ...  scripts/ # scripts for CI    ...  LICENSE  README.md # fill out with information about your package  Makefile # default commands for CI  pyproject.toml # package metadata, mostly managed by Poetry  poetry.lock # package lockfile, managed by Poetry  .gitignore

### Implement your package[​](#implement-your-package "Direct link to Implement your package")

First, add any dependencies your package needs, such as your company's SDK:

    poetry add parrot-link-sdk

If you need separate dependencies for type checking, you can add them to the `typing` group with:

    poetry add --group typing types-parrot-link-sdk

Then, implement your package in `libs/partners/parrot-link/langchain_parrot_link`.

By default, this will include stubs for a Chat Model, an LLM, and/or a Vector Store. You should delete any of the files you won't use and remove them from `__init__.py`.

### Write Unit and Integration Tests[​](#write-unit-and-integration-tests "Direct link to Write Unit and Integration Tests")

Some basic tests are presented in the `tests/` directory. You should add more tests to cover your package's functionality.

For information on running and implementing tests, see the [Testing guide](/v0.2/docs/contributing/testing/).

### Write documentation[​](#write-documentation "Direct link to Write documentation")

Documentation is generated from Jupyter notebooks in the `docs/` directory. You should place the notebooks with examples to the relevant `docs/docs/integrations` directory in the monorepo root.

### (If Necessary) Deprecate community integration[​](#if-necessary-deprecate-community-integration "Direct link to (If Necessary) Deprecate community integration")

Note: this is only necessary if you're migrating an existing community integration into a partner package. If the component you're integrating is net-new to LangChain (i.e. not already in the `community` package), you can skip this step.

Let's pretend we migrated our `ChatParrotLink` chat model from the community package to the partner package. We would need to deprecate the old model in the community package.

We would do that by adding a `@deprecated` decorator to the old model as follows, in `libs/community/langchain_community/chat_models/parrot_link.py`.

Before our change, our chat model might look like this:

    class ChatParrotLink(BaseChatModel):  ...

After our change, it would look like this:

    from langchain_core._api.deprecation import deprecated@deprecated(    since="0.0.<next community version>",    removal="0.2.0",    alternative_import="langchain_parrot_link.ChatParrotLink")class ChatParrotLink(BaseChatModel):  ...

You should do this for _each_ component that you're migrating to the partner package.

### Additional steps[​](#additional-steps "Direct link to Additional steps")

Contributor steps:

*    Add secret names to manual integrations workflow in `.github/workflows/_integration_test.yml`
*    Add secrets to release workflow (for pre-release testing) in `.github/workflows/_release.yml`

Maintainer steps (Contributors should **not** do these):

*    set up pypi and test pypi projects
*    add credential secrets to Github Actions
*    add package to conda-forge

Partner package in external repo[​](#partner-package-in-external-repo "Direct link to Partner package in external repo")
------------------------------------------------------------------------------------------------------------------------

Partner packages in external repos must be coordinated between the LangChain team and the partner organization to ensure that they are maintained and updated.

If you're interested in creating a partner package in an external repo, please start with one in the LangChain repo, and then reach out to the LangChain team to discuss how to move it to an external repo.

* * *

#### Was this page helpful?

  

#### You can leave detailed feedback [on GitHub](https://github.com/langchain-ai/langchainjs/issues/new?assignees=&labels=03+-+Documentation&projects=&template=documentation.yml&title=DOC%3A+%3CPlease+write+a+comprehensive+title+after+the+%27DOC%3A+%27+prefix%3E).

[

Previous

Style guide

](/v0.2/docs/contributing/documentation/style_guide)[

Next

FAQ

](/v0.2/docs/contributing/faq)

*   [TODO rewrite for JS](#todo-rewrite-for-js)
*   [Community package](#community-package)
*   [Partner package in LangChain repo](#partner-package-in-langchain-repo)
    *   [Set up a new package](#set-up-a-new-package)
    *   [Implement your package](#implement-your-package)
    *   [Write Unit and Integration Tests](#write-unit-and-integration-tests)
    *   [Write documentation](#write-documentation)
    *   [(If Necessary) Deprecate community integration](#if-necessary-deprecate-community-integration)
    *   [Additional steps](#additional-steps)
*   [Partner package in external repo](#partner-package-in-external-repo)

Community

*   [Discord](https://discord.gg/cU2adEyC7w)
*   [Twitter](https://twitter.com/LangChainAI)

GitHub

*   [Python](https://github.com/langchain-ai/langchain)
*   [JS/TS](https://github.com/langchain-ai/langchainjs)

More

*   [Homepage](https://langchain.com)
*   [Blog](https://blog.langchain.dev)

Copyright © 2024 LangChain, Inc.