curious_battle
11/04/2025, 4:50 AMmichaelmichaelmichael
11/04/2025, 6:08 AMjson
[
{
"role": "system",
"content": "You are a helpful assistant for {{company}}. Description: {{company_description}}. Context: {{previous_context}}"
},
{
"role": "user",
"content": "{{user_input}}. Additional context: {{user_context}}"
}
]
Your test data (tests.csv):
csv
company,company_description,previous_context,user_input,user_context,__expected
"Acme Corp","Leading widget provider","Customer called yesterday","What's my order status?","Premium customer",contains: order
"TechStart Inc","Software solutions","No previous interactions","How do I reset my password?","Free tier",contains: passwordmichaelmichaelmichael
11/04/2025, 6:08 AMyaml
prompts:
- file://prompt.json
providers:
- openai:gpt-5-nano
tests: file://tests.csv
That's it! All 5 placeholders (company, company_description, previous_context, user_input, user_context) get filled from the CSV columns. Each row in the CSV becomes a separate test case.
You can also separate static and dynamic variables. If some variables like company, company_description, and previous_context stay the same across all your tests, you can define them once in your config and only put the changing values in your CSV:
Config:
yaml
prompts:
- file://prompt.json
providers:
- openai:gpt-5-nano
defaultTest:
vars:
company: "Acme Corp"
company_description: "Leading widget provider"
previous_context: "Customer has been with us for 5 years"
tests: file://tests.csv
Simplified CSV (tests.csv):
csv
user_input,user_context,__expected
"What's my order status?","Premium customer",contains: order
"How do I reset my password?","Free tier user",contains: password
The variables in defaultTest.vars automatically get merged with each row from your CSV. This keeps your test data cleaner and easier to maintain.
For more details and examples:
- Test cases & CSV format: https://promptfoo.dev/docs/configuration/test-cases
- Prompts & variables: https://promptfoo.dev/docs/configuration/prompts
All of these approaches work today! Best of luck!