gen_ai_hub.orchestration.models.content_filter module

class gen_ai_hub.orchestration.models.content_filter.ContentFilterProvider(*values)

Bases: str, Enum

Enumerates supported content filter providers.

This enum defines the available content filtering services that can be used for content moderation tasks. Each enum value represents a specific provider.

Values:

AZURE: Represents the Azure Content Safety service.

LLAMA_GUARD_3_8B: Represents the Llama Guard 3 based on Llama-3.1-8B pretrained model.

AZURE = 'azure_content_safety'
LLAMA_GUARD_3_8B = 'llama_guard_3_8b'
class gen_ai_hub.orchestration.models.content_filter.ContentFilter(provider: ContentFilterProvider | str, config: dict)

Bases: JSONSerializable

Base class for content filtering configurations.

This class provides a generic structure for defining content filters from various providers. It allows for specifying the provider and associated configuration parameters.

__init__(provider: ContentFilterProvider | str, config: dict)

Initializes the ContentFilter with specified provider and configuration.

Parameters:
  • provider (Union[ContentFilterProvider, str]) – The name of the content filter provider.

  • config (dict) – A dictionary containing the configuration parameters for the content filter.

to_dict()

to_dict method to convert the content filter to a dictionary.

Returns:

dictionary representation of the content filter.

Return type:

dict