Compare commits

...

9 Commits

Author SHA1 Message Date
Erick Friis
ef8789a46c x 2024-07-25 16:29:22 -07:00
Erick Friis
2e41beae4f x 2024-07-24 17:41:51 -07:00
Erick Friis
a785c56b01 Merge branch 'master' into erick/docs-new-integrations-docs 2024-07-24 17:25:19 -07:00
Erick Friis
74504fe13c x 2024-07-19 17:16:48 -07:00
Erick Friis
9af12fd44d x 2024-07-19 16:11:20 -07:00
Erick Friis
2305a7fa8b Merge branch 'master' into erick/docs-new-integrations-docs 2024-07-19 16:04:04 -07:00
Erick Friis
fac13ad5bc x 2024-07-18 09:47:31 -07:00
Erick Friis
ffa54e71d6 x 2024-07-18 09:47:28 -07:00
Erick Friis
f9523f9697 docs: new integrations docs 2024-07-17 15:27:03 -07:00
6 changed files with 186 additions and 62 deletions

View File

@@ -14,7 +14,7 @@ There are many ways to contribute to LangChain. Here are some common ways people
- [**Documentation**](/docs/contributing/documentation/): Help improve our docs, including this one!
- [**Code**](/docs/contributing/code/): Help us write code, fix bugs, or improve our infrastructure.
- [**Integrations**](integrations.mdx): Help us integrate with your favorite vendors and tools.
- [**Integrations**](integrations/index): Help us integrate with your favorite vendors and tools.
- [**Discussions**](https://github.com/langchain-ai/langchain/discussions): Help answer usage questions and discuss issues with users.
### 🚩 GitHub Issues

View File

@@ -0,0 +1,89 @@
---
sidebar_position: 1
sidebar_label: Community
---
# Contribute Community Integrations
:::info
Before beginning, make sure you have read about the different types of integrations in the [Contributing Integrations](./index.mdx) guide.
:::
## What is a community integration
Community integrations live in the `langchain-community` package and are maintained by the community.
The `langchain-community` package is released by LangChain at least once every 7 days, and it contains
integrations and implementations of the interfaces defined in the `langchain-core` package.
## Why contribute a community integration
If you are a company that wants to integrate with LangChain, you can contribute a community integration to:
- Make it easy for users to use your product with LangChain
- Quickly enable use cases that require multiple products
- Allow LangChain users to try out your product with their existing project (e.g.
if you host a chat model, users can try yours out to compare the experience with
their current model)
If you are a user of any service, we also welcome your contributions to community integrations!
Service users often have some of the best insights into how to use a service, and your contributions
can help other users get started with the service in as smooth a way as possible.
## How to contribute a community integration
In the following sections, we'll walk through how to contribute a chat model from a fake company, `Parrot Link AI`.
### 1. Fork and clone the repository
First, let's fork the [LangChain Repository](https://github.com/langchain-ai/langchain)
into a personal account fork, **not an organization fork** ([why?](/docs/contributing/faq/#how-do-i-allow-maintainers-to-edit-my-pr)).
You can fork the repository [here](https://github.com/langchain-ai/langchain/fork), and if you are prompted to "Choose an owner," select your personal username.
Now, clone the repository to your local machine:
```bash
git clone https://github.com/<your-username>/langchain.git
```
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
```python
from langchain_community.chat_models import ChatParrotLink
from langchain_community.llms import ParrotLinkLLM
from 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:
```python
from langchain_core.language_models.chat_models import BaseChatModel
class 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`

View File

@@ -0,0 +1,75 @@
---
sidebar_position: 0
sidebar_class_name: hidden
---
# Contribute Integrations
<!--
Vision: to maintain a comprehensive integrations ecosystem, we need integration partners to all build their integrations in standard ways.
Steps. figure out which kind of integration, follow respective guide
news: we have a new guide for contributing integrations
-->
In order to maintain a comprehensive integrations ecosystem, we need integration
partners to build their integrations in standard ways. This guide will help you
understand the different types of integrations and how to contribute them.
In this section, you will find guides for the following types of integrations:
<table style={{textAlign: "center"}}>
<tr>
<th rowspan="2">Type</th>
<th rowspan="2">Community</th>
<th colspan="3">Package in</th>
</tr>
<tr>
<th>Shared repo</th>
<th>LangChain repo</th>
<th>External repo</th>
</tr>
<tr>
<th>Package</th>
<td>
<a href="https://pypi.org/project/langchain-community"
><code>langchain-community</code></a
>
</td>
<td colspan="3"><code>langchain-[partner]</code></td>
</tr>
<tr>
<th>Updates</th>
<td>Community</td>
<td colspan="3">Partner</td>
</tr>
<tr>
<th>Releases</th>
<td>LangChain</td>
<td>Partner &amp; LangChain</td>
<td>LangChain</td>
<td>Partner</td>
</tr>
<tr>
<th>Maintenance Help</th>
<td>✅</td>
<td>✅</td>
<td>✅</td>
<td>❌</td>
</tr>
<tr>
<th>Integration Testing</th>
<td>❌</td>
<td>✅</td>
<td>✅</td>
<td>⚠️</td>
</tr>
<tr>
<th>Guide</th>
<td><a href="./community.mdx">Community Integration Guide</a></td>
<td colspan="3"><a href="./package.mdx">Package Guide</a></td>
</tr>
</table>
:::success
Let's get started with your integration, and build a [**Community Integration**](./community.mdx).
:::

View File

@@ -1,69 +1,21 @@
---
sidebar_position: 5
sidebar_position: 2
sidebar_label: Package
---
# Contribute Integrations
# Contribute Monorepo Packages
To begin, make sure you have all the dependencies outlined in guide on [Contributing Code](/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
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
```python
from langchain_community.chat_models import ChatParrotLink
from langchain_community.llms import ParrotLinkLLM
from 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:
```python
from langchain_core.language_models.chat_models import BaseChatModel
class 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
:::info
Before beginning, make sure you have read about the different types of integrations in the [Contributing Integrations](./index.mdx) guide.
:::
:::caution
Before starting a **partner** package, please confirm your intent with the LangChain team. Partner packages require more maintenance as separate packages, so we will close PRs that add new partner packages without prior discussion. See the above section for how to add a community integration.
:::
To begin, make sure you have all the dependencies outlined in guide on [Contributing Code](/docs/contributing/code/).
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}`
@@ -200,4 +152,4 @@ 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.
how to move it to an external repo.

View File

@@ -61,5 +61,5 @@ The `/libs` directory contains the code for the LangChain packages.
To learn more about how to contribute code see the following guidelines:
- [Code](/docs/contributing/code/): Learn how to develop in the LangChain codebase.
- [Integrations](./integrations.mdx): Learn how to contribute to third-party integrations to `langchain-community` or to start a new partner package.
- [Integrations](./integrations/index.mdx): Learn how to contribute to third-party integrations to `langchain-community` or to start a new partner package.
- [Testing](./testing.mdx): Guidelines to learn how to write tests for the packages.

View File

@@ -386,8 +386,6 @@ module.exports = {
"contributing/code/index",
{ type: "doc", id: "contributing/code/guidelines", className: "hidden" },
{ type: "doc", id: "contributing/code/setup", className: "hidden" },
"contributing/integrations",
"contributing/documentation/index",
{ type: "doc", id: "contributing/documentation/style_guide", className: "hidden" },
{ type: "doc", id: "contributing/documentation/setup", className: "hidden" },
"contributing/testing",
@@ -395,5 +393,15 @@ module.exports = {
],
collapsible: false,
},
{
type: "category",
link: {type: 'doc', id: 'contributing/integrations/index'},
label: "Contribute Integrations",
collapsible: false,
items: [{
type: 'autogenerated',
dirName: 'contributing/integrations',
}],
},
],
};