pyrit.identifiers.ConverterIdentifier#

class ConverterIdentifier(class_name: str, class_module: str, class_description: str, identifier_type: IdentifierType, sub_identifier: Optional[List['ConverterIdentifier']] = None, target_info: Optional[Dict[str, Any]] = None, converter_specific_params: Optional[Dict[str, Any]] = None, *, hash: str | None = None, pyrit_version: str = <factory>, supported_input_types: Tuple[str, ...], supported_output_types: Tuple[str, ...])[source]#

Bases: Identifier

Identifier for PromptConverter instances.

This frozen dataclass extends Identifier with converter-specific fields. It provides a structured way to identify and track converters used in prompt transformations.

__init__(class_name: str, class_module: str, class_description: str, identifier_type: IdentifierType, sub_identifier: Optional[List['ConverterIdentifier']] = None, target_info: Optional[Dict[str, Any]] = None, converter_specific_params: Optional[Dict[str, Any]] = None, *, hash: str | None = None, pyrit_version: str = <factory>, supported_input_types: Tuple[str, ...], supported_output_types: Tuple[str, ...]) None#

Methods

__init__(class_name, class_module, ...[, ...])

from_dict(data)

Create a ConverterIdentifier from a dictionary (e.g., retrieved from database).

normalize(value)

Normalize a value to an Identifier instance.

to_dict()

Return only fields suitable for DB storage.

Attributes

converter_specific_params

Additional converter-specific parameters.

hash

sub_identifier

List of sub-converter identifiers for composite converters like ConverterPipeline.

target_info

Information about the prompt target used by the converter (for LLM-based converters).

supported_input_types

The input data types supported by this converter (e.g., ('text',), ('image', 'text')).

supported_output_types

The output data types produced by this converter.

class_name

class_module

class_description

identifier_type

snake_class_name

unique_name

pyrit_version

converter_specific_params: Dict[str, Any] | None = None#

Additional converter-specific parameters.

classmethod from_dict(data: dict[str, Any]) ConverterIdentifier[source]#

Create a ConverterIdentifier from a dictionary (e.g., retrieved from database).

Extends the base Identifier.from_dict() to recursively reconstruct nested ConverterIdentifier objects in sub_identifier.

Parameters:

data – The dictionary representation.

Returns:

A new ConverterIdentifier instance.

Return type:

ConverterIdentifier

sub_identifier: List['ConverterIdentifier'] | None = None#

List of sub-converter identifiers for composite converters like ConverterPipeline.

supported_input_types: Tuple[str, ...]#

The input data types supported by this converter (e.g., (‘text’,), (‘image’, ‘text’)).

supported_output_types: Tuple[str, ...]#

The output data types produced by this converter.

target_info: Dict[str, Any] | None = None#

Information about the prompt target used by the converter (for LLM-based converters).