pyrit.chat_message_normalizer.GenericSystemSquash#
- class GenericSystemSquash[source]#
Bases:
ChatMessageNormalizer[list[ChatMessage]]Normalizer that combines the first system message with the first user message using generic instruction tags.
- __init__()#
Methods
__init__()combine_system_user_message(system_message, ...)Combine the system message with the user message.
normalize(messages)Return the first system message combined with the first user message.
squash_system_message(messages, squash_function)Combine the system message into the first user request.
- static combine_system_user_message(system_message: ChatMessage, user_message: ChatMessage, msg_type: Literal['system', 'user', 'assistant', 'tool', 'developer'] = 'user') ChatMessage[source]#
Combine the system message with the user message.
- Parameters:
- Returns:
The combined message.
- Return type:
- normalize(messages: list[ChatMessage]) list[ChatMessage][source]#
Return the first system message combined with the first user message.
The format of the result uses generic instruction tags.
- Parameters:
messages (list[ChatMessage]) – The list of messages to normalize.
- Returns:
The normalized list of messages.
- Return type: