2024-04-29 14:37:50 +00:00
|
|
|
from langchain_community.document_loaders.larksuite import (
|
|
|
|
LarkSuiteDocLoader,
|
|
|
|
LarkSuiteWikiLoader,
|
|
|
|
)
|
feat (documents): add LarkSuite document loader (#6420)
<!--
Thank you for contributing to LangChain! Your PR will appear in our
release under the title you set. Please make sure it highlights your
valuable contribution.
Replace this with a description of the change, the issue it fixes (if
applicable), and relevant context. List any dependencies required for
this change.
After you're done, someone will review your PR. They may suggest
improvements. If no one reviews your PR within a few days, feel free to
@-mention the same people again, as notifications can get lost.
Finally, we'd love to show appreciation for your contribution - if you'd
like us to shout you out on Twitter, please also include your handle!
-->
<!-- Remove if not applicable -->
### Summary
This PR adds a LarkSuite (FeiShu) document loader.
> [LarkSuite](https://www.larksuite.com/) is an enterprise collaboration
platform developed by ByteDance.
### Tests
- an integration test case is added
- an example notebook showing usage is added. [Notebook
preview](https://github.com/yaohui-wyh/langchain/blob/master/docs/extras/modules/data_connection/document_loaders/integrations/larksuite.ipynb)
<!-- If you're adding a new integration, please include:
1. a test for the integration - favor unit tests that does not rely on
network access.
2. an example notebook showing its use
See contribution guidelines for more information on how to write tests,
lint
etc:
https://github.com/hwchase17/langchain/blob/master/.github/CONTRIBUTING.md
-->
### Who can review?
- PTAL @eyurtsev @hwchase17
<!-- For a quicker response, figure out the right person to tag with @
@hwchase17 - project lead
Tracing / Callbacks
- @agola11
Async
- @agola11
DataLoaders
- @eyurtsev
Models
- @hwchase17
- @agola11
Agents / Tools / Toolkits
- @hwchase17
VectorStores / Retrievers / Memory
- @dev2049
-->
---------
Co-authored-by: Yaohui Wang <wangyaohui.01@bytedance.com>
2023-06-28 06:08:05 +00:00
|
|
|
|
|
|
|
DOMAIN = ""
|
|
|
|
ACCESS_TOKEN = ""
|
|
|
|
DOCUMENT_ID = ""
|
|
|
|
|
|
|
|
|
|
|
|
def test_larksuite_doc_loader() -> None:
|
|
|
|
"""Test LarkSuite (FeiShu) document loader."""
|
|
|
|
loader = LarkSuiteDocLoader(DOMAIN, ACCESS_TOKEN, DOCUMENT_ID)
|
|
|
|
docs = loader.load()
|
|
|
|
|
|
|
|
assert len(docs) == 1
|
|
|
|
assert docs[0].page_content is not None
|
2024-04-29 14:37:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_larksuite_wiki_loader() -> None:
|
|
|
|
"""Test LarkSuite (FeiShu) wiki loader."""
|
|
|
|
loader = LarkSuiteWikiLoader(DOMAIN, ACCESS_TOKEN, DOCUMENT_ID)
|
|
|
|
docs = loader.load()
|
|
|
|
|
|
|
|
assert len(docs) == 1
|
|
|
|
assert docs[0].page_content is not None
|