feat: add GuardrailTracingDetail TypedDict and tracing fields to StandardLoggingGuardrailInformation

This commit is contained in:
Ishaan Jaffer 2026-02-16 15:44:32 -08:00
parent a5e8eb6848
commit d422c63a60

View file

@ -2620,6 +2620,48 @@ class StandardLoggingGuardrailInformation(TypedDict, total=False):
}
"""
guardrail_id: Optional[str]
"""Unique identifier for the guardrail configuration, e.g. 'gd-eu-pii-001'"""
policy_template: Optional[str]
"""Name of the policy template this guardrail belongs to, e.g. 'EU AI Act Article 5'"""
detection_method: Optional[str]
"""How detection was performed: 'regex', 'keyword', 'llm-judge', 'presidio', etc."""
confidence_score: Optional[float]
"""For LLM-judge guardrails: confidence score 0.0-1.0"""
classification: Optional[dict]
"""For LLM-judge guardrails: structured classification output"""
match_details: Optional[List[dict]]
"""Detailed match information for each detected pattern"""
patterns_checked: Optional[int]
"""Total number of patterns evaluated by this guardrail"""
alert_recipients: Optional[List[str]]
"""Email addresses that were notified"""
class GuardrailTracingDetail(TypedDict, total=False):
"""
Typed fields for guardrail tracing metadata.
Passed to add_standard_logging_guardrail_information_to_request_data()
to enrich the StandardLoggingGuardrailInformation with provider-specific details.
"""
guardrail_id: Optional[str]
policy_template: Optional[str]
detection_method: Optional[str]
confidence_score: Optional[float]
classification: Optional[dict]
match_details: Optional[List[dict]]
patterns_checked: Optional[int]
alert_recipients: Optional[List[str]]
StandardLoggingPayloadStatus = Literal["success", "failure"]