SafetyConfig

Options & Configuration · AiDotNet.Safety

Master configuration for the comprehensive safety pipeline.

For Beginners

This is your one-stop safety control panel. You configure everything through this single object:

All settings use nullable types with industry-standard defaults — if you don’t set something, a sensible default is used automatically.

How It Works

This is the single configuration object for all safety features, accessed via AiModelBuilder.ConfigureSafety(Action<SafetyConfig>). It contains nested sub-configs for each safety domain (text, image, audio, video, watermarking, guardrails, fairness, compliance).

Constructors

Constructor Summary
SafetyConfig()

Properties

Property Summary
AudioSafetyConfig Audio { get; } Gets the audio safety configuration (deepfake, toxic speech, voice protection).
ComplianceConfig Compliance { get; } Gets the regulatory compliance configuration (EU AI Act, GDPR, SOC2).
FairnessConfig Fairness { get; } Gets the fairness configuration (bias detection, demographic parity).
GuardrailConfig Guardrails { get; } Gets the guardrails configuration (input/output guardrails, topic restrictions).
ImageSafetyConfig Image { get; } Gets the image safety configuration (NSFW, violence, deepfake).
SafetyAction? DefaultAction { get; set; } Gets or sets the default action for safety violations when no module-specific action is configured.
SafetySeverity? MinimumActionSeverity { get; set; } Gets or sets the minimum severity level that triggers the configured action.
TextSafetyConfig Text { get; } Gets the text safety configuration (toxicity, PII, jailbreak, hallucination, copyright).
VideoSafetyConfig Video { get; } Gets the video safety configuration (content moderation, temporal deepfake).
WatermarkConfig Watermarking { get; } Gets the watermarking configuration (text, image, audio watermarking).
bool? Enabled { get; set; } Gets or sets whether safety is enabled globally.
bool? ThrowOnUnsafeInput { get; set; } Gets or sets whether to throw an exception when unsafe input is detected.
bool? ThrowOnUnsafeOutput { get; set; } Gets or sets whether to throw an exception when unsafe output is detected.