Roleplay Prompt Testing with Promptfoo

Usage
Test different versions of system prompts, or entirely different system prompts at the same time!
Test different LLMs, or different temperatures at the same time!
Prerequisites
Install Promptfoo
Install git (for bash)
Install VSCode (optional but recommended)
https://code.visualstudio.com/Download the
roleplay-testerproject
https://github.com/ritodosa/roleplay-tester
Check out & use the
roleplay-testerprojectThe
roleplay-testerproject has all the sample files it needs, you may test run it right after download!To change it to your own, replace the following contents with your own
JohnDoe.md: Your character profile you want to testMarySue.md: Your personaprompt_A.md: Your system prompt you want to testprompt_B.md: A secondary system prompt you want to test alongside prompt_Atest_cases/campsite_trip/first_msg.txt: Your first messagetest_cases/campsite_trip/reply_questioning_the_spray.txt: Your replytest_cases/campsite_trip/reply_spider_threat.txt: A secondary reply
Setup the main configuration in
promptfoo_config.yamlproviders- Setup the llms you want in providers. Check this list for supported providers:
https://www.promptfoo.dev/docs/providers/
- Setup the llms you want in providers. Check this list for supported providers:
prompts- If you have only one prompt to test, just delete or comment out the second item for full_prompt_B.
defaultTestReplace
char,userwith your persona names. (It is needed so the placeholders in the system prompts can be correctly replaced.)Set the correct filepath for
char_persona,user_personaif you created new files other thanJohnDoe.md,MarySue.md.You may leave
prompt_A,prompt_Bas is, unless you renamed it.
tests- Rename the
description, set the correct filepath forfirst_msg,user_inputto whatever you’re using.
- Rename the
Running the tests
Open git bash in the folder where promptfoo_config.yaml is located.
Setup you api keys in the git bash (needs to be set everytime you re-open git bash).
export ANTHROPIC_API_KEY=your_key export GEMINI_API_KEY=your_key export OPENAI_API_KEY=your_key export OPENROUTER_API_KEY=your_key
Run promptfoo eval
promptfoo eval -c promptfoo_config.yaml --no-cache
View the results using
promptfoo view
Sample results from 2 different prompts x 2 different LLMs x 2 replies:





