gws-modelarmor-sanitize-response

Sanitize model responses through a Google Model Armor template via the gws CLI.

Updated Nov 9, 2023
One-click install
npx skills add https://github.com/oresttokovenko/dot-files --skill gws-modelarmor-sanitize-response-oresttokovenko
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gws-modelarmor-sanitize-response
Source: https://github.com/oresttokovenko/dot-files/tree/main/chezmoi/dot_agents/skills/gws-modelarmor-sanitize-response
Command: npx skills add https://github.com/oresttokovenko/dot-files --skill gws-modelarmor-sanitize-response-oresttokovenko

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gws.

What problem does it solve? It screens outbound AI model responses for unsafe or policy-violating content before they reach end users, using a configured Google Model Armor template. ## Core Features & Use Cases - Response Sanitization: Send model-generated text through a Model Armor template to detect filtered content. - Flexible Input: Pass text directly with --text, supply a full JSON request body with --json, or pipe output from another command. - Use Case: Pipe the output of a model inference command into gws modelarmor +sanitize-response with your template resource name to check the response for safety violations before displaying it to users. ## Quick Start Run gws modelarmor +sanitize-response with your template resource name and the model output text to sanitize the response.

Frequently Asked Questions about gws-modelarmor-sanitize-response

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sanitize a model response with Google Model Armor?

Run gws modelarmor +sanitize-response with the --template flag set to your full template resource name and --text containing the model output. You can also pipe model output directly into the command via stdin.

What is the difference between sanitize-response and sanitize-prompt in Model Armor?

sanitize-response screens outbound content flowing from the model to the user, while sanitize-prompt screens inbound content flowing from the user to the model. Use sanitize-response for output safety and sanitize-prompt for input safety.

What format does the Model Armor template name need?

The --template flag requires the full resource name in the form projects/PROJECT/locations/LOCATION/templates/TEMPLATE. Partial names or template IDs alone are not accepted.

Can I pass a JSON request body instead of plain text?

Yes, use the --json flag to provide a full JSON request body, which overrides the --text flag. This is useful when you need to include additional request fields beyond plain text content.

Why does gws modelarmor +sanitize-response fail with missing shared skill?

The command depends on the gws-shared skill for authentication, global flags, and security rules. If it is missing, run gws generate-skills to create it before using sanitize-response.