pyrit.message_normalizer.GenericSystemSquashNormalizer#

class GenericSystemSquashNormalizer[source]#

Bases: MessageListNormalizer[Message]

Normalizer that combines the first system message with the first user message using generic instruction tags.

__init__()#

Methods

__init__()

normalize_async(messages)

Return messages with the first system message combined into the first user message.

normalize_to_dicts_async(messages)

Normalize the list of messages into a list of dictionaries.

async normalize_async(messages: List[Message]) List[Message][source]#

Return messages with the first system message combined into the first user message.

The format uses generic instruction tags: ### Instructions ### {system_content} ###### {user_content}

Parameters:

messages – The list of messages to normalize.

Returns:

A Message with the system message squashed into the first user message.

Raises:

ValueError – If the messages list is empty.