pyrit.chat_message_normalizer.GenericSystemSquash#
- class GenericSystemSquash[source]#
Bases:
ChatMessageNormalizer
[list
[ChatMessage
]]- __init__()#
Methods
__init__
()combine_system_user_message
(system_message, ...)Combines the system message with the user message.
normalize
(messages)Returns the first system message combined with the first user message.
squash_system_message
(messages, squash_function)Combines 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'] = 'user') ChatMessage [source]#
Combines the system message with the user message.
- Parameters:
- Returns:
The combined message.
- Return type:
- normalize(messages: list[ChatMessage]) list[ChatMessage] [source]#
Returns 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: