From 74e78e85a3c27b5bc950b3a48c03701b325b39a4 Mon Sep 17 00:00:00 2001 From: Ninad Phalak Date: Wed, 11 Nov 2026 17:32:11 -0600 Subject: [PATCH 1/2] docs(guardrails): say how PII redaction works on streaming requests --- product/guardrails/pii-redaction.mdx | 6 ++++++ 1 file changed, 6 insertions(+) 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 From bb140fe0d816cf6b4734232d8c2a4fe5a063dfe7 Mon Sep 17 00:00:00 2001 From: Ninad Phalak Date: Wed, 11 Nov 2026 17:33:25 -0600 Subject: [PATCH 2/2] docs(guardrails): say how PII redaction works on streaming requests --- aigw/product/guardrails/pii-redaction.mdx | 6 ++++++ 1 file changed, 6 insertions(+) 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