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:
IdentifierIdentifier 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
Additional converter-specific parameters.
hashList of sub-converter identifiers for composite converters like ConverterPipeline.
Information about the prompt target used by the converter (for LLM-based converters).
The input data types supported by this converter (e.g., ('text',), ('image', 'text')).
The output data types produced by this converter.
class_nameclass_moduleclass_descriptionidentifier_typesnake_class_nameunique_namepyrit_version- 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:
- sub_identifier: List['ConverterIdentifier'] | None = None#
List of sub-converter identifiers for composite converters like ConverterPipeline.