跳到主要内容
哒哒星球DADA PLANET

Skill · 已公开版本

gws-modelarmor-sanitize-prompt · Model Armor 用户提示词净化

通过 Google Model Armor 模板对用户提示词做安全净化,调用 gws 命令行工具,支持文本参数、JSON 请求体或标准输入。

先看看示例

作者提供的示例,实际效果取决于你的输入和使用工具。

输入

在调用模型前,用指定模板净化用户输入:gws modelarmor +sanitize-prompt --template projects/P/locations/L/templates/T --text '用户输入'。

输出

预期交付:经模板过滤后的提示词净化结果,用于后续模型调用的入站安全检查。(编辑说明,非实际运行结果)

方法说明

---
name: gws-modelarmor-sanitize-prompt
description: "Google Model Armor: Sanitize a user prompt through a Model Armor template."
metadata:
  version: 0.22.5
  openclaw:
    category: "security"
    requires:
      bins:
        - gws
    cliHelp: "gws modelarmor +sanitize-prompt --help"
---

# modelarmor +sanitize-prompt

> **PREREQUISITE:** Read `../gws-shared/SKILL.md` for auth, global flags, and security rules. If missing, run `gws generate-skills` to create it.

Sanitize a user prompt through a Model Armor template

## Usage

```bash
gws modelarmor +sanitize-prompt --template <NAME>
```

## Flags

| Flag | Required | Default | Description |
|------|----------|---------|-------------|
| `--template` | ✓ | — | Full template resource name (projects/PROJECT/locations/LOCATION/templates/TEMPLATE) |
| `--text` | — | — | Text content to sanitize |
| `--json` | — | — | Full JSON request body (overrides --text) |

## Examples

```bash
gws modelarmor +sanitize-prompt --template projects/P/locations/L/templates/T --text 'user input'
echo 'prompt' | gws modelarmor +sanitize-prompt --template ...
```

## Tips

- If neither --text nor --json is given, reads from stdin.
- For outbound safety, use +sanitize-response instead.

## See Also

- [gws-shared](../gws-shared/SKILL.md) — Global flags and auth
- [gws-modelarmor](../gws-modelarmor/SKILL.md) — All filter user-generated content for safety commands