Test Policy Plugin Code Generation
Promptfoo internal suite testing its own PolicyPlugin redteam test generator across five generation modes.
Why it matters
This asset evaluates the Policy Plugin's test generation capabilities. It ensures the plugin's code generation for tests is robust and accurate.
Outcomes
What it gets done
Evaluate the Policy Plugin's test generation.
Verify the accuracy of generated test code.
Debug potential issues in the test generation process.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-evals | bash Steps
Steps in the chain
Overview
Evals
An internal promptfoo suite validating the PolicyPlugin redteam test generator across five native generation modes via promptfoo's real CLI generation path. Use when validating changes to promptfoo's own PolicyPlugin redteam test generator before shipping them.
What it does
This suite evaluates the PolicyPlugin test generator itself. It compares five native promptfoo redteam generate cases: normal single-input generation, policy text with explicit test-generation instructions, modifier-driven generation (Spanish output), multi-input generation with coordinated document/query attacks, and log-analysis generation with PromptBlock: output. The eval flow runs promptfoo redteam generate against each case config under cases/, normalizes the generated YAML into a stable JSON payload, and feeds that payload into promptfoo assertions and llm-rubric checks through an executable prompt - keeping the suite on promptfoo's real CLI generation path instead of a custom harness provider.
When to use - and when NOT to
Use this suite when validating that promptfoo's own PolicyPlugin redteam generator produces correct output across its supported generation modes - single-input, instruction-driven, modifier-driven, multi-input, and log-analysis. It is not a redteam suite for testing a third-party model or application - it tests promptfoo's own test-generation logic.
Inputs and outputs
Requires OPENAI_API_KEY in the environment or .env. From the repository root:
npm run local -- validate -c src/redteam/plugins/policy/evals/promptfooconfig.yaml
npm run local -- eval -c src/redteam/plugins/policy/evals/promptfooconfig.yaml --env-file .env --no-cache
A single comparison case can be generated directly, e.g. npm run local -- redteam generate -c src/redteam/plugins/policy/evals/cases/normal-single-input.yaml -o /tmp/policy-normal.yaml --force.
Integrations
Four files make up the suite: promptfooconfig.yaml (the eval suite), generatePolicyEvalPrompt.cjs (an executable prompt that runs redteam generate for one case and emits normalized JSON), cases/*.yaml (the native redteam generation configs being compared), and tests/policy-generation.yaml (case metadata and promptfoo assertions).
Who it's for
Promptfoo maintainers and contributors validating that the PolicyPlugin redteam test generator behaves correctly across its supported generation modes before shipping changes to it.
Source README
policy evals
This suite evaluates the PolicyPlugin test generator itself.
It compares five native promptfoo redteam generate cases:
- normal single-input generation
- policy text with explicit test-generation instructions
- modifier-driven generation (Spanish output)
- multi-input generation with coordinated
document/queryattacks - log-analysis generation with
PromptBlock:output
The eval flow is:
- run
promptfoo redteam generateagainst each case config undercases/ - normalize the generated YAML into a stable JSON payload
- feed that payload into Promptfoo assertions and
llm-rubricchecks through an executable prompt
That keeps the suite on Promptfoo's real CLI generation path instead of using a custom harness provider.
Prerequisites
OPENAI_API_KEYavailable in your environment or in.env
Run
From the repository root:
npm run local -- validate -c src/redteam/plugins/policy/evals/promptfooconfig.yaml
npm run local -- eval -c src/redteam/plugins/policy/evals/promptfooconfig.yaml --env-file .env --no-cache
To generate any single comparison case directly:
npm run local -- redteam generate -c src/redteam/plugins/policy/evals/cases/normal-single-input.yaml -o /tmp/policy-normal.yaml --force
Files
promptfooconfig.yaml- eval suitegeneratePolicyEvalPrompt.cjs- executable prompt that runsredteam generatefor one case and emits normalized JSONcases/*.yaml- native redteam generation configs being comparedtests/policy-generation.yaml- case metadata and Promptfoo assertions
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.