pub struct PayloadRedactor { /* private fields */ }otel only.Expand description
Redacts PII from payloads before they flow to observability sinks.
Wraps a PiiDetector and applies it to every text and JSON
string leaf emitted by convert_system_instructions,
convert_input_messages, and
convert_output_messages.
Construct with PayloadRedactor::new wrapping any
Arc<dyn PiiDetector>, or with PayloadRedactor::noop for the
pass-through case. The redactor is Clone and Send + Sync, so
one instance can be shared across the agent loop for the lifetime
of a run.
Implementations§
Source§impl PayloadRedactor
impl PayloadRedactor
Sourcepub fn new(detector: Arc<dyn PiiDetector>) -> Self
pub fn new(detector: Arc<dyn PiiDetector>) -> Self
Wrap an existing detector.
Sourcepub fn noop() -> Self
pub fn noop() -> Self
Redactor that performs no masking — produces byte-identical JSON output to the raw conversion path.
Sourcepub fn convert_system_instructions(
&self,
request: &ChatRequest,
) -> Option<Value>
pub fn convert_system_instructions( &self, request: &ChatRequest, ) -> Option<Value>
Convert system instructions, masking PII in the system prompt.
Returns None if the system prompt is empty.
Sourcepub fn convert_input_messages(&self, request: &ChatRequest) -> Value
pub fn convert_input_messages(&self, request: &ChatRequest) -> Value
Convert input messages into semconv JSON, masking PII in every text and tool-argument leaf.
Sourcepub fn convert_output_messages(&self, response: &ChatResponse) -> Value
pub fn convert_output_messages(&self, response: &ChatResponse) -> Value
Convert a ChatResponse into semconv output-messages JSON,
masking PII in every assistant text, thinking text, and
tool-argument leaf.
Trait Implementations§
Source§impl Clone for PayloadRedactor
impl Clone for PayloadRedactor
Source§fn clone(&self) -> PayloadRedactor
fn clone(&self) -> PayloadRedactor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more