gen_ai_hub.orchestration_v2.models.azure_content_filter module

Azure Content Filter Model

class gen_ai_hub.orchestration_v2.models.azure_content_filter.AzureContentFilter(*, hate: AzureThreshold | Literal[0, 2, 4, 6] | None = None, sexual: AzureThreshold | Literal[0, 2, 4, 6] | None = None, violence: AzureThreshold | Literal[0, 2, 4, 6] | None = None, self_harm: AzureThreshold | Literal[0, 2, 4, 6] | None = None)

Bases: ABCBaseModel

Specific filter configuration for Azure Content Safety.

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.

Parameters:
  • hate – Threshold for hate speech content.

  • sexual – Threshold for sexual content.

  • violence – Threshold for violent content.

  • self_harm – Threshold for self-harm content.

  • prompt_shield – A flag to use prompt shield

hate: AzureThreshold | Literal[0, 2, 4, 6] | None
sexual: AzureThreshold | Literal[0, 2, 4, 6] | None
violence: AzureThreshold | Literal[0, 2, 4, 6] | None
self_harm: AzureThreshold | Literal[0, 2, 4, 6] | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.orchestration_v2.models.azure_content_filter.AzureContentSafetyInput(*, hate: AzureThreshold | Literal[0, 2, 4, 6] | None = None, sexual: AzureThreshold | Literal[0, 2, 4, 6] | None = None, violence: AzureThreshold | Literal[0, 2, 4, 6] | None = None, self_harm: AzureThreshold | Literal[0, 2, 4, 6] | None = None, prompt_shield: bool | None = False)

Bases: AzureContentFilter

Filter configuration for Azure Content Safety Input

Parameters:
  • hate – Threshold for hate speech content.

  • sexual – Threshold for sexual content.

  • violence – Threshold for violent content.

  • self_harm – Threshold for self-harm content.

  • prompt_shield – A flag to use prompt shield

prompt_shield: bool | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

hate: AzureThreshold | Literal[0, 2, 4, 6] | None
sexual: AzureThreshold | Literal[0, 2, 4, 6] | None
violence: AzureThreshold | Literal[0, 2, 4, 6] | None
self_harm: AzureThreshold | Literal[0, 2, 4, 6] | None
class gen_ai_hub.orchestration_v2.models.azure_content_filter.AzureContentSafetyOutput(*, hate: AzureThreshold | Literal[0, 2, 4, 6] | None = None, sexual: AzureThreshold | Literal[0, 2, 4, 6] | None = None, violence: AzureThreshold | Literal[0, 2, 4, 6] | None = None, self_harm: AzureThreshold | Literal[0, 2, 4, 6] | None = None, protected_material_code: bool | None = False)

Bases: AzureContentFilter

Filter configuration for Azure Content Safety Output

Parameters:
  • hate – Threshold for hate speech content.

  • sexual – Threshold for sexual content.

  • violence – Threshold for violent content.

  • self_harm – Threshold for self-harm content.

  • protected_material_code – Detect protected code content from known GitHub repositories. The scan includes software libraries, source code, algorithms, and other proprietary programming content.

protected_material_code: bool | None
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

hate: AzureThreshold | Literal[0, 2, 4, 6] | None
sexual: AzureThreshold | Literal[0, 2, 4, 6] | None
violence: AzureThreshold | Literal[0, 2, 4, 6] | None
self_harm: AzureThreshold | Literal[0, 2, 4, 6] | None
class gen_ai_hub.orchestration_v2.models.azure_content_filter.AzureThreshold(*values)

Bases: int, Enum

Enumerates 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