Skip to main content

LlamaIndex data loaders for Feishu/Lark wiki, docs, and drive

Project description

LlamaIndex Feishu Readers

PyPI version Python versions License: MIT CI Downloads 中文文档

Load documents from Feishu/Lark into LlamaIndex. This package provides three readers backed by the official lark-oapi SDK:

  • FeishuWikiReader — load documents from wiki spaces (with recursive subnode support)
  • FeishuDocsReader — load individual docx documents by token
  • FeishuDriveReader — load docx documents from cloud drive folders (with recursive subfolder support)

[!NOTE] The official llama-index-readers-feishu-wiki package has been removed from LlamaIndex, and llama-index-readers-feishu-docs is no longer maintained. This project carries the work forward with expanded Feishu document loading for wiki, docs, and drive.

Installation

pip install llama-index-readers-feishu

Prerequisites

  1. Create a Feishu custom app in the developer console.
  2. Enable permissions based on the reader you use:
Reader Required scopes
Wiki wiki:wiki:readonly or wiki:node:retrieve, docs:document.content:read
Docs docs:document.content:read or docx:document:readonly
Drive drive:drive:readonly or drive:drive, docs:document.content:read
  1. Grant the app access to the target wiki space or drive folder.

Quick Start

Wiki

from llama_index.readers.feishu import FeishuWikiReader

reader = FeishuWikiReader(app_id="cli_xxx", app_secret="your_app_secret")
documents = reader.load_data(
    space_id="your_space_id",
    parent_node_token="optional_parent_node_token",
    recursive=True,
)

Docs

from llama_index.readers.feishu import FeishuDocsReader

reader = FeishuDocsReader(app_id="cli_xxx", app_secret="your_app_secret")
documents = reader.load_data(document_ids=["docx_token_1", "docx_token_2"])

Drive

from llama_index.readers.feishu import FeishuDriveReader

reader = FeishuDriveReader(app_id="cli_xxx", app_secret="your_app_secret")
documents = reader.load_data(
    folder_token="your_folder_token",
    recursive=True,
)

The drive reader loads:

  • Files with type=docx
  • Shortcuts where shortcut_info.target_type=docx

Other file types (folders, sheets, bitables, etc.) are skipped. Folders are traversed when recursive=True.

Post-process Exported Text

Feishu markdown exports may embed HTML fragments such as tables. Pass plugins to normalize loaded text:

from llama_index.readers.feishu import (
    FeishuDriveReader,
    RegexPlugin,
    html_table_to_markdown_plugin,
)

reader = FeishuDriveReader(
    app_id="cli_xxx",
    app_secret="your_app_secret",
    plugins=[
        html_table_to_markdown_plugin,
        RegexPlugin(pattern=r"\n{3,}", repl="\n\n", name="collapse_blank_lines"),
    ],
)
documents = reader.load_data(folder_token="your_folder_token")

Use default_markdown_plugins() for the built-in HTML table converter and Feishu markdown unescape plugin.

User Access Token

To access content with user identity instead of tenant identity:

reader = FeishuWikiReader(
    app_id="cli_xxx",
    app_secret="your_app_secret",
    user_access_token="u-xxxxxxxx",
)

Lark (Overseas)

reader = FeishuWikiReader(
    app_id="cli_xxx",
    app_secret="your_app_secret",
    domain="https://open.larksuite.com",
)

Or switch after initialization:

reader = FeishuWikiReader(app_id="cli_xxx", app_secret="your_app_secret")
reader.set_lark_domain()

Use with LlamaIndex

from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("Summarize the content")
print(response)

Examples

Integration scripts under examples/ load live content and export markdown files. Copy .env.example to .env and fill in your credentials:

cp .env.example .env
# edit .env with your Feishu app credentials and target IDs

# Wiki
python examples/load_wiki_documents.py

# Docs
python examples/load_docs_documents.py

# Drive
python examples/load_drive_documents.py

Development

uv sync
uv run poe hooks-install
uv run poe lint
uv run poe test
uv run poe test-cov        # optional: with coverage report

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_readers_feishu-0.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_readers_feishu-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_readers_feishu-0.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_feishu-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8a83889a4928ef88663f61d9dee04802781ad11367d21c928e5dfe944d38300d
MD5 6dbbee9457b51bf32a9c7f2548fae997
BLAKE2b-256 76b3f222b634496b54871cdee252d87b97d9948b49aebd3274c7737c49b73fe0

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_readers_feishu-0.1.0.tar.gz:

Publisher: publish.yml on jinzcdev/llama-index-readers-feishu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llama_index_readers_feishu-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_feishu-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad35d0e8777c4266d71f348e287bc4db2e15a0c917c0fac1c722ba55beaece7b
MD5 eb1b882f37657e1459897fb29ef72157
BLAKE2b-256 33432e12de41ff143873bba16c3f0ba7f5955864347b084b393dd44badd3f13f

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_readers_feishu-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jinzcdev/llama-index-readers-feishu

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page