Class SafetyFilterOptions<T>
Configuration options for safety filtering mechanisms.
public class SafetyFilterOptions<T>
Type Parameters
TThe numeric data type used for calculations (e.g., float, double).
- Inheritance
-
SafetyFilterOptions<T>
- Inherited Members
Remarks
These options control how inputs and outputs are validated and filtered to prevent harmful or inappropriate content from passing through the AI system.
For Beginners: These settings control how strict your "security guards" are. You can adjust sensitivity thresholds, what types of content to filter, and how thoroughly to check for problems.
Properties
EnableInputValidation
Gets or sets whether to enable input validation.
public bool EnableInputValidation { get; set; }
Property Value
- bool
True to validate inputs, false otherwise (default: true).
Remarks
For Beginners: Input validation checks requests before processing them, catching malicious or malformed inputs early.
EnableOutputFiltering
Gets or sets whether to enable output filtering.
public bool EnableOutputFiltering { get; set; }
Property Value
- bool
True to filter outputs, false otherwise (default: true).
Remarks
For Beginners: Output filtering checks responses before showing them to users, ensuring no harmful content gets through.
HarmfulContentCategories
Gets or sets the harmful content categories to check for.
public string[] HarmfulContentCategories { get; set; }
Property Value
- string[]
Array of category names, defaulting to common harmful categories.
Remarks
For Beginners: These are the types of harmful content to watch for, like violence, hate speech, adult content, etc.
JailbreakSensitivity
Gets or sets the jailbreak detection sensitivity.
public double JailbreakSensitivity { get; set; }
Property Value
- double
The sensitivity (0-1), defaulting to 0.7.
Remarks
For Beginners: How sensitive the system is to jailbreak attempts. Higher values catch more jailbreaks but might have false positives.
LogFilePath
Gets or sets the file path used when logging filtered content.
public string? LogFilePath { get; set; }
Property Value
Remarks
When null or empty, a default relative path is used. Prefer an absolute path in production deployments or integrate with a logging framework.
LogFilteredContent
Gets or sets whether to log filtered content for review.
public bool LogFilteredContent { get; set; }
Property Value
- bool
True to log filtered content, false otherwise (default: true).
Remarks
For Beginners: Logging helps you review what's being filtered and improve the filtering over time.
MaxInputLength
Gets or sets the maximum input length to process.
public int MaxInputLength { get; set; }
Property Value
- int
The maximum length, defaulting to 10000.
Remarks
For Beginners: Inputs longer than this are rejected to prevent abuse and ensure processing efficiency.
SafetyThreshold
Gets or sets the safety threshold for content filtering.
public double SafetyThreshold { get; set; }
Property Value
- double
The threshold (0-1), defaulting to 0.8.
Remarks
For Beginners: Content with safety scores below this threshold is flagged. Higher thresholds (closer to 1) are more strict and filter more content.
UseClassifier
Gets or sets whether to use a classifier for harmful content detection.
public bool UseClassifier { get; set; }
Property Value
- bool
True to use classifier, false for rule-based detection (default: true).
Remarks
For Beginners: Classifiers use machine learning to detect harmful content and are generally more accurate than simple rules.