gen_ai_hub.orchestration.models.azure_content_filter module¶
- class gen_ai_hub.orchestration.models.azure_content_filter.AzureThreshold(*values)¶
Bases:
int,EnumEnumerates the threshold levels for the Azure Content Safety service.
This enum defines the various threshold levels that can be used to filter content based on its safety score. Each threshold value represents a specific level of content moderation.
- Values:
ALLOW_SAFE: Allows only Safe content.
ALLOW_SAFE_LOW: Allows Safe and Low content.
ALLOW_SAFE_LOW_MEDIUM: Allows Safe, Low, and Medium content.
ALLOW_ALL: Allows all content (Safe, Low, Medium, and High).
- ALLOW_SAFE = 0¶
- ALLOW_SAFE_LOW = 2¶
- ALLOW_SAFE_LOW_MEDIUM = 4¶
- ALLOW_ALL = 6¶
- class gen_ai_hub.orchestration.models.azure_content_filter.AzureContentFilter(hate: AzureThreshold | Literal[0, 2, 4, 6], sexual: AzureThreshold | Literal[0, 2, 4, 6], violence: AzureThreshold | Literal[0, 2, 4, 6], self_harm: AzureThreshold | Literal[0, 2, 4, 6], **kwargs)¶
Bases:
ContentFilterSpecific implementation of ContentFilter for Azure’s content filtering service.
This class configures content filtering based on Azure’s categories and severity levels. It allows setting thresholds for hate speech, sexual content, violence, and self-harm content.
- __init__(hate: AzureThreshold | Literal[0, 2, 4, 6], sexual: AzureThreshold | Literal[0, 2, 4, 6], violence: AzureThreshold | Literal[0, 2, 4, 6], self_harm: AzureThreshold | Literal[0, 2, 4, 6], **kwargs)¶
Initializes the AzureContentFilter with specified thresholds for different content categories.
- Parameters:
hate (Union[AzureThreshold, Literal[0, 2, 4, 6]]) – threshold for hate speech content
sexual (Union[AzureThreshold, Literal[0, 2, 4, 6]]) – threshold for sexual content
violence (Union[AzureThreshold, Literal[0, 2, 4, 6]]) – threshold for violent content
self_harm (Union[AzureThreshold, Literal[0, 2, 4, 6]]) – threshold for self-harm content