Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Michael 360d7b519d
docs(examples): add uniform init commands to all example READMEs (#4068)
3 months ago
..
360d7b519d
docs(examples): add uniform init commands to all example READMEs (#4068)
3 months ago
7bffbe9bb9
feat: add CSV metadata column support with array values (#2709)
5 months ago
6498390323
chore: Update csv docs and trim whitespace for keys in CSV test files (#3571)
4 months ago

README.md

You have to be logged in to leave a comment. Sign In

csv-metadata (# CSV Metadata Example)

You can run this example with:

npx promptfoo@latest init --example csv-metadata

This example demonstrates how to use metadata columns in CSV test files to organize and filter your test cases. You can see more details on how to build a test cases CSV in the Promptfoo docs

Files

  • promptfooconfig.yaml: Configuration file with a simple prompt and provider setup
  • tests.csv: Test cases with metadata columns for categorization and filtering

Metadata Columns

The CSV file includes two types of metadata columns:

  1. __metadata:category - Single value metadata for broad categorization
  2. __metadata:tags[] - Array metadata for multiple tags, with comma separation and escape support

Running the Example

Basic evaluation:

promptfoo eval

Filter by category:

promptfoo eval --filter-metadata category=technology

Filter by tags:

promptfoo eval --filter-metadata tags=ai

Note that array metadata values (tags) support escaped commas. For example, "global,warming" is treated as a single tag.

Expected Output

The example includes basic assertions using the __expected column to verify outputs contain relevant keywords.

Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...