pyrit.chat_message_normalizer.ChatMessageNormalizerChatML#

class ChatMessageNormalizerChatML[source]#

Bases: ChatMessageNormalizer[str]

__init__()#

Methods

__init__()

from_chatml(content)

Convert a chatML string to a list of chat messages

normalize(messages)

Convert a string of text to a ChatML string.

squash_system_message(messages, squash_function)

Combines the system message into the first user request.

static from_chatml(content: str) list[ChatMessage][source]#

Convert a chatML string to a list of chat messages

normalize(messages: list[ChatMessage]) str[source]#

Convert a string of text to a ChatML string. This is compliant with the ChatML specified in openai/openai-python