-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: how to contribute integrations (#28143)
- Loading branch information
Showing
9 changed files
with
374 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## How to add a community integration (deprecated) | ||
|
||
:::danger | ||
|
||
We are no longer accepting new community integrations. Please see the | ||
[main integration guide](./index.mdx) for more information on contributing new | ||
integrations. | ||
|
||
::: | ||
|
||
The `langchain-community` package is in `libs/community`. | ||
|
||
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` |
Oops, something went wrong.