You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -69,7 +69,7 @@ AWS Bedrock Guardrails are model-agnostic and can be applied to any Large Langua
69
69
- bedrockGuardrails:
70
70
identifier: <guardrail-ID>
71
71
version: "<version>"
72
-
region: <region>>
72
+
region: <region>
73
73
policies:
74
74
auth:
75
75
aws:
@@ -79,7 +79,7 @@ AWS Bedrock Guardrails are model-agnostic and can be applied to any Large Langua
79
79
- bedrockGuardrails:
80
80
identifier: <guardrail-ID>
81
81
version: "<version>"
82
-
region: <region>>
82
+
region: <region>
83
83
policies:
84
84
auth:
85
85
aws:
@@ -92,6 +92,8 @@ AWS Bedrock Guardrails are model-agnostic and can be applied to any Large Langua
92
92
The `aws: {}` configuration uses the default AWS credential chain (IAM role, environment variables, or instance profile). For authentication details, see the [AWS authentication documentation](https://docs.aws.amazon.com/sdk-for-go/api/aws/session/).
93
93
{{< /callout >}}
94
94
95
+
The `policies` field supports more than the `aws` credential source shown here. You can choose a different authentication method or tune the connection that agentgateway opens to Bedrock, such as setting a request timeout or custom TLS. For all the options, see [Backend connection and authentication policies](#backend-connection-and-authentication-policies).
96
+
95
97
96
98
5. Test the guardrail. The following commands assume that you set up your guardrail to block requests that contain email information.
97
99
{{< tabs >}}
@@ -156,12 +158,56 @@ AWS Bedrock Guardrails are model-agnostic and can be applied to any Large Langua
156
158
The request was rejected due to inappropriate content
157
159
```
158
160
161
+
## Backend connection and authentication policies
162
+
163
+
The `policies` field configures how agentgateway connects and authenticates to the AWS Bedrock Guardrails service when it evaluates a request or response.
164
+
165
+
### Authentication
166
+
167
+
Under `policies.auth`, set one credential source (`aws`, `secretRef`, or `key`). Optionally, set `location` to control where the credential is placed.
168
+
169
+
| Method | Description |
170
+
| -- | -- |
171
+
|`aws`| Authenticate with AWS credentials. Set `aws: {}` to use the default AWS credential chain (IAM role, environment variables, or instance profile), or set `aws.secretRef` to read credentials from a Kubernetes secret. |
172
+
|`secretRef`| Read the API key from a Kubernetes secret. By default, the key that matches the credential location is used, such as `Authorization` for the default header location. To use a different key, set `secretRef.key`. |
173
+
|`key`| Send an inline API key in the `Authorization` header. This option is the least secure. Use a secret instead when possible. |
174
+
|`location`| Where to place the credential. Defaults to the `Authorization` header with a `Bearer` prefix. To change it, set a `header`, `queryParameter`, or `cookie`. |
175
+
176
+
### Backend connection settings
177
+
178
+
You can also tune the connection that agentgateway opens to the Bedrock Guardrails backend by setting the following `BackendConnectionPolicy` fields under `policies`.
179
+
180
+
| Setting | Description |
181
+
| -- | -- |
182
+
|`tls`| TLS settings for the connection, such as a custom CA certificate or SNI. |
183
+
|`http`| HTTP settings, such as the `requestTimeout` and HTTP protocol `version`. |
184
+
|`tcp`| TCP connection settings. |
185
+
|`tunnel`| Tunnel settings, such as an `HTTPS_PROXY`, used to reach the backend. |
186
+
187
+
For example, the following prompt guard authenticates with a secret and sets a request timeout for the calls to Bedrock.
188
+
189
+
```yaml
190
+
- bedrockGuardrails:
191
+
identifier: <guardrail-ID>
192
+
version: "<version>"
193
+
region: <region>
194
+
policies:
195
+
auth:
196
+
aws:
197
+
secretRef:
198
+
name: aws-secret
199
+
http:
200
+
requestTimeout: 5s
201
+
```
202
+
203
+
For the full set of fields, see the [API reference]({{< link-hextra path="/reference/api/" >}}).
Copy file name to clipboardExpand all lines: content/docs/kubernetes/main/llm/guardrails/google-model-armor.md
+57-2Lines changed: 57 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,7 @@ In your GKE cluster, set up workload identity.
178
178
promptGuard:
179
179
request:
180
180
- googleModelArmor:
181
-
templateId: <template-ID
181
+
templateId: <template-ID>
182
182
projectId: <project-ID>
183
183
location: <location>
184
184
policies:
@@ -187,7 +187,7 @@ In your GKE cluster, set up workload identity.
187
187
type: AccessToken
188
188
response:
189
189
- googleModelArmor:
190
-
templateId: <template-ID
190
+
templateId: <template-ID>
191
191
projectId: <project-ID>
192
192
location: <location>
193
193
policies:
@@ -197,6 +197,8 @@ In your GKE cluster, set up workload identity.
197
197
EOF
198
198
```
199
199
200
+
The `policies` field supports more than the `gcp` authentication shown here. You can also tune the connection that agentgateway opens to Model Armor, such as setting a request timeout or custom TLS. For all the options, see [Backend connection and authentication policies](#backend-connection-and-authentication-policies).
201
+
200
202
2. Send a request to the Gemini provider that triggers the guardrail.
201
203
{{< tabs >}}
202
204
{{% tab name="Gemini default" %}}
@@ -269,3 +271,56 @@ In your GKE cluster, set up workload identity.
269
271
The request was rejected due to inappropriate content
270
272
```
271
273
274
+
## Backend connection and authentication policies
275
+
276
+
The `policies` field configures how agentgateway connects and authenticates to Google Model Armor when it evaluates a request or response.
277
+
278
+
### Authentication
279
+
280
+
Under `policies.auth`, set the credential source.
281
+
282
+
| Method | Description |
283
+
| -- | -- |
284
+
|`gcp`| Authenticate with GCP credentials. Set `gcp: {}` to use the default Google credential discovery, or set the credential `type` to use, such as `AccessToken`. |
285
+
286
+
### Backend connection settings
287
+
288
+
You can also tune the connection that agentgateway opens to the Model Armor backend by setting the following `BackendConnectionPolicy` fields under `policies`.
289
+
290
+
| Setting | Description |
291
+
| -- | -- |
292
+
|`tls`| TLS settings for the connection, such as a custom CA certificate or SNI. |
293
+
|`http`| HTTP settings, such as the `requestTimeout` and HTTP protocol `version`. |
294
+
|`tcp`| TCP connection settings. |
295
+
|`tunnel`| Tunnel settings, such as an `HTTPS_PROXY`, used to reach the backend. |
296
+
297
+
For example, the following prompt guard sets a request timeout for the calls to Model Armor.
298
+
299
+
```yaml
300
+
- googleModelArmor:
301
+
templateId: <template-ID>
302
+
projectId: <project-ID>
303
+
location: <location>
304
+
policies:
305
+
auth:
306
+
gcp:
307
+
type: AccessToken
308
+
http:
309
+
requestTimeout: 5s
310
+
```
311
+
312
+
For the full set of fields, see the [API reference]({{< link-hextra path="/reference/api/" >}}).
Copy file name to clipboardExpand all lines: content/docs/kubernetes/main/llm/guardrails/moderation.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ The OpenAI Moderation API detects potentially harmful content across categories
40
40
EOF
41
41
```
42
42
43
+
The `policies` field supports more than the `secretRef` authentication shown here. You can choose a different authentication method or tune the connection that agentgateway opens to the Moderation API, such as setting a request timeout or custom TLS. For all the options, see [Backend connection and authentication policies](#backend-connection-and-authentication-policies).
44
+
43
45
2. Test with content that triggers moderation.
44
46
{{< tabs >}}
45
47
@@ -83,6 +85,46 @@ The OpenAI Moderation API detects potentially harmful content across categories
83
85
Content blocked by moderation policy
84
86
```
85
87
88
+
## Backend connection and authentication policies
89
+
90
+
The `policies` field configures how agentgateway connects and authenticates to the OpenAI Moderation API when it evaluates a request.
91
+
92
+
### Authentication
93
+
94
+
Under `policies.auth`, set one credential source (`secretRef` or `key`). Optionally, set `location` to control where the credential is placed.
95
+
96
+
| Method | Description |
97
+
| -- | -- |
98
+
|`secretRef`| Read the API key from a Kubernetes secret. By default, the key that matches the credential location is used, such as `Authorization` for the default header location. To use a different key, set `secretRef.key`. |
99
+
|`key`| Send an inline API key in the `Authorization` header. This option is the least secure. Use a secret instead when possible. |
100
+
|`location`| Where to place the credential. Defaults to the `Authorization` header with a `Bearer` prefix. To change it, set a `header`, `queryParameter`, or `cookie`. |
101
+
102
+
### Backend connection settings
103
+
104
+
You can also tune the connection that agentgateway opens to the OpenAI Moderation backend by setting the following `BackendConnectionPolicy` fields under `policies`.
105
+
106
+
| Setting | Description |
107
+
| -- | -- |
108
+
|`tls`| TLS settings for the connection, such as a custom CA certificate or SNI. |
109
+
|`http`| HTTP settings, such as the `requestTimeout` and HTTP protocol `version`. |
110
+
|`tcp`| TCP connection settings. |
111
+
|`tunnel`| Tunnel settings, such as an `HTTPS_PROXY`, used to reach the backend. |
112
+
113
+
For example, the following prompt guard authenticates with a secret and sets a request timeout for the calls to the Moderation API.
114
+
115
+
```yaml
116
+
- openAIModeration:
117
+
model: omni-moderation-latest
118
+
policies:
119
+
auth:
120
+
secretRef:
121
+
name: openai-secret
122
+
http:
123
+
requestTimeout: 5s
124
+
```
125
+
126
+
For the full set of fields, see the [API reference]({{< link-hextra path="/reference/api/" >}}).
0 commit comments