社群
如何新增社群整合項目 (不建議)
危險
我們建議遵循主要整合指南來新增整合項目。
如果您遵循本指南,我們很可能會關閉您的 PR,並附上上述指南連結,而不會進行太多討論。
langchain-community
套件位於 libs/community
中。
它可以使用 pip install langchain-community
安裝,並且匯出的成員可以使用如下程式碼匯入
from langchain_community.chat_models import ChatParrotLink
from langchain_community.llms import ParrotLinkLLM
from langchain_community.vectorstores import ParrotLinkVectorStore
community
套件依賴手動安裝的相依套件,因此如果您嘗試匯入未安裝的套件,將會看到錯誤。在我們的虛假範例中,如果您嘗試匯入 ParrotLinkLLM
而未安裝 parrot-link-sdk
,當您嘗試使用它時,將會看到 ImportError
告訴您安裝它。
假設我們想要為 Parrot Link AI 實作一個聊天模型。我們將在 libs/community/langchain_community/chat_models/parrot_link.py
中建立一個新檔案,並包含以下程式碼
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()
"""
...
API 參考:BaseChatModel
我們會在以下位置撰寫測試
- 單元測試:
libs/community/tests/unit_tests/chat_models/test_parrot_link.py
- 整合測試:
libs/community/tests/integration_tests/chat_models/test_parrot_link.py
並在以下位置新增文件
docs/docs/integrations/chat/parrot_link.ipynb