概览
集成详情
加载器功能
| 来源 | 文档延迟加载 | 原生异步支持 |
|---|---|---|
| UnstructuredMarkdownLoader | ✅ | ❌ |
设置
要访问 UnstructuredMarkdownLoader 文档加载器,您需要安装langchain-community 集成包和 unstructured python 包。
凭据
使用此加载器无需凭据。 要启用模型调用的自动化跟踪,请设置您的 LangSmith API 密钥:安装
安装 langchain_community 和 unstructured初始化
现在我们可以实例化模型对象并加载文档。 您可以使用两种模式运行加载器:“single”和“elements”。如果使用“single”模式,文档将作为一个Document 对象返回。如果使用“elements”模式,unstructured 库会将文档拆分为 Title 和 NarrativeText 等元素。您可以在模式后传入额外的 unstructured kwargs 以应用不同的 unstructured 设置。加载
延迟加载
加载元素
在此示例中,我们将以elements 模式加载,它将返回 Markdown 文档中不同元素的列表
example.md 文件中提取了 29 个元素。第一个元素是文档的标题,与预期一致。
API 参考
有关所有 UnstructuredMarkdownLoader 功能和配置的详细文档,请参阅 API 参考:python.langchain.com/api_reference/community/document_loaders/langchain_community.document_loaders.markdown.UnstructuredMarkdownLoader.html以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。