From 423ae213a5acc2cba30440280000542679163a57 Mon Sep 17 00:00:00 2001 From: Richard Lundeen Date: Wed, 19 Aug 2026 13:24:26 -0700 Subject: [PATCH] DOC: add model metadata serialization guidance Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9b95a2c8-cdc2-4e94-9776-cbea2a2b41ff --- doc/code/framework.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/code/framework.md b/doc/code/framework.md index a3938ef2dc..278bf9c466 100644 --- a/doc/code/framework.md +++ b/doc/code/framework.md @@ -309,6 +309,8 @@ The below talks about responsibilities of most modules in the PyRIT library - Models includes `identifiers` which are descriptions of the core components. And along with the registry, can often recreate those components. - Models includes types passed around between components, and should be prefered in REST - models should never depend on anything except lightweight Python (the standard library and pydantic) and pyrit.common +- Store metadata on the narrowest model that owns it (for example, request or response data belongs on `MessagePiece`, not `Message`). Use explicit typed fields for stable, core, or independently queried data. +- For shared metadata, define a lightweight value object in `pyrit.models` that owns its keys and provides symmetric `to_metadata()` and `from_metadata()` methods. Use `JsonResponseConfig` as the pattern for data stored in `MessagePiece.prompt_metadata`. ## [Normalizers](./targets/11_message_normalizer)