文档加载器提供了一个 **标准接口** 用于从不同来源(如 Slack、Notion 或 Google Drive)读取数据并转换为 LangChain 的 Document 格式。 这确保了数据无论来源如何都能被一致地处理。
所有文档加载器都实现了 BaseLoader 接口。
接口
每个文档加载器可以定义自己的参数,但它们共享一个通用 API:
- *
load()– 一次性加载所有文档。 - *
lazy_load()– 惰性流式处理文档,适用于大型数据集。
from langchain_docling.loader import DoclingLoader
FILE_PATH = "https://arxiv.org/pdf/2408.09869"
loader = DoclingLoader(file_path=FILE_PATH)
# Load all documents
documents = loader.load()
# For large datasets, lazily load documents
for document in loader.lazy_load():
print(document)
按分类
生产力工具
以下文档加载器允许您从常用生产力工具加载数据。
| 文档加载器 | API 参考 |
|---|---|
| AgentMail | AgentMailLoader |
网页
以下文档加载器允许您加载网页。
| Document Loader | Description | Package/API |
|---|---|---|
| Unstructured | 使用 Unstructured 加载和解析网页 | 包 |
| Apify Dataset | 从 Apify 数据集加载文档 | API |
| Docling | 使用 Docling 加载和解析网页 | 包 |
| Hyperbrowser | Platform for running and scaling headless browsers, can be used to scrape/crawl any site | API |
| AgentQL | 使用 AgentQL 查询或自然语言提示从任何网页进行交互并提取结构化数据 | API |
| Browserbase | 使用托管无头浏览器的隐身模式加载网页 | API |
PDF 文件
以下文档加载器允许您加载 PDF 文档。
| Document Loader | Description | Package/API |
|---|---|---|
| Unstructured | 使用 Unstructured 的开源库加载 PDF | 包 |
| Upstage Document Parse Loader | 使用 UpstageDocumentParseLoader 加载 PDF 文件 | 包 |
| Docling | 使用 Docling 加载 PDF 文件 | 包 |
| UnDatasIO | 使用 UnDatasIO 加载 PDF 文件 | 包 |
| OpenDataLoader PDF | 使用 OpenDataLoader PDF 加载 PDF 文件 | 包 |
云服务提供商
以下文档加载器允许您从喜欢的云服务提供商加载文档。
| 文档加载器 | 描述 | 合作伙伴包 | API 参考 |
|---|---|---|---|
| Google Cloud Storage 目录 | 从 GCS 存储桶加载文档 | ✅ | GCSDirectoryLoader |
| Google Cloud Storage 文件 | 从 GCS 文件对象加载文档 | ✅ | GCSFileLoader |
| Google Drive | 从 Google Drive 加载文档(仅 Google Docs) | ✅ | GoogleDriveLoader |
常见文件类型
以下文档加载器允许您从常见数据格式加载数据。
| 文档加载器 | 数据类型 |
|---|---|
Unstructured | Many file types (see https://docs.unstructured.io/platform/supported-file-types) |
DoclingLoader | Various file types (see https://ds4sd.github.io/docling/) |
PolarisAIDataInsightLoader | Various file types (see https://datainsight.polarisoffice.com/documentation?docType=doc_提取) |