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

# Hugging Face

> 一个用于通过已连接账户处理模型、数据集、Spaces 和讨论的机器学习平台。

# Hugging Face

当你需要从工作流中检查或修改 Hugging Face 仓库时，请使用这个应用。你可以查找模型、数据集和 Spaces，然后创建提交或管理讨论。

## 配置

| 选项 | 必填 | 描述 |
| - | - | - |
| 名称 | 否 | 工作流画布中此步骤的标签。 |
| 身份验证 | 是 | 此步骤要使用的已连接 Hugging Face 账户。 |
| 操作 | 是 | 要执行的 Hugging Face 操作（例如 获取模型信息、获取数据集信息、获取 space 信息、列出仓库文件）。 |
| 参数 | 是 | 由操作的 schema 生成的按操作区分的表单字段。每个文本字段都有一个 **Insert Variable** 按钮，用于注入 `{{placeholder}}` 值。**Raw JSON** 选项卡可用于高级用法。 |
| 当步骤失败时 | 否 | 控制当此步骤失败时，工作流应 **Terminate Workflow** 还是 **Continue**。 |

在你配置此步骤之前，请通过登录流程在工作区的 **Integrations** 中连接 Hugging Face。如果没有可用的活动连接，该步骤会显示一个警告，并提供指向 **Integrations** 的链接，而不是账户选择器。

## 参数表单

当你选择一个操作时，**Arguments** 部分会根据该操作的输入 schema 渲染出一个表单。

如果你更喜欢手动编写完整的参数对象，请切换到 **Raw JSON** 选项卡。任一选项卡中的更改都会保持同步。

## 常用操作

| 操作 | 描述 |
| - | - |
| **Get model info** | 获取模型仓库的详细信息。 |
| **Get dataset info** | 获取数据集的详细信息。 |
| **Get space info** | 获取 Space 仓库的详细信息。 |
| **List repository files** | 列出仓库中的文件。 |
| **List model commits** | 列出模型仓库中的提交。 |
| **Create model commit** | 在模型仓库中创建一个提交。 |
| **List dataset commits** | 列出数据集仓库中的提交。 |
| **Create dataset commit** | 在数据集仓库中创建一个提交。 |
| **List space commits** | 列出 Space 仓库中的提交。 |
| **Create space commit** | 在 Space 仓库中创建一个提交。 |
| **List discussions** | 列出仓库的讨论。 |
| **Get discussion details** | 获取仓库讨论的详细信息。 |
| **Create discussion** | 在仓库中新建一个讨论。 |
| **Create discussion comment** | 为仓库讨论添加评论。 |
| **Update discussion title** | 更改仓库讨论的标题。 |

删除记录等破坏性操作在工作流操作选择器中不可用。

## 输出

此步骤会将 Hugging Face 响应存储为步骤输出。响应的形状取决于所选操作。

在后续步骤中使用完整的输出引用：

```text theme={null}
{{STEP_IDENTIFIER.output}}
```

## 示例

1. 打开 **Integrations**，如果你还没有连接过 Hugging Face，就先连接它。
2. 在你的工作流中添加一个 **Hugging Face** 步骤。
3. 在 **Authentication** 中选择一个已连接的账户。
4. 在 **Action** 中选择 **Get model info**。
5. 填写必填字段。对任何字段值，使用 **Insert Variable** 引用前一步的输出。
6. 点击步骤标题中的 **Run** 来测试该操作，然后在 **Output** 中查看返回的载荷。

## 使用场景

### 查看模型仓库

1. Get model info
2. List repository files
3. List model commits

### 发布数据集更新

1. Get dataset info
2. List dataset commits
3. Create dataset commit

### 管理讨论反馈

1. List discussions
2. Get discussion details
3. Create discussion comment

## 说明

* 此步骤依赖于你工作区中已连接的 Hugging Face 集成。
* 工作流操作选择器会显示一组经过筛选的操作。拥有 Hugging Face 工具的代理可以使用更多操作。
* 登录界面可能会显示第三方授权品牌标识。

## 将 Hugging Face 作为代理工具使用

你也可以在 **Agent Editor** 中将 Hugging Face 添加为工具。打开代理，点击 **Add tool**，然后选择 **Hugging Face**。在工具设置面板中，选择代理应使用的已连接账户。代理会在相关于对话时调用 Hugging Face 操作。

另请参见：[Integrations](https://docs.fetchhive.com/zh/workspace/integrations.md)、[Creating and Editing](https://docs.fetchhive.com/zh/workflows/creating-and-editing.md) 和 [Testing and Iteration](https://docs.fetchhive.com/zh/workflows/testing-and-iteration.md)


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