Skip to content

Preserve roles when converting messages to seed prompts#1508

Open
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:preserve-seed-prompt-roles
Open

Preserve roles when converting messages to seed prompts#1508
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:preserve-seed-prompt-roles

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • preserve API-compatible message roles when converting Message objects to SeedPrompt records
  • keep the existing simulated_assistant -> assistant normalization by relying on message.api_role
  • add regression coverage for system, developer, tool, and simulated_assistant

Problem

SeedPrompt.from_messages() currently collapses every non-assistant message role to user. That loses supported roles such as system, developer, and tool when messages are converted into seed prompts.

Validation

  • .venv/bin/pytest tests/unit/models/test_seed.py -q
  • .venv/bin/ruff check pyrit/models/seeds/seed_prompt.py tests/unit/models/test_seed.py

Copy link
Contributor

@romanlutz romanlutz left a comment

Choose a reason for hiding this comment

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

This looks correct. I'm wondering why we had that here...

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