Skip to main content
Open In ColabOpen on GitHub

Outline 文档加载器

Outline 是一个开源协作知识库平台,专为团队信息共享而设计。

本 Notebook 展示了如何从你的 Outline 集合中获取 Langchain 文档。

概览

Outline Document Loader 可用于将 Outline collections 加载为 LangChain Documents,以便集成到检索增强生成 (RAG) 工作流中。

本示例演示了:

  • 设置一个 Document Loader 以加载来自 Outline 实例的所有文档。

设置

开始之前,请确保已设置以下环境变量:

import os

os.environ["OUTLINE_API_KEY"] = "ol_api_xyz123"
os.environ["OUTLINE_INSTANCE_URL"] = "https://app.getoutline.com"

初始化

要初始化 OutlineLoader,你需要以下参数:

  • outline_base_url:你的 Outline 实例的 URL(或者将从环境变量中获取)。
  • outline_api_key:用于认证你的 Outline 实例的 API 密钥(或者将从环境变量中获取)。
  • outline_collection_id_list:要检索的 collection ID 列表。如果为 None,将检索所有 collection。
  • page_size:由于 Outline API 使用分页结果,你可以配置每次 API 请求检索多少个结果(文档)。如果未指定此项,将使用默认值。

实例化

# Option 1: Using environment variables (ensure they are set)
from langchain_outline.document_loaders.outline import OutlineLoader

loader = OutlineLoader()

# Option 2: Passing parameters directly
loader = OutlineLoader(
outline_base_url="YOUR_OUTLINE_URL", outline_api_key="YOUR_API_KEY"
)

加载

加载并返回 Outline 实例中所有可用的文档。

loader.load()

惰性加载

lazy_load 方法允许你从 Outline 集合中迭代地加载文档,在获取到每个文档时将其返回:

loader.lazy_load()

API 参考

有关 Outline 所有功能和配置的详细文档,请参阅 API 参考:https://www.getoutline.com/developers