diff --git a/aigw/product/guardrails/pii-redaction.mdx b/aigw/product/guardrails/pii-redaction.mdx index eadb1d0b..012f1a5a 100644 --- a/aigw/product/guardrails/pii-redaction.mdx +++ b/aigw/product/guardrails/pii-redaction.mdx @@ -82,6 +82,12 @@ Once you've created your custom PII regex guardrail, add it to your AI Gateway c You can add the same guardrail to both `before_request_hooks` (input guardrails) and `after_request_hooks` (output guardrails) to scan and redact PII in both user inputs and LLM responses. + +On streaming requests (`stream: true`), output guardrails run on the full response after the stream ends. Redaction does not change the chunks the client has already received, and the result is informational only (see [Streaming Responses](/aigw/product/guardrails#streaming-responses)). To redact PII in LLM responses, send the request with `stream: false`. + +Background on filtering streamed output: [OWASP AI Exchange, sensitive output handling](https://owaspai.org/go/sensitiveoutputhandling) and [Split-Boundary Leaks in Streaming Guardrails](https://doi.org/10.5281/zenodo.22909585). + + ### Example Implementation diff --git a/product/guardrails/pii-redaction.mdx b/product/guardrails/pii-redaction.mdx index c3741284..5c4097c6 100644 --- a/product/guardrails/pii-redaction.mdx +++ b/product/guardrails/pii-redaction.mdx @@ -85,6 +85,12 @@ Once you've created your custom PII regex guardrail, add it to your Portkey conf You can add the same guardrail to both `before_request_hooks` (input guardrails) and `after_request_hooks` (output guardrails) to scan and redact PII in both user inputs and LLM responses. + +On streaming requests (`stream: true`), output guardrails run on the full response after the stream ends. Redaction does not change the chunks the client has already received, and the result is informational only (see [Streaming Responses](/product/guardrails#streaming-responses)). To redact PII in LLM responses, send the request with `stream: false`. + +Background on filtering streamed output: [OWASP AI Exchange, sensitive output handling](https://owaspai.org/go/sensitiveoutputhandling) and [Split-Boundary Leaks in Streaming Guardrails](https://doi.org/10.5281/zenodo.22909585). + + ### Example Implementation