> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-docs-zh.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Dell powerscale 集成

> 使用 LangChain Python 与 Dell powerscale 文档加载器集成

[Dell PowerScale](https://www.dell.com/en-us/shop/powerscale-family/sf/powerscale) 是一款企业级可扩展存储系统，它承载了行业领先的 OneFS 文件系统，该文件系统可以在本地部署或云端运行。

此文档加载器利用了 PowerScale 的独特功能，能够确定自应用程序上次运行以来哪些文件已被修改，并且仅返回已修改的文件进行处理。这将消除重新处理（分块和嵌入）未更改文件的需要，从而提高整体数据摄取工作流。

此加载器需要 PowerScale 的 MetadataIQ 功能已启用。更多信息可以在我们的 GitHub 仓库中找到：[https://github.com/dell/powerscale-rag-connector](https://github.com/dell/powerscale-rag-connector)

## 概述

### 集成细节

| 类 | 包 | 本地 | 可序列化 | 支持 JS |
| :- | :- | :-: | :-: | :-: |
| [`PowerScaleDocumentLoader`](https://github.com/dell/powerscale-rag-connector/blob/main/src/powerscale_rag_connector/PowerScaleDocumentLoader.py) | [`powerscale-rag-connector`](https://github.com/dell/powerscale-rag-connector) | ✅ | ❌ | ❌ |
| [`PowerScaleUnstructuredLoader`](https://github.com/dell/powerscale-rag-connector/blob/main/src/powerscale_rag_connector/PowerScaleUnstructuredLoader.py) | [`powerscale-rag-connector`](https://github.com/dell/powerscale-rag-connector) | ✅ | ❌ | ❌ |

### 加载器功能

| 源 | 文档惰性加载 | 本地异步支持 |
| :-: | :-: | :-: |
| `PowerScaleDocumentLoader` | ✅ | ❌ |
| `PowerScaleUnstructuredLoader` | ✅ | ❌ |

## 设置

此文档加载器需要使用带有 MetadataIQ 功能的 Dell PowerScale 系统。更多信息可以在我们的 GitHub 页面上找到：[https://github.com/dell/powerscale-rag-connector](https://github.com/dell/powerscale-rag-connector)。

### 安装

文档加载器存在于外部的 pip 包中，可以使用标准工具进行安装。

```bash theme={null}
pip install -qU powerscale-rag-connector[langchain]
```

## 初始化

现在我们可以实例化文档加载器：

### 通用文档加载器

我们的通用文档加载器可以按以下方式增量加载 PowerScale 中的所有文件：

```python theme={null}
from powerscale_rag_connector import PowerScaleDocumentLoader

loader = PowerScaleDocumentLoader(
    es_host_url="http://elasticsearch:9200",
    es_index_name="metadataiq",
    es_api_key="your-api-key",
    folder_path="/ifs/data",
)
```

### UnstructuredLoader

可选地，`PowerScaleUnstructuredLoader` 可以用于定位已更改的文件并同时自动处理文件生成源文件的元素。这是通过使用 LangChain 的 `UnstructuredLoader` 类完成的。

```python theme={null}
from powerscale_rag_connector import PowerScaleUnstructuredLoader

# Or load files with the Unstructured Loader
loader = PowerScaleUnstructuredLoader(
    es_host_url="http://elasticsearch:9200",
    es_index_name="metadataiq",
    es_api_key="your-api-key",
    folder_path="/ifs/data",
    # 'basic' merges elements into larger contiguous chunks
    # Use 'by_title' for section-title boundaries,
    # or omit chunking_strategy to get one Document per element
    chunking_strategy="basic",
)
```

字段：

* `es_host_url` 是 MetadataIQ Elasticsearch 数据库的端点
* `es_index_name` 是 PowerScale 写入其文件系统元数据的索引名称
* `es_api_key` 是您的 Elasticsearch API 密钥的**编码**版本
* `folder_path` 是在 PowerScale 上查询更改的路径

## 加载

内部，所有代码都与 PowerScale 和 MetadataIQ 异步，加载和惰性加载方法将返回一个 Python 生成器。我们建议使用惰性加载函数。

```python theme={null}
for doc in loader.load():
    print(doc)
```

```python theme={null}
[Document(page_content='' metadata={'source': '/ifs/pdfs/1994-Graph.Theoretic.Obstacles.to.Perfect.Hashing.TR0257.pdf', 'snapshot': 20834, 'lin': 1099511628345, 'change_types': ['ENTRY_ADDED']}),
Document(page_content='' metadata={'source': '/ifs/pdfs/New.sendfile-FreeBSD.20.Feb.2015.pdf', 'snapshot': 20920, 'lin': 1099511628346, 'change_types': ['ENTRY_MODIFIED']}),
Document(page_content='' metadata={'source': '/ifs/pdfs/FAST-Fast.Architecture.Sensitive.Tree.Search.on.Modern.CPUs.and.GPUs-Slides.pdf', 'snapshot': 20924, 'lin': 1099511628347, 'change_types': ['ENTRY_ADDED']})]
```

### 返回对象

两个文档加载器都将跟踪之前返回给您的应用程序的文件。当再次调用时，文档加载器将仅返回自上次运行以来新或已修改的文件。连接器使用文件的出生时间（`btime`）来区分 `ENTRY_ADDED` 和 `ENTRY_MODIFIED`：

* `ENTRY_ADDED` — 文件在最后一次检查点后创建

* `ENTRY_MODIFIED` — 文件在最后一次检查点之前存在并且已被修改

* 返回的 @\[`Document`] 中的 `metadata` 字段将返回包含已修改文件的 PowerScale 路径。您将使用此路径通过 NFS（或 S3）读取数据并在您的应用程序中处理数据（例如：创建分块和嵌入）。

* `source` 字段是 PowerScale 上的路径，不一定是在您的本地系统上（取决于您的挂载策略）；OneFS 将整个存储系统表示为以 `/ifs` 为根的单个树。

* `snapshot` 字段是与文件关联的 PowerScale 快照 ID。

* `lin` 字段是 PowerScale 逻辑 inode 号——文件系统上每个文件的唯一、稳定的标识符。

* `change_types` 属性将告知您自上次更改以来发生了什么变化。

您的 RAG 应用程序可以使用 `change_types` 中的信息向您的分块和向量存储添加或更新条目。

当使用 `PowerScaleUnstructuredLoader` 时，`page_content` 字段将被 Unstructured Loader 的数据填充。

## 惰性加载

内部，所有代码都与 PowerScale 和 MetadataIQ 异步，加载和惰性加载方法将返回一个 Python 生成器。我们建议使用惰性加载函数。

```python theme={null}
for doc in loader.lazy_load():
    print(doc)  # do something specific with the document
```

返回的 @\[`Document`] 与加载函数相同，并具有上述所有相同的属性。

## 其他示例

更多示例和代码可以在我们的公共 GitHub 网页上找到：[https://github.com/dell/powerscale-rag-connector/tree/main/examples](https://github.com/dell/powerscale-rag-connector/tree/main/examples)，那里提供了完整的可工作示例。

* [PowerScale LangChain Document Loader](https://github.com/dell/powerscale-rag-connector/blob/main/examples/powerscale_langchain_doc_loader.py) - 我们标准文档加载器的可工作示例
* [PowerScale LangChain Unstructured Loader](https://github.com/dell/powerscale-rag-connector/blob/main/examples/powerscale_langchain_unstructured_loader.py) - 使用 Unstructured Loader 进行分块和嵌入的标准文档加载器的可工作示例
* [PowerScale NVIDIA Ingest LangChain Document Loader](https://github.com/dell/powerscale-rag-connector/blob/main/examples/powerscale_nvingest_langchain_doc_loader.py) - 使用 NVIDIA NvIngest 进行分块和嵌入的文档加载器的可工作示例

***

## API 参考

有关 PowerScale 文档加载器所有功能和配置的详细文档，请访问 GitHub 页面：[https://github.com/dell/powerscale-rag-connector/](https://github.com/dell/powerscale-rag-connector/)。

***

> 官方原文：[src/oss/python/integrations/document\_loaders/powerscale.mdx](https://github.com/langchain-ai/docs/blob/main/src/oss/python/integrations/document_loaders/powerscale.mdx) · 非官方翻译，译文由 AI 生成，以英文原文为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.