@@ -52,78 +52,78 @@ prereqs:
5252 content : |
5353 To use the AI GCP Model Armor plugin, you need a service account with **Model Armor Admin** permissions and a configured Model Armor template:
5454
55- 1. **Check your IAM permissions:**
56- Your service account must have the [`roles/modelarmor.admin`](https://cloud.google.com/iam/docs/roles-permissions/modelarmor) IAM role.
57-
58- 2. Create the `modelarmor-admin` service account in your GCP by executing the following command in your terminal:
59- {% capture modelarmor-admin %}
60- ```bash
61- gcloud iam service-accounts create modelarmor-admin \
62- --description="Service account for Model Armor administration" \
63- --display-name="Model Armor Admin" \
64- --project=$DECK_GCP_PROJECT_ID
65- ```
66- {% endcapture %}
67- {{ modelarmor-admin | indent: 3}}
68-
69- 3. Create and activate a service account key file by executing the following commands:
70-
71- {% capture service-account %}
72- ```bash
73- gcloud iam service-accounts keys create modelarmor-admin-key.json \
74- --iam-account=modelarmor-admin@$DECK_GCP_PROJECT_ID.iam.gserviceaccount.com
75-
76- gcloud auth activate-service-account \
77- --key-file=modelarmor-admin-key.json
78- ```
79- {% endcapture %}
80- {{ service-account | indent: 3}}
81-
82- After creating the key, convert the contents of `modelarmor-admin-key.json` into a **single-line JSON string**.
83- Escape all necessary characters — quotes (`"`) and newlines (`\n`) — so that it becomes a valid one-line JSON string.
84- Then export it as an environment variable:
85-
86- ```bash
87- export DECK_GCP_SERVICE_ACCOUNT_JSON="<single-line-escaped-json>"
88- ```
89-
90- 4. Enable the Model Armor API:
91-
92- {% capture enable-model-armor %}
93- ```bash
94- gcloud config set api_endpoint_overrides/modelarmor "https://modelarmor.$DECK_GCP_LOCATION_ID.rep.googleapis.com/"
95- gcloud services enable modelarmor.googleapis.com --project=$DECK_GCP_PROJECT_ID
96- ```
97- {% endcapture %}
98- {{ enable-model-armor | indent: 3}}
99-
100- 5. Create a Model Armor template with strict guardrails. This template blocks **hate speech, harassment, and sexually explicit content** at medium confidence or higher, enforces PI/jailbreak and malicious URI filters, and logs all inspection events. Execute the following command to create the template:
101- {% capture model-armor-template %}
102- ```bash
103- gcloud model-armor templates create strict-guardrails \
104- --project=$DECK_GCP_PROJECT_ID \
105- --location=$DECK_GCP_LOCATION_ID \
106- --rai-settings-filters='[
107- { "filterType": "HATE_SPEECH", "confidenceLevel": "MEDIUM_AND_ABOVE" },
108- { "filterType": "HARASSMENT", "confidenceLevel": "MEDIUM_AND_ABOVE" },
109- { "filterType": "SEXUALLY_EXPLICIT", "confidenceLevel": "MEDIUM_AND_ABOVE" }
110- ]' \
111- --basic-config-filter-enforcement=enabled \
112- --pi-and-jailbreak-filter-settings-enforcement=enabled \
113- --pi-and-jailbreak-filter-settings-confidence-level=LOW_AND_ABOVE \
114- --malicious-uri-filter-settings-enforcement=enabled \
115- --template-metadata-log-operations \
116- --template-metadata-log-sanitize-operations
117- ```
118- {% endcapture %}
119- {{ model-armor-template | indent: 3}}
120-
121-
122- 6. Export the template ID:
123-
124- ```bash
125- export DECK_GCP_TEMPLATE_ID="strict-guardrails"
126- ```
55+ 1. **Check your IAM permissions:**
56+ Your service account must have the [`roles/modelarmor.admin`](https://cloud.google.com/iam/docs/roles-permissions/modelarmor) IAM role.
57+
58+ 2. Create the `modelarmor-admin` service account in your GCP by executing the following command in your terminal:
59+ {% capture modelarmor-admin %}
60+ ```bash
61+ gcloud iam service-accounts create modelarmor-admin \
62+ --description="Service account for Model Armor administration" \
63+ --display-name="Model Armor Admin" \
64+ --project=$DECK_GCP_PROJECT_ID
65+ ```
66+ {% endcapture %}
67+ {{ modelarmor-admin | indent: 3}}
68+
69+ 3. Create and activate a service account key file by executing the following commands:
70+
71+ {% capture service-account %}
72+ ```bash
73+ gcloud iam service-accounts keys create modelarmor-admin-key.json \
74+ --iam-account=modelarmor-admin@$DECK_GCP_PROJECT_ID.iam.gserviceaccount.com
75+
76+ gcloud auth activate-service-account \
77+ --key-file=modelarmor-admin-key.json
78+ ```
79+ {% endcapture %}
80+ {{ service-account | indent: 3}}
81+
82+ After creating the key, convert the contents of `modelarmor-admin-key.json` into a **single-line JSON string**.
83+ Escape all necessary characters — quotes (`"`) and newlines (`\n`) — so that it becomes a valid one-line JSON string.
84+ Then export it as an environment variable:
85+
86+ ```bash
87+ export DECK_GCP_SERVICE_ACCOUNT_JSON="<single-line-escaped-json>"
88+ ```
89+
90+ 4. Enable the Model Armor API:
91+
92+ {% capture enable-model-armor %}
93+ ```bash
94+ gcloud config set api_endpoint_overrides/modelarmor "https://modelarmor.$DECK_GCP_LOCATION_ID.rep.googleapis.com/"
95+ gcloud services enable modelarmor.googleapis.com --project=$DECK_GCP_PROJECT_ID
96+ ```
97+ {% endcapture %}
98+ {{ enable-model-armor | indent: 3}}
99+
100+ 5. Create a Model Armor template with strict guardrails. This template blocks **hate speech, harassment, and sexually explicit content** at medium confidence or higher, enforces PI/jailbreak and malicious URI filters, and logs all inspection events. Execute the following command to create the template:
101+ {% capture model-armor-template %}
102+ ```bash
103+ gcloud model-armor templates create strict-guardrails \
104+ --project=$DECK_GCP_PROJECT_ID \
105+ --location=$DECK_GCP_LOCATION_ID \
106+ --rai-settings-filters='[
107+ { "filterType": "HATE_SPEECH", "confidenceLevel": "MEDIUM_AND_ABOVE" },
108+ { "filterType": "HARASSMENT", "confidenceLevel": "MEDIUM_AND_ABOVE" },
109+ { "filterType": "SEXUALLY_EXPLICIT", "confidenceLevel": "MEDIUM_AND_ABOVE" }
110+ ]' \
111+ --basic-config-filter-enforcement=enabled \
112+ --pi-and-jailbreak-filter-settings-enforcement=enabled \
113+ --pi-and-jailbreak-filter-settings-confidence-level=LOW_AND_ABOVE \
114+ --malicious-uri-filter-settings-enforcement=enabled \
115+ --template-metadata-log-operations \
116+ --template-metadata-log-sanitize-operations
117+ ```
118+ {% endcapture %}
119+ {{ model-armor-template | indent: 3}}
120+
121+
122+ 6. Export the template ID:
123+
124+ ```bash
125+ export DECK_GCP_TEMPLATE_ID="strict-guardrails"
126+ ```
127127 icon_url : /assets/icons/gcp-cloud-armor.svg
128128
129129 entities :
0 commit comments