Skip to content

Conversation

@rlundeen2
Copy link
Contributor

@rlundeen2 rlundeen2 commented Dec 31, 2025

This PR refactors the MessageNormalizer abstraction to standardize how PyRIT converts Message objects into formats required by different LLM targets or situations. Or, as an example, to translate Message to a string that could be understood in a system prompt. It also adds documentation and improves test coverage.

This is an update to the old ChatMessageNormalizer class. This also refactors AzureMLTarget which made use of this, and removed other legacy places that used ChatMessage.

Note: this is part of a bigger change to normalize prepended_conversations for attacks. To see a prototype of that, see d647054

api_key: Optional[str] = None,
chat_message_normalizer: ChatMessageNormalizer = ChatMessageNop(),
model_name: str = "",
message_normalizer: Optional[MessageListNormalizer] = None,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class was so messy, very happy about finally cleaning it up :D

@romanlutz
Copy link
Contributor

We're removing an entire module that users might have interacted with so this is most definitely BREAKING.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants