用途
gws-modelarmor-sanitize-prompt 是 gws-claude-plugin 提供的一个技能,用于通过 Google Model Armor 模板对用户提示词(user prompt)进行净化(sanitize),即对用户生成内容做安全过滤。它属于 gws modelarmor 命令族,该命令族用于过滤用户生成内容以保障安全。
主要能力
- 通过指定的 Model Armor 模板对用户提示词进行净化处理。
- 支持直接传入文本内容,也支持传入完整 JSON 请求体。
- 支持从标准输入读取内容,便于管道式调用。
使用方式
命令用法:
gws modelarmor +sanitize-prompt --template <NAME>
标志(Flags):
- --template(必填,无默认值):完整的模板资源名称,格式为 projects/PROJECT/locations/LOCATION/templates/TEMPLATE。
- --text(可选,无默认值):要净化的文本内容。
- --json(可选,无默认值):完整的 JSON 请求体,会覆盖 --text。
示例:
gws modelarmor +sanitize-prompt --template projects/P/locations/L/templates/T --text 'user input'
echo 'prompt' | gws modelarmor +sanitize-prompt --template ...
提示(Tips):
- 如果既未提供 --text 也未提供 --json,则从标准输入(stdin)读取。
- 若需出站安全过滤,请改用 +sanitize-response。
前置条件(PREREQUISITE):
需阅读 ../gws-shared/SKILL.md 以了解认证、全局标志和安全规则。如果该文件缺失,请运行 gws generate-skills 生成。
适用场景
适用于在调用模型前对用户输入的提示词进行安全净化,属于入站内容安全过滤场景。若需要对模型输出做安全过滤,应使用 +sanitize-response。
限制
- --template 为必填项,必须提供完整的模板资源名称。
- 使用前需具备 gws-shared 中所述的认证与全局标志配置。
- 关于具体过滤规则、支持的模板类型、返回结果格式等细节,资料中暂未提供。