Skip to content
LlamaIndex 文档版本 跟随上游 源快照 d751532e 更新于 2026-10-15

数据连接器(也称 Reader)把外部数据源的内容载入为 LlamaIndex 的 Document 对象。除了内置的 SimpleDirectoryReader,每个连接器都作为独立的包发布,因此你只需要安装自己要用的那部分。

寻找连接器

  • 浏览 LlamaIndex 仓库的 readers 目录。每个包都带有说明安装与用法的 README。
  • 在 PyPI 上搜索 llama-index-readers-。包名遵循 llama-index-readers-<source> 的形式,例如 llama-index-readers-google 或 llama-index-readers-database。
  • 其他集成类型也是同样的布局:agent 工具在 tools 下,LLM 在 llms 下,嵌入在 embeddings 下,依此类推。完整图景见集成总览。

使用方式

安装对应的包,然后从与之匹配的命名空间导入这个 reader:

终端窗口

pip install llama-index-readers-google
from llama_index.readers.google import GoogleDocsReader

loader = GoogleDocsReader()
documents = loader.load_data(document_ids=[...])

内置连接器:SimpleDirectoryReader

SimpleDirectoryReader 能解析相当广的文件类型,包括 .md、.pdf、.jpg、.png、.docx,以及音频和视频类型。它本身就是 LlamaIndex 的一部分,无需额外安装:

from llama_index.core import SimpleDirectoryReader

documents = SimpleDirectoryReader("./data").load_data()

常用连接器

数百个中的一部分:

  • Notion(NotionPageReader,llama-index-readers-notion)
  • Google Docs(GoogleDocsReader,llama-index-readers-google)
  • Slack(SlackReader,llama-index-readers-slack)
  • Discord(DiscordReader,llama-index-readers-discord)
  • Apify Actors(ApifyActor,llama-index-readers-apify)。可抓取网页、爬取页面内容、下载 .pdf、.jpg、.png、.docx 等文件。

更多细节见数据连接器模块指南。

BytesRouter 是社区翻译站点,所有译文仅供参考,一切以官方英文原文为准。