Skip to content

Commit

Permalink
docs: how to contribute integrations (#28143)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Nov 15, 2024
1 parent 6836443 commit 709c418
Show file tree
Hide file tree
Showing 9 changed files with 374 additions and 214 deletions.
2 changes: 1 addition & 1 deletion docs/docs/contributing/how_to/code/guidelines.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ or new agents/chains from outside contributors without an existing GitHub discus

- New features must come with docs, unit tests, and (if appropriate) integration tests.
- New integrations must come with docs, unit tests, and (if appropriate) integration tests.
- See [this page](../integrations.mdx) for more details on contributing new integrations.
- See [this page](../integrations/index.mdx) for more details on contributing new integrations.
- New functionality should not inherit from or use deprecated methods or classes.
- We will reject features that are likely to lead to security vulnerabilities or reports.
- Do not add any hard dependencies. Integrations may add optional dependencies.
2 changes: 1 addition & 1 deletion docs/docs/contributing/how_to/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

- [**Documentation**](documentation/index.mdx): Help improve our docs, including this one!
- [**Code**](code/index.mdx): 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.mdx): Help us integrate with your favorite vendors and tools.
203 changes: 0 additions & 203 deletions docs/docs/contributing/how_to/integrations.mdx

This file was deleted.

50 changes: 50 additions & 0 deletions docs/docs/contributing/how_to/integrations/community.mdx
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`
Loading

0 comments on commit 709c418

Please sign in to comment.