Skip to content

Commit 0097b46

Browse files
author
gitName
committed
edits
1 parent b345ac9 commit 0097b46

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

articles/api-management/llm-content-safety-policy.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ ms.service: azure-api-management
88
ms.collection: ce-skilling-ai-copilot
99
ms.custom:
1010
ms.topic: article
11-
ms.date: 01/27/2025
11+
ms.date: 02/06/2025
1212
ms.author: danlep
1313
---
1414

1515
# Enforce content safety checks on LLM requests
1616

1717
[!INCLUDE [api-management-availability-premium-dev-standard-basic-premiumv2-standardv2-basicv2](../../includes/api-management-availability-premium-dev-standard-basic-premiumv2-standardv2-basicv2.md)]
1818

19-
The `llm-content-safety` policy enforces content safety checks on LLM requests (prompts) by transmitting them to the [Azure AI Content Safety](/azure/ai-services/content-safety/overview) service before sending to the backend LLM. When enabled and AI Content Safety detects malicious content, API Management blocks the request and returns a `403` error code.
19+
The `llm-content-safety` policy enforces content safety checks on LLM requests (prompts) by transmitting them to the [Azure AI Content Safety](/azure/ai-services/content-safety/overview) service before sending to the backend LLM. When enabled and Azure AI Content Safety detects malicious content, API Management blocks the request and returns a `403` error code.
2020

2121
Use the policy in scenarios such as the following:
2222

@@ -82,7 +82,7 @@ Policy expressions are allowed. | No | `FourSeverityLevels` |
8282
| Attribute | Description | Required | Default |
8383
| -------------- | ----------------------------------------------------------------------------------------------------- | -------- | ------- |
8484
| name | Specifies the name of this category. The attribute must have one of the following values: `Hate`, `SelfHarm`, `Sexual`, `Violence`. Policy expressions are allowed. | Yes | N/A |
85-
| threshold | Specifies the threshold value for this category at which request are blocked. Requests with content severities less than the threshold are not blocked. The value must be between 0 and 7. Policy expressions are allowed. | Yes | N/A |
85+
| threshold | Specifies the threshold value for this category at which request are blocked. Requests with content severities less than the threshold aren't blocked. The value must be between 0 and 7. Policy expressions are allowed. | Yes | N/A |
8686

8787

8888
## Usage
@@ -99,7 +99,7 @@ Policy expressions are allowed. | No | `FourSeverityLevels` |
9999

100100
## Example
101101

102-
The following example enforces content safety checks on LLM requests using the Azure AI Content Safety service. The policy blocks requests that contain hate speech or violence with a severity level of 4 or higher. The `shield-prompt` attribute is set to `true` to check for adversarial attacks.
102+
The following example enforces content safety checks on LLM requests using the Azure AI Content Safety service. The policy blocks requests that contain speech in the `hate` or `violence` category with a severity level of 4 or higher. The `shield-prompt` attribute is set to `true` to check for adversarial attacks.
103103

104104
```xml
105105
<policies>
@@ -121,16 +121,4 @@ The following example enforces content safety checks on LLM requests using the A
121121
* [llm-token-limit](llm-token-limit-policy.md) policy
122122
* [llm-emit-token-metric](llm-emit-token-metric-policy.md) policy
123123

124-
[!INCLUDE [api-management-policy-ref-next-steps](../../includes/api-management-policy-ref-next-steps.md)]
125-
126-
127-
<!--
128-
Questions
129-
130-
1. Inbound only for now?
131-
1. Checks are only on *requests*?
132-
1. GW and SKU support?
133-
1. Preview for now?
134-
1. Should we categorize this as a content validation policy?
135-
136-
-->
124+
[!INCLUDE [api-management-policy-ref-next-steps](../../includes/api-management-policy-ref-next-steps.md)]

0 commit comments

Comments
 (0)