Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt

Use this file to discover all available pages before exploring further.

兼容性说明仅适用于 Node.js 环境。
本文介绍如何将 Azure 文件加载为 LangChain 文档。

环境设置

要使用此加载器,你需要确保 Unstructured 服务已配置完成,并可通过一个可访问的 URL 端点使用。也可以配置为本地运行。 有关如何设置的信息,请参阅 Unstructured 文件加载器文档 你还需要安装官方的 Azure 存储 Blob 客户端库:
npm
npm install @langchain/community @langchain/core @azure/storage-blob

使用方法

配置好 Unstructured 后,你可以使用 Azure Blob 存储文件加载器来加载文件,并将其转换为 Document 对象。
import { AzureBlobStorageFileLoader } from "@langchain/community/document_loaders/web/azure_blob_storage_file";

const loader = new AzureBlobStorageFileLoader({
  azureConfig: {
    connectionString: "",
    container: "container_name",
    blobName: "example.txt",
  },
  unstructuredConfig: {
    apiUrl: "http://localhost:8000/general/v0/general",
    apiKey: "", // 此参数即将变为必填项
  },
});

const docs = await loader.load();

console.log(docs);